summaryrefslogtreecommitdiffstats
path: root/src/widgets
diff options
context:
space:
mode:
Diffstat (limited to 'src/widgets')
-rw-r--r--src/widgets/accessible/qaccessiblewidget.cpp96
-rw-r--r--src/widgets/accessible/qaccessiblewidget.h5
-rw-r--r--src/widgets/animation/qguivariantanimation.cpp4
-rw-r--r--src/widgets/dialogs/qcolordialog.cpp25
-rw-r--r--src/widgets/dialogs/qcolordialog.h5
-rw-r--r--src/widgets/dialogs/qcolordialog_mac.mm4
-rw-r--r--src/widgets/dialogs/qcolordialog_p.h4
-rw-r--r--src/widgets/dialogs/qdialog.cpp45
-rw-r--r--src/widgets/dialogs/qdialog.h5
-rw-r--r--src/widgets/dialogs/qdialog_p.h6
-rw-r--r--src/widgets/dialogs/qerrormessage.cpp16
-rw-r--r--src/widgets/dialogs/qerrormessage.h5
-rw-r--r--src/widgets/dialogs/qfiledialog.cpp154
-rw-r--r--src/widgets/dialogs/qfiledialog.h13
-rw-r--r--src/widgets/dialogs/qfiledialog.ui4
-rw-r--r--src/widgets/dialogs/qfiledialog_embedded.ui4
-rw-r--r--src/widgets/dialogs/qfiledialog_mac.mm4
-rw-r--r--src/widgets/dialogs/qfiledialog_p.h26
-rw-r--r--src/widgets/dialogs/qfileinfogatherer.cpp6
-rw-r--r--src/widgets/dialogs/qfileinfogatherer_p.h4
-rw-r--r--src/widgets/dialogs/qfilesystemmodel.cpp34
-rw-r--r--src/widgets/dialogs/qfilesystemmodel.h5
-rw-r--r--src/widgets/dialogs/qfilesystemmodel_p.h4
-rw-r--r--src/widgets/dialogs/qfontdialog.cpp31
-rw-r--r--src/widgets/dialogs/qfontdialog.h17
-rw-r--r--src/widgets/dialogs/qfontdialog_mac.mm4
-rw-r--r--src/widgets/dialogs/qfontdialog_p.h4
-rw-r--r--src/widgets/dialogs/qfscompleter_p.h6
-rw-r--r--src/widgets/dialogs/qinputdialog.cpp51
-rw-r--r--src/widgets/dialogs/qinputdialog.h37
-rw-r--r--src/widgets/dialogs/qmessagebox.cpp65
-rw-r--r--src/widgets/dialogs/qmessagebox.h12
-rw-r--r--src/widgets/dialogs/qnspanelproxy_mac.mm4
-rw-r--r--src/widgets/dialogs/qprogressdialog.cpp15
-rw-r--r--src/widgets/dialogs/qprogressdialog.h5
-rw-r--r--src/widgets/dialogs/qsidebar.cpp4
-rw-r--r--src/widgets/dialogs/qsidebar_p.h4
-rw-r--r--src/widgets/dialogs/qwizard.cpp21
-rw-r--r--src/widgets/dialogs/qwizard.h9
-rw-r--r--src/widgets/dialogs/qwizard_win.cpp25
-rw-r--r--src/widgets/dialogs/qwizard_win_p.h6
-rw-r--r--src/widgets/effects/qgraphicseffect.cpp4
-rw-r--r--src/widgets/effects/qgraphicseffect.h5
-rw-r--r--src/widgets/effects/qgraphicseffect_p.h4
-rw-r--r--src/widgets/effects/qpixmapfilter.cpp4
-rw-r--r--src/widgets/effects/qpixmapfilter_p.h5
-rw-r--r--src/widgets/graphicsview/graphicsview.pri1
-rw-r--r--src/widgets/graphicsview/qgraph_p.h4
-rw-r--r--src/widgets/graphicsview/qgraphicsanchorlayout.cpp4
-rw-r--r--src/widgets/graphicsview/qgraphicsanchorlayout.h7
-rw-r--r--src/widgets/graphicsview/qgraphicsanchorlayout_p.cpp4
-rw-r--r--src/widgets/graphicsview/qgraphicsanchorlayout_p.h4
-rw-r--r--src/widgets/graphicsview/qgraphicsgridlayout.cpp4
-rw-r--r--src/widgets/graphicsview/qgraphicsgridlayout.h7
-rw-r--r--src/widgets/graphicsview/qgraphicsitem.cpp24
-rw-r--r--src/widgets/graphicsview/qgraphicsitem.h9
-rw-r--r--src/widgets/graphicsview/qgraphicsitem_p.h6
-rw-r--r--src/widgets/graphicsview/qgraphicsitemanimation.cpp4
-rw-r--r--src/widgets/graphicsview/qgraphicsitemanimation.h7
-rw-r--r--src/widgets/graphicsview/qgraphicslayout.cpp4
-rw-r--r--src/widgets/graphicsview/qgraphicslayout.h9
-rw-r--r--src/widgets/graphicsview/qgraphicslayout_p.cpp4
-rw-r--r--src/widgets/graphicsview/qgraphicslayout_p.h6
-rw-r--r--src/widgets/graphicsview/qgraphicslayoutitem.cpp4
-rw-r--r--src/widgets/graphicsview/qgraphicslayoutitem.h9
-rw-r--r--src/widgets/graphicsview/qgraphicslayoutitem_p.h4
-rw-r--r--src/widgets/graphicsview/qgraphicslinearlayout.cpp4
-rw-r--r--src/widgets/graphicsview/qgraphicslinearlayout.h7
-rw-r--r--src/widgets/graphicsview/qgraphicsproxywidget.cpp4
-rw-r--r--src/widgets/graphicsview/qgraphicsproxywidget.h7
-rw-r--r--src/widgets/graphicsview/qgraphicsproxywidget_p.h6
-rw-r--r--src/widgets/graphicsview/qgraphicsscene.cpp10
-rw-r--r--src/widgets/graphicsview/qgraphicsscene.h7
-rw-r--r--src/widgets/graphicsview/qgraphicsscene_bsp.cpp4
-rw-r--r--src/widgets/graphicsview/qgraphicsscene_bsp_p.h6
-rw-r--r--src/widgets/graphicsview/qgraphicsscene_p.h6
-rw-r--r--src/widgets/graphicsview/qgraphicsscenebsptreeindex.cpp4
-rw-r--r--src/widgets/graphicsview/qgraphicsscenebsptreeindex_p.h6
-rw-r--r--src/widgets/graphicsview/qgraphicssceneevent.cpp4
-rw-r--r--src/widgets/graphicsview/qgraphicssceneevent.h7
-rw-r--r--src/widgets/graphicsview/qgraphicssceneindex.cpp4
-rw-r--r--src/widgets/graphicsview/qgraphicssceneindex_p.h7
-rw-r--r--src/widgets/graphicsview/qgraphicsscenelinearindex.cpp4
-rw-r--r--src/widgets/graphicsview/qgraphicsscenelinearindex_p.h7
-rw-r--r--src/widgets/graphicsview/qgraphicstransform.cpp4
-rw-r--r--src/widgets/graphicsview/qgraphicstransform.h5
-rw-r--r--src/widgets/graphicsview/qgraphicstransform_p.h4
-rw-r--r--src/widgets/graphicsview/qgraphicsview.cpp4
-rw-r--r--src/widgets/graphicsview/qgraphicsview.h7
-rw-r--r--src/widgets/graphicsview/qgraphicsview_p.h6
-rw-r--r--src/widgets/graphicsview/qgraphicswidget.cpp4
-rw-r--r--src/widgets/graphicsview/qgraphicswidget.h11
-rw-r--r--src/widgets/graphicsview/qgraphicswidget_p.cpp4
-rw-r--r--src/widgets/graphicsview/qgraphicswidget_p.h8
-rw-r--r--src/widgets/graphicsview/qgridlayoutengine.cpp4
-rw-r--r--src/widgets/graphicsview/qgridlayoutengine_p.h4
-rw-r--r--src/widgets/graphicsview/qsimplex_p.cpp4
-rw-r--r--src/widgets/graphicsview/qsimplex_p.h4
-rw-r--r--src/widgets/itemviews/qabstractitemdelegate.cpp19
-rw-r--r--src/widgets/itemviews/qabstractitemdelegate.h7
-rw-r--r--src/widgets/itemviews/qabstractitemview.cpp57
-rw-r--r--src/widgets/itemviews/qabstractitemview.h7
-rw-r--r--src/widgets/itemviews/qabstractitemview_p.h13
-rw-r--r--src/widgets/itemviews/qbsptree.cpp4
-rw-r--r--src/widgets/itemviews/qbsptree_p.h4
-rw-r--r--src/widgets/itemviews/qcolumnview.cpp4
-rw-r--r--src/widgets/itemviews/qcolumnview.h5
-rw-r--r--src/widgets/itemviews/qcolumnview_p.h4
-rw-r--r--src/widgets/itemviews/qcolumnviewgrip.cpp4
-rw-r--r--src/widgets/itemviews/qcolumnviewgrip_p.h4
-rw-r--r--src/widgets/itemviews/qdatawidgetmapper.cpp4
-rw-r--r--src/widgets/itemviews/qdatawidgetmapper.h5
-rw-r--r--src/widgets/itemviews/qdirmodel.cpp14
-rw-r--r--src/widgets/itemviews/qdirmodel.h5
-rw-r--r--src/widgets/itemviews/qfileiconprovider.cpp16
-rw-r--r--src/widgets/itemviews/qfileiconprovider.h5
-rw-r--r--src/widgets/itemviews/qheaderview.cpp22
-rw-r--r--src/widgets/itemviews/qheaderview.h5
-rw-r--r--src/widgets/itemviews/qheaderview_p.h4
-rw-r--r--src/widgets/itemviews/qitemdelegate.cpp11
-rw-r--r--src/widgets/itemviews/qitemdelegate.h5
-rw-r--r--src/widgets/itemviews/qitemeditorfactory.cpp40
-rw-r--r--src/widgets/itemviews/qitemeditorfactory.h13
-rw-r--r--src/widgets/itemviews/qitemeditorfactory_p.h4
-rw-r--r--src/widgets/itemviews/qlistview.cpp10
-rw-r--r--src/widgets/itemviews/qlistview.h5
-rw-r--r--src/widgets/itemviews/qlistview_p.h4
-rw-r--r--src/widgets/itemviews/qlistwidget.cpp4
-rw-r--r--src/widgets/itemviews/qlistwidget.h5
-rw-r--r--src/widgets/itemviews/qlistwidget_p.h4
-rw-r--r--src/widgets/itemviews/qproxymodel.cpp4
-rw-r--r--src/widgets/itemviews/qproxymodel.h5
-rw-r--r--src/widgets/itemviews/qproxymodel_p.h4
-rw-r--r--src/widgets/itemviews/qstandarditemmodel.cpp13
-rw-r--r--src/widgets/itemviews/qstandarditemmodel.h7
-rw-r--r--src/widgets/itemviews/qstandarditemmodel_p.h4
-rw-r--r--src/widgets/itemviews/qstyleditemdelegate.cpp11
-rw-r--r--src/widgets/itemviews/qstyleditemdelegate.h5
-rw-r--r--src/widgets/itemviews/qtableview.cpp16
-rw-r--r--src/widgets/itemviews/qtableview.h5
-rw-r--r--src/widgets/itemviews/qtableview_p.h4
-rw-r--r--src/widgets/itemviews/qtablewidget.cpp4
-rw-r--r--src/widgets/itemviews/qtablewidget.h5
-rw-r--r--src/widgets/itemviews/qtablewidget_p.h4
-rw-r--r--src/widgets/itemviews/qtreeview.cpp14
-rw-r--r--src/widgets/itemviews/qtreeview.h5
-rw-r--r--src/widgets/itemviews/qtreeview_p.h4
-rw-r--r--src/widgets/itemviews/qtreewidget.cpp4
-rw-r--r--src/widgets/itemviews/qtreewidget.h5
-rw-r--r--src/widgets/itemviews/qtreewidget_p.h4
-rw-r--r--src/widgets/itemviews/qtreewidgetitemiterator.cpp4
-rw-r--r--src/widgets/itemviews/qtreewidgetitemiterator.h5
-rw-r--r--src/widgets/itemviews/qtreewidgetitemiterator_p.h4
-rw-r--r--src/widgets/itemviews/qwidgetitemdata_p.h4
-rw-r--r--src/widgets/kernel/kernel.pri8
-rw-r--r--src/widgets/kernel/qaction.cpp8
-rw-r--r--src/widgets/kernel/qaction.h5
-rw-r--r--src/widgets/kernel/qaction_p.h4
-rw-r--r--src/widgets/kernel/qactiongroup.cpp4
-rw-r--r--src/widgets/kernel/qactiongroup.h5
-rw-r--r--src/widgets/kernel/qapplication.cpp161
-rw-r--r--src/widgets/kernel/qapplication.h17
-rw-r--r--src/widgets/kernel/qapplication_p.h31
-rw-r--r--src/widgets/kernel/qapplication_qpa.cpp16
-rw-r--r--src/widgets/kernel/qboxlayout.cpp4
-rw-r--r--src/widgets/kernel/qboxlayout.h5
-rw-r--r--src/widgets/kernel/qdesktopwidget.cpp4
-rw-r--r--src/widgets/kernel/qdesktopwidget.h5
-rw-r--r--src/widgets/kernel/qdesktopwidget.qdoc4
-rw-r--r--src/widgets/kernel/qdesktopwidget_qpa.cpp4
-rw-r--r--src/widgets/kernel/qdesktopwidget_qpa_p.h4
-rw-r--r--src/widgets/kernel/qformlayout.cpp11
-rw-r--r--src/widgets/kernel/qformlayout.h5
-rw-r--r--src/widgets/kernel/qgesture.cpp4
-rw-r--r--src/widgets/kernel/qgesture.h5
-rw-r--r--src/widgets/kernel/qgesture_p.h4
-rw-r--r--src/widgets/kernel/qgesturemanager.cpp4
-rw-r--r--src/widgets/kernel/qgesturemanager_p.h4
-rw-r--r--src/widgets/kernel/qgesturerecognizer.cpp4
-rw-r--r--src/widgets/kernel/qgesturerecognizer.h5
-rw-r--r--src/widgets/kernel/qgridlayout.cpp4
-rw-r--r--src/widgets/kernel/qgridlayout.h5
-rw-r--r--src/widgets/kernel/qguiplatformplugin.cpp6
-rw-r--r--src/widgets/kernel/qguiplatformplugin_p.h5
-rw-r--r--src/widgets/kernel/qicon.cpp86
-rw-r--r--src/widgets/kernel/qicon.h7
-rw-r--r--src/widgets/kernel/qicon_p.h21
-rw-r--r--src/widgets/kernel/qiconengine.cpp96
-rw-r--r--src/widgets/kernel/qiconengine.h33
-rw-r--r--src/widgets/kernel/qiconengineplugin.cpp71
-rw-r--r--src/widgets/kernel/qiconengineplugin.h34
-rw-r--r--src/widgets/kernel/qiconloader.cpp27
-rw-r--r--src/widgets/kernel/qiconloader_p.h8
-rw-r--r--src/widgets/kernel/qinputcontext.cpp408
-rw-r--r--src/widgets/kernel/qinputcontext.h128
-rw-r--r--src/widgets/kernel/qlayout.cpp4
-rw-r--r--src/widgets/kernel/qlayout.h5
-rw-r--r--src/widgets/kernel/qlayout_p.h4
-rw-r--r--src/widgets/kernel/qlayoutengine.cpp4
-rw-r--r--src/widgets/kernel/qlayoutengine_p.h4
-rw-r--r--src/widgets/kernel/qlayoutitem.cpp4
-rw-r--r--src/widgets/kernel/qlayoutitem.h5
-rw-r--r--src/widgets/kernel/qplatformdialoghelper_qpa.cpp556
-rw-r--r--src/widgets/kernel/qplatformdialoghelper_qpa.h315
-rw-r--r--src/widgets/kernel/qplatformmenu_qpa.cpp4
-rw-r--r--src/widgets/kernel/qplatformmenu_qpa.h79
-rw-r--r--src/widgets/kernel/qshortcut.cpp4
-rw-r--r--src/widgets/kernel/qshortcut.h5
-rw-r--r--src/widgets/kernel/qsizepolicy.h5
-rw-r--r--src/widgets/kernel/qsizepolicy.qdoc4
-rw-r--r--src/widgets/kernel/qsoftkeymanager.cpp53
-rw-r--r--src/widgets/kernel/qsoftkeymanager_common_p.h7
-rw-r--r--src/widgets/kernel/qsoftkeymanager_p.h7
-rw-r--r--src/widgets/kernel/qstackedlayout.cpp4
-rw-r--r--src/widgets/kernel/qstackedlayout.h5
-rw-r--r--src/widgets/kernel/qstandardgestures.cpp4
-rw-r--r--src/widgets/kernel/qstandardgestures_p.h4
-rw-r--r--src/widgets/kernel/qt_widgets_pch.h4
-rw-r--r--src/widgets/kernel/qtooltip.cpp4
-rw-r--r--src/widgets/kernel/qtooltip.h5
-rw-r--r--src/widgets/kernel/qwhatsthis.cpp8
-rw-r--r--src/widgets/kernel/qwhatsthis.h5
-rw-r--r--src/widgets/kernel/qwidget.cpp228
-rw-r--r--src/widgets/kernel/qwidget.h22
-rw-r--r--src/widgets/kernel/qwidget_p.h10
-rw-r--r--src/widgets/kernel/qwidget_qpa.cpp4
-rw-r--r--src/widgets/kernel/qwidgetaction.cpp4
-rw-r--r--src/widgets/kernel/qwidgetaction.h5
-rw-r--r--src/widgets/kernel/qwidgetaction_p.h4
-rw-r--r--src/widgets/kernel/qwidgetbackingstore.cpp4
-rw-r--r--src/widgets/kernel/qwidgetbackingstore_p.h4
-rw-r--r--src/widgets/kernel/qwidgetsvariant.cpp4
-rw-r--r--src/widgets/kernel/qwidgetwindow_qpa.cpp9
-rw-r--r--src/widgets/kernel/qwidgetwindow_qpa_p.h6
-rw-r--r--src/widgets/platforms/mac/qapplication_mac.mm1878
-rw-r--r--src/widgets/platforms/mac/qclipboard_mac.cpp632
-rw-r--r--src/widgets/platforms/mac/qcocoaintrospection_mac.mm119
-rw-r--r--src/widgets/platforms/mac/qcocoaintrospection_p.h84
-rw-r--r--src/widgets/platforms/mac/qcocoapanel_mac.mm68
-rw-r--r--src/widgets/platforms/mac/qcocoapanel_mac_p.h81
-rw-r--r--src/widgets/platforms/mac/qcocoasharedwindowmethods_mac_p.h610
-rw-r--r--src/widgets/platforms/mac/qcocoaview_mac.mm1386
-rw-r--r--src/widgets/platforms/mac/qcocoaview_mac_p.h85
-rw-r--r--src/widgets/platforms/mac/qcocoawindow_mac.mm88
-rw-r--r--src/widgets/platforms/mac/qcocoawindow_mac_p.h95
-rw-r--r--src/widgets/platforms/mac/qcocoawindowcustomthemeframe_mac.mm60
-rw-r--r--src/widgets/platforms/mac/qcocoawindowcustomthemeframe_mac_p.h61
-rw-r--r--src/widgets/platforms/mac/qcocoawindowdelegate_mac.mm437
-rw-r--r--src/widgets/platforms/mac/qcocoawindowdelegate_mac_p.h108
-rw-r--r--src/widgets/platforms/mac/qcolormap_mac.cpp111
-rw-r--r--src/widgets/platforms/mac/qdesktopwidget_mac.mm257
-rw-r--r--src/widgets/platforms/mac/qdesktopwidget_mac_p.h75
-rw-r--r--src/widgets/platforms/mac/qdnd_mac.mm261
-rw-r--r--src/widgets/platforms/mac/qeventdispatcher_mac.mm1127
-rw-r--r--src/widgets/platforms/mac/qeventdispatcher_mac_p.h218
-rw-r--r--src/widgets/platforms/mac/qkeymapper_mac.cpp963
-rw-r--r--src/widgets/platforms/mac/qmacdefines_mac.h158
-rw-r--r--src/widgets/platforms/mac/qmacgesturerecognizer_mac.mm270
-rw-r--r--src/widgets/platforms/mac/qmacgesturerecognizer_mac_p.h104
-rw-r--r--src/widgets/platforms/mac/qmacinputcontext_mac.cpp124
-rw-r--r--src/widgets/platforms/mac/qmacinputcontext_p.h97
-rw-r--r--src/widgets/platforms/mac/qmime_mac.cpp1126
-rw-r--r--src/widgets/platforms/mac/qnsframeview_mac_p.h154
-rw-r--r--src/widgets/platforms/mac/qnsthemeframe_mac_p.h246
-rw-r--r--src/widgets/platforms/mac/qnstitledframe_mac_p.h205
-rw-r--r--src/widgets/platforms/mac/qpaintdevice_mac.cpp103
-rw-r--r--src/widgets/platforms/mac/qpaintengine_mac.cpp1538
-rw-r--r--src/widgets/platforms/mac/qpaintengine_mac_p.h256
-rw-r--r--src/widgets/platforms/mac/qpixmap_mac.cpp1062
-rw-r--r--src/widgets/platforms/mac/qpixmap_mac_p.h134
-rw-r--r--src/widgets/platforms/mac/qprintengine_mac.mm840
-rw-r--r--src/widgets/platforms/mac/qprintengine_mac_p.h162
-rw-r--r--src/widgets/platforms/mac/qprinterinfo_mac.cpp120
-rw-r--r--src/widgets/platforms/mac/qregion_mac.cpp50
-rw-r--r--src/widgets/platforms/mac/qt_cocoa_helpers_mac.mm1438
-rw-r--r--src/widgets/platforms/mac/qt_cocoa_helpers_mac_p.h308
-rw-r--r--src/widgets/platforms/mac/qt_mac.cpp129
-rw-r--r--src/widgets/platforms/mac/qt_mac_p.h284
-rw-r--r--src/widgets/platforms/mac/qwidget_mac.mm3089
-rw-r--r--src/widgets/statemachine/qbasickeyeventtransition.cpp4
-rw-r--r--src/widgets/statemachine/qbasickeyeventtransition_p.h4
-rw-r--r--src/widgets/statemachine/qbasicmouseeventtransition.cpp4
-rw-r--r--src/widgets/statemachine/qbasicmouseeventtransition_p.h4
-rw-r--r--src/widgets/statemachine/qguistatemachine.cpp10
-rw-r--r--src/widgets/statemachine/qkeyeventtransition.cpp4
-rw-r--r--src/widgets/statemachine/qkeyeventtransition.h5
-rw-r--r--src/widgets/statemachine/qmouseeventtransition.cpp4
-rw-r--r--src/widgets/statemachine/qmouseeventtransition.h5
-rw-r--r--src/widgets/styles/qcdestyle.cpp4
-rw-r--r--src/widgets/styles/qcdestyle.h5
-rw-r--r--src/widgets/styles/qcleanlooksstyle.cpp4
-rw-r--r--src/widgets/styles/qcleanlooksstyle.h5
-rw-r--r--src/widgets/styles/qcleanlooksstyle_p.h4
-rw-r--r--src/widgets/styles/qcommonstyle.cpp4
-rw-r--r--src/widgets/styles/qcommonstyle.h5
-rw-r--r--src/widgets/styles/qcommonstyle_p.h4
-rw-r--r--src/widgets/styles/qcommonstylepixmaps_p.h4
-rw-r--r--src/widgets/styles/qdrawutil.cpp4
-rw-r--r--src/widgets/styles/qdrawutil.h5
-rw-r--r--src/widgets/styles/qgtkpainter.cpp4
-rw-r--r--src/widgets/styles/qgtkpainter_p.h4
-rw-r--r--src/widgets/styles/qgtkstyle.cpp4
-rw-r--r--src/widgets/styles/qgtkstyle.h5
-rw-r--r--src/widgets/styles/qgtkstyle_p.cpp4
-rw-r--r--src/widgets/styles/qgtkstyle_p.h4
-rw-r--r--src/widgets/styles/qmacstyle.qdoc4
-rw-r--r--src/widgets/styles/qmacstyle_mac.h5
-rw-r--r--src/widgets/styles/qmacstyle_mac.mm10
-rw-r--r--src/widgets/styles/qmacstyle_mac_p.h4
-rw-r--r--src/widgets/styles/qmacstylepixmaps_mac_p.h4
-rw-r--r--src/widgets/styles/qmotifstyle.cpp23
-rw-r--r--src/widgets/styles/qmotifstyle.h5
-rw-r--r--src/widgets/styles/qmotifstyle_p.h4
-rw-r--r--src/widgets/styles/qplastiquestyle.cpp7
-rw-r--r--src/widgets/styles/qplastiquestyle.h5
-rw-r--r--src/widgets/styles/qproxystyle.cpp4
-rw-r--r--src/widgets/styles/qproxystyle.h5
-rw-r--r--src/widgets/styles/qproxystyle_p.h4
-rw-r--r--src/widgets/styles/qstyle.cpp6
-rw-r--r--src/widgets/styles/qstyle.h5
-rw-r--r--src/widgets/styles/qstyle_p.h4
-rw-r--r--src/widgets/styles/qstylefactory.cpp16
-rw-r--r--src/widgets/styles/qstylefactory.h5
-rw-r--r--src/widgets/styles/qstylehelper.cpp4
-rw-r--r--src/widgets/styles/qstylehelper_p.h4
-rw-r--r--src/widgets/styles/qstyleoption.cpp1607
-rw-r--r--src/widgets/styles/qstyleoption.h269
-rw-r--r--src/widgets/styles/qstylepainter.cpp4
-rw-r--r--src/widgets/styles/qstylepainter.h5
-rw-r--r--src/widgets/styles/qstyleplugin.cpp4
-rw-r--r--src/widgets/styles/qstyleplugin.h7
-rw-r--r--src/widgets/styles/qstylesheetstyle.cpp4
-rw-r--r--src/widgets/styles/qstylesheetstyle_default.cpp7
-rw-r--r--src/widgets/styles/qstylesheetstyle_p.h4
-rw-r--r--src/widgets/styles/qwindowscestyle.cpp4
-rw-r--r--src/widgets/styles/qwindowscestyle.h5
-rw-r--r--src/widgets/styles/qwindowscestyle_p.h4
-rw-r--r--src/widgets/styles/qwindowsmobilestyle.cpp4
-rw-r--r--src/widgets/styles/qwindowsmobilestyle.h5
-rw-r--r--src/widgets/styles/qwindowsmobilestyle_p.h4
-rw-r--r--src/widgets/styles/qwindowsstyle.cpp4
-rw-r--r--src/widgets/styles/qwindowsstyle.h5
-rw-r--r--src/widgets/styles/qwindowsstyle_p.h4
-rw-r--r--src/widgets/styles/qwindowsvistastyle.cpp4
-rw-r--r--src/widgets/styles/qwindowsvistastyle.h5
-rw-r--r--src/widgets/styles/qwindowsvistastyle_p.h4
-rw-r--r--src/widgets/styles/qwindowsxpstyle.cpp110
-rw-r--r--src/widgets/styles/qwindowsxpstyle.h5
-rw-r--r--src/widgets/styles/qwindowsxpstyle_p.h9
-rw-r--r--src/widgets/util/qcolormap.h5
-rw-r--r--src/widgets/util/qcolormap.qdoc4
-rw-r--r--src/widgets/util/qcolormap_qpa.cpp4
-rw-r--r--src/widgets/util/qcompleter.cpp21
-rw-r--r--src/widgets/util/qcompleter.h5
-rw-r--r--src/widgets/util/qcompleter_p.h4
-rw-r--r--src/widgets/util/qflickgesture.cpp4
-rw-r--r--src/widgets/util/qflickgesture_p.h4
-rw-r--r--src/widgets/util/qscroller.cpp17
-rw-r--r--src/widgets/util/qscroller.h5
-rw-r--r--src/widgets/util/qscroller_mac.mm4
-rw-r--r--src/widgets/util/qscroller_p.h4
-rw-r--r--src/widgets/util/qscrollerproperties.cpp4
-rw-r--r--src/widgets/util/qscrollerproperties.h5
-rw-r--r--src/widgets/util/qscrollerproperties_p.h4
-rw-r--r--src/widgets/util/qsystemtrayicon.cpp4
-rw-r--r--src/widgets/util/qsystemtrayicon.h5
-rw-r--r--src/widgets/util/qsystemtrayicon_mac.mm4
-rw-r--r--src/widgets/util/qsystemtrayicon_p.h4
-rw-r--r--src/widgets/util/qsystemtrayicon_qpa.cpp4
-rw-r--r--src/widgets/util/qsystemtrayicon_win.cpp4
-rw-r--r--src/widgets/util/qsystemtrayicon_wince.cpp4
-rw-r--r--src/widgets/util/qsystemtrayicon_x11.cpp4
-rw-r--r--src/widgets/util/qundogroup.cpp4
-rw-r--r--src/widgets/util/qundogroup.h5
-rw-r--r--src/widgets/util/qundostack.cpp4
-rw-r--r--src/widgets/util/qundostack.h5
-rw-r--r--src/widgets/util/qundostack_p.h4
-rw-r--r--src/widgets/util/qundoview.cpp4
-rw-r--r--src/widgets/util/qundoview.h5
-rw-r--r--src/widgets/widgets/qabstractbutton.cpp8
-rw-r--r--src/widgets/widgets/qabstractbutton.h5
-rw-r--r--src/widgets/widgets/qabstractbutton_p.h4
-rw-r--r--src/widgets/widgets/qabstractscrollarea.cpp18
-rw-r--r--src/widgets/widgets/qabstractscrollarea.h5
-rw-r--r--src/widgets/widgets/qabstractscrollarea_p.h4
-rw-r--r--src/widgets/widgets/qabstractslider.cpp6
-rw-r--r--src/widgets/widgets/qabstractslider.h5
-rw-r--r--src/widgets/widgets/qabstractslider_p.h4
-rw-r--r--src/widgets/widgets/qabstractspinbox.cpp8
-rw-r--r--src/widgets/widgets/qabstractspinbox.h5
-rw-r--r--src/widgets/widgets/qabstractspinbox_p.h4
-rw-r--r--src/widgets/widgets/qbuttongroup.cpp4
-rw-r--r--src/widgets/widgets/qbuttongroup.h5
-rw-r--r--src/widgets/widgets/qcalendartextnavigator_p.h4
-rw-r--r--src/widgets/widgets/qcalendarwidget.cpp4
-rw-r--r--src/widgets/widgets/qcalendarwidget.h5
-rw-r--r--src/widgets/widgets/qcheckbox.cpp4
-rw-r--r--src/widgets/widgets/qcheckbox.h5
-rw-r--r--src/widgets/widgets/qcocoatoolbardelegate_mac.mm6
-rw-r--r--src/widgets/widgets/qcocoatoolbardelegate_mac_p.h4
-rw-r--r--src/widgets/widgets/qcombobox.cpp82
-rw-r--r--src/widgets/widgets/qcombobox.h5
-rw-r--r--src/widgets/widgets/qcombobox_p.h8
-rw-r--r--src/widgets/widgets/qcommandlinkbutton.cpp4
-rw-r--r--src/widgets/widgets/qcommandlinkbutton.h5
-rw-r--r--src/widgets/widgets/qdatetimeedit.cpp4
-rw-r--r--src/widgets/widgets/qdatetimeedit.h5
-rw-r--r--src/widgets/widgets/qdatetimeedit_p.h4
-rw-r--r--src/widgets/widgets/qdial.cpp4
-rw-r--r--src/widgets/widgets/qdial.h5
-rw-r--r--src/widgets/widgets/qdialogbuttonbox.cpp4
-rw-r--r--src/widgets/widgets/qdialogbuttonbox.h5
-rw-r--r--src/widgets/widgets/qdockarealayout.cpp4
-rw-r--r--src/widgets/widgets/qdockarealayout_p.h4
-rw-r--r--src/widgets/widgets/qdockwidget.cpp4
-rw-r--r--src/widgets/widgets/qdockwidget.h5
-rw-r--r--src/widgets/widgets/qdockwidget_p.h4
-rw-r--r--src/widgets/widgets/qeffects.cpp4
-rw-r--r--src/widgets/widgets/qeffects_p.h4
-rw-r--r--src/widgets/widgets/qfocusframe.cpp4
-rw-r--r--src/widgets/widgets/qfocusframe.h5
-rw-r--r--src/widgets/widgets/qfontcombobox.cpp4
-rw-r--r--src/widgets/widgets/qfontcombobox.h5
-rw-r--r--src/widgets/widgets/qframe.cpp4
-rw-r--r--src/widgets/widgets/qframe.h5
-rw-r--r--src/widgets/widgets/qframe_p.h4
-rw-r--r--src/widgets/widgets/qgroupbox.cpp6
-rw-r--r--src/widgets/widgets/qgroupbox.h5
-rw-r--r--src/widgets/widgets/qlabel.cpp6
-rw-r--r--src/widgets/widgets/qlabel.h5
-rw-r--r--src/widgets/widgets/qlabel_p.h4
-rw-r--r--src/widgets/widgets/qlcdnumber.cpp22
-rw-r--r--src/widgets/widgets/qlcdnumber.h11
-rw-r--r--src/widgets/widgets/qlineedit.cpp10
-rw-r--r--src/widgets/widgets/qlineedit.h5
-rw-r--r--src/widgets/widgets/qlineedit_p.cpp19
-rw-r--r--src/widgets/widgets/qlineedit_p.h6
-rw-r--r--src/widgets/widgets/qmaccocoaviewcontainer_mac.h5
-rw-r--r--src/widgets/widgets/qmaccocoaviewcontainer_mac.mm4
-rw-r--r--src/widgets/widgets/qmacnativewidget_mac.h5
-rw-r--r--src/widgets/widgets/qmacnativewidget_mac.mm4
-rw-r--r--src/widgets/widgets/qmainwindow.cpp4
-rw-r--r--src/widgets/widgets/qmainwindow.h5
-rw-r--r--src/widgets/widgets/qmainwindowlayout.cpp4
-rw-r--r--src/widgets/widgets/qmainwindowlayout_mac.mm16
-rw-r--r--src/widgets/widgets/qmainwindowlayout_p.h4
-rw-r--r--src/widgets/widgets/qmdiarea.cpp4
-rw-r--r--src/widgets/widgets/qmdiarea.h5
-rw-r--r--src/widgets/widgets/qmdiarea_p.h4
-rw-r--r--src/widgets/widgets/qmdisubwindow.cpp4
-rw-r--r--src/widgets/widgets/qmdisubwindow.h5
-rw-r--r--src/widgets/widgets/qmdisubwindow_p.h4
-rw-r--r--src/widgets/widgets/qmenu.cpp28
-rw-r--r--src/widgets/widgets/qmenu.h5
-rw-r--r--src/widgets/widgets/qmenu_p.h57
-rw-r--r--src/widgets/widgets/qmenu_wince.cpp4
-rw-r--r--src/widgets/widgets/qmenu_wince_resource_p.h4
-rw-r--r--src/widgets/widgets/qmenubar.cpp60
-rw-r--r--src/widgets/widgets/qmenubar.h15
-rw-r--r--src/widgets/widgets/qmenubar_p.h47
-rw-r--r--src/widgets/widgets/qplaintextedit.cpp4
-rw-r--r--src/widgets/widgets/qplaintextedit.h5
-rw-r--r--src/widgets/widgets/qplaintextedit_p.h4
-rw-r--r--src/widgets/widgets/qprogressbar.cpp6
-rw-r--r--src/widgets/widgets/qprogressbar.h5
-rw-r--r--src/widgets/widgets/qpushbutton.cpp6
-rw-r--r--src/widgets/widgets/qpushbutton.h5
-rw-r--r--src/widgets/widgets/qpushbutton_p.h4
-rw-r--r--src/widgets/widgets/qradiobutton.cpp4
-rw-r--r--src/widgets/widgets/qradiobutton.h5
-rw-r--r--src/widgets/widgets/qrubberband.cpp4
-rw-r--r--src/widgets/widgets/qrubberband.h5
-rw-r--r--src/widgets/widgets/qscrollarea.cpp4
-rw-r--r--src/widgets/widgets/qscrollarea.h5
-rw-r--r--src/widgets/widgets/qscrollarea_p.h4
-rw-r--r--src/widgets/widgets/qscrollbar.cpp4
-rw-r--r--src/widgets/widgets/qscrollbar.h5
-rw-r--r--src/widgets/widgets/qsizegrip.cpp54
-rw-r--r--src/widgets/widgets/qsizegrip.h8
-rw-r--r--src/widgets/widgets/qslider.cpp4
-rw-r--r--src/widgets/widgets/qslider.h5
-rw-r--r--src/widgets/widgets/qspinbox.cpp8
-rw-r--r--src/widgets/widgets/qspinbox.h5
-rw-r--r--src/widgets/widgets/qsplashscreen.cpp4
-rw-r--r--src/widgets/widgets/qsplashscreen.h5
-rw-r--r--src/widgets/widgets/qsplitter.cpp4
-rw-r--r--src/widgets/widgets/qsplitter.h5
-rw-r--r--src/widgets/widgets/qsplitter_p.h4
-rw-r--r--src/widgets/widgets/qstackedwidget.cpp4
-rw-r--r--src/widgets/widgets/qstackedwidget.h5
-rw-r--r--src/widgets/widgets/qstatusbar.cpp4
-rw-r--r--src/widgets/widgets/qstatusbar.h5
-rw-r--r--src/widgets/widgets/qtabbar.cpp47
-rw-r--r--src/widgets/widgets/qtabbar.h5
-rw-r--r--src/widgets/widgets/qtabbar_p.h4
-rw-r--r--src/widgets/widgets/qtabwidget.cpp4
-rw-r--r--src/widgets/widgets/qtabwidget.h5
-rw-r--r--src/widgets/widgets/qtextbrowser.cpp4
-rw-r--r--src/widgets/widgets/qtextbrowser.h5
-rw-r--r--src/widgets/widgets/qtextedit.cpp4
-rw-r--r--src/widgets/widgets/qtextedit.h5
-rw-r--r--src/widgets/widgets/qtextedit_p.h4
-rw-r--r--src/widgets/widgets/qtoolbar.cpp4
-rw-r--r--src/widgets/widgets/qtoolbar.h5
-rw-r--r--src/widgets/widgets/qtoolbar_p.h4
-rw-r--r--src/widgets/widgets/qtoolbararealayout.cpp4
-rw-r--r--src/widgets/widgets/qtoolbararealayout_p.h4
-rw-r--r--src/widgets/widgets/qtoolbarextension.cpp4
-rw-r--r--src/widgets/widgets/qtoolbarextension_p.h4
-rw-r--r--src/widgets/widgets/qtoolbarlayout.cpp4
-rw-r--r--src/widgets/widgets/qtoolbarlayout_p.h4
-rw-r--r--src/widgets/widgets/qtoolbarseparator.cpp4
-rw-r--r--src/widgets/widgets/qtoolbarseparator_p.h4
-rw-r--r--src/widgets/widgets/qtoolbox.cpp4
-rw-r--r--src/widgets/widgets/qtoolbox.h5
-rw-r--r--src/widgets/widgets/qtoolbutton.cpp4
-rw-r--r--src/widgets/widgets/qtoolbutton.h5
-rw-r--r--src/widgets/widgets/qwidgetanimator.cpp4
-rw-r--r--src/widgets/widgets/qwidgetanimator_p.h4
-rw-r--r--src/widgets/widgets/qwidgetlinecontrol.cpp10
-rw-r--r--src/widgets/widgets/qwidgetlinecontrol_p.h11
-rw-r--r--src/widgets/widgets/qwidgetresizehandler.cpp7
-rw-r--r--src/widgets/widgets/qwidgetresizehandler_p.h4
-rw-r--r--src/widgets/widgets/qwidgettextcontrol.cpp12
-rw-r--r--src/widgets/widgets/qwidgettextcontrol_p.h5
-rw-r--r--src/widgets/widgets/qwidgettextcontrol_p_p.h4
-rw-r--r--src/widgets/widgets/qworkspace.cpp4
-rw-r--r--src/widgets/widgets/qworkspace.h5
528 files changed, 1919 insertions, 26776 deletions
diff --git a/src/widgets/accessible/qaccessiblewidget.cpp b/src/widgets/accessible/qaccessiblewidget.cpp
index ae09b011dd..a4a86e5d31 100644
--- a/src/widgets/accessible/qaccessiblewidget.cpp
+++ b/src/widgets/accessible/qaccessiblewidget.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -361,35 +361,6 @@ QAccessible::Relation QAccessibleWidget::relationTo(const QAccessibleInterface *
if (inverse & QAccessible::Label)
relation |= QAccessible::Labelled;
- if(o == object()) {
- return relation | QAccessible::Self;
- }
-
- QObject *parent = object()->parent();
- if (o->parent() == parent) {
- QAccessibleInterface *sibIface = QAccessible::queryAccessibleInterface(o);
- Q_ASSERT(sibIface);
- QRect wg = rect();
- QRect sg = sibIface->rect();
- if (wg.intersects(sg)) {
- QAccessibleInterface *pIface = 0;
- pIface = sibIface->parent();
- if (pIface && !(sibIface->state().invisible | state().invisible)) {
- int wi = pIface->indexOfChild(this);
- int si = pIface->indexOfChild(sibIface);
-
- if (wi > si)
- relation |= QAccessible::Covers;
- else
- relation |= QAccessible::Covered;
- }
- delete pIface;
- }
- delete sibIface;
-
- return relation;
- }
-
return relation;
}
@@ -422,69 +393,6 @@ int QAccessibleWidget::navigate(QAccessible::RelationFlag relation, int entry,
QObject *targetObject = 0;
switch (relation) {
- case QAccessible::Covers:
- if (entry > 0) {
- QAccessibleInterface *pIface = parent();
- if (!pIface)
- return -1;
-
- QRect r = rect();
- int sibCount = pIface->childCount();
- QAccessibleInterface *sibling = 0;
- // FIXME: this code looks very suspicious
- // why start at this index?
- for (int i = pIface->indexOfChild(this) + 2; i <= sibCount && entry; ++i) {
- sibling = pIface->child(i - 1);
- if (!sibling || (sibling->state().invisible)) {
- delete sibling;
- sibling = 0;
- continue;
- }
- if (sibling->rect().intersects(r))
- --entry;
- if (!entry)
- break;
- delete sibling;
- sibling = 0;
- }
- delete pIface;
- *target = sibling;
- if (*target)
- return 0;
- }
- break;
- case QAccessible::Covered:
- if (entry > 0) {
- QAccessibleInterface *pIface = QAccessible::queryAccessibleInterface(parentObject());
- if (!pIface)
- return -1;
-
- QRect r = rect();
- int index = pIface->indexOfChild(this);
- QAccessibleInterface *sibling = 0;
- // FIXME: why end at index?
- for (int i = 0; i < index && entry; ++i) {
- sibling = pIface->child(i);
- Q_ASSERT(sibling);
- if (!sibling || (sibling->state().invisible)) {
- delete sibling;
- sibling = 0;
- continue;
- }
- if (sibling->rect().intersects(r))
- --entry;
- if (!entry)
- break;
- delete sibling;
- sibling = 0;
- }
- delete pIface;
- *target = sibling;
- if (*target)
- return 0;
- }
- break;
-
// Logical
case QAccessible::FocusChild:
{
diff --git a/src/widgets/accessible/qaccessiblewidget.h b/src/widgets/accessible/qaccessiblewidget.h
index da217b94ca..f96d298f90 100644
--- a/src/widgets/accessible/qaccessiblewidget.h
+++ b/src/widgets/accessible/qaccessiblewidget.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -48,7 +48,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
#ifndef QT_NO_ACCESSIBILITY
diff --git a/src/widgets/animation/qguivariantanimation.cpp b/src/widgets/animation/qguivariantanimation.cpp
index 2167e4a173..c344a18b8a 100644
--- a/src/widgets/animation/qguivariantanimation.cpp
+++ b/src/widgets/animation/qguivariantanimation.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/dialogs/qcolordialog.cpp b/src/widgets/dialogs/qcolordialog.cpp
index 777e4cc4ba..e592f14704 100644
--- a/src/widgets/dialogs/qcolordialog.cpp
+++ b/src/widgets/dialogs/qcolordialog.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -64,10 +64,6 @@
#include "qspinbox.h"
#include "qdialogbuttonbox.h"
-#ifdef MAEMO_UI
-# define QT_SMALL_COLORDIALOG
-#endif
-
QT_BEGIN_NAMESPACE
//////////// QWellArray BEGIN
@@ -1064,14 +1060,6 @@ QColorShower::QColorShower(QColorDialog *parent)
gl->setMargin(gl->spacing());
lab = new QColorShowLabel(this);
-#ifdef QT_SMALL_COLORDIALOG
-# ifdef Q_WS_S60
- const bool nonTouchUI = !S60->hasTouchscreen;
-# elif defined Q_WS_MAEMO_5
- const bool nonTouchUI = false;
-# endif
-#endif
-
#ifndef Q_WS_WINCE
#ifdef QT_SMALL_COLORDIALOG
lab->setMinimumHeight(60);
@@ -1081,7 +1069,6 @@ QColorShower::QColorShower(QColorDialog *parent)
lab->setMinimumWidth(20);
#endif
-// In S60, due to small screen and different screen layouts need to re-arrange the widgets.
// For QVGA screens only the comboboxes and color label are visible.
// For nHD screens only color and luminence pickers and color label are visible.
#if !defined(QT_SMALL_COLORDIALOG)
@@ -1480,14 +1467,6 @@ void QColorDialogPrivate::init(const QColor &initial)
topLay->addLayout(leftLay);
}
-#if defined(QT_SMALL_COLORDIALOG)
-# if defined(Q_WS_S60)
- const bool nonTouchUI = !S60->hasTouchscreen;
-# elif defined(Q_WS_MAEMO_5)
- const bool nonTouchUI = false;
-# endif
-#endif
-
if (!smallDisplay) {
standard = new QColorWell(q, 6, 8, QColorDialogOptions::standardColors());
lblBasicColors = new QLabel(q);
diff --git a/src/widgets/dialogs/qcolordialog.h b/src/widgets/dialogs/qcolordialog.h
index 1bdb0b41a2..cfb54a7eb9 100644
--- a/src/widgets/dialogs/qcolordialog.h
+++ b/src/widgets/dialogs/qcolordialog.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -48,7 +48,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
#ifndef QT_NO_COLORDIALOG
diff --git a/src/widgets/dialogs/qcolordialog_mac.mm b/src/widgets/dialogs/qcolordialog_mac.mm
index bdf5e1cccd..1496ba8300 100644
--- a/src/widgets/dialogs/qcolordialog_mac.mm
+++ b/src/widgets/dialogs/qcolordialog_mac.mm
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/dialogs/qcolordialog_p.h b/src/widgets/dialogs/qcolordialog_p.h
index a6149017d7..12634e4532 100644
--- a/src/widgets/dialogs/qcolordialog_p.h
+++ b/src/widgets/dialogs/qcolordialog_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/dialogs/qdialog.cpp b/src/widgets/dialogs/qdialog.cpp
index af11fc971d..f462a362ca 100644
--- a/src/widgets/dialogs/qdialog.cpp
+++ b/src/widgets/dialogs/qdialog.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,12 +34,14 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
-#include "qdialog.h"
-
+#include "qcolordialog.h"
+#include "qfontdialog.h"
+#include "qfiledialog.h"
#include "qevent.h"
#include "qdesktopwidget.h"
@@ -59,22 +60,36 @@
QT_BEGIN_NAMESPACE
+static inline int themeDialogType(const QDialog *dialog)
+{
+ if (qobject_cast<const QFileDialog *>(dialog))
+ return QPlatformTheme::FileDialog;
+ if (qobject_cast<const QColorDialog *>(dialog))
+ return QPlatformTheme::ColorDialog;
+ if (qobject_cast<const QFontDialog *>(dialog))
+ return QPlatformTheme::FontDialog;
+ return -1;
+}
+
QPlatformDialogHelper *QDialogPrivate::platformHelper() const
{
// Delayed creation of the platform, ensuring that
// that qobject_cast<> on the dialog works in the plugin.
if (!m_platformHelperCreated) {
- QDialogPrivate *ncThis = const_cast<QDialogPrivate *>(this);
m_platformHelperCreated = true;
+ QDialogPrivate *ncThis = const_cast<QDialogPrivate *>(this);
QDialog *dialog = ncThis->q_func();
- m_platformHelper = QGuiApplicationPrivate::platformTheme()
- ->createPlatformDialogHelper(dialog);
- if (m_platformHelper) {
- QObject::connect(m_platformHelper, SIGNAL(accept()), dialog, SLOT(accept()));
- QObject::connect(m_platformHelper, SIGNAL(reject()), dialog, SLOT(reject()));
- QObject::connect(m_platformHelper, SIGNAL(launchNativeAppModalPanel()),
- dialog, SLOT(_q_platformRunNativeAppModalPanel()));
- ncThis->initHelper(m_platformHelper);
+ const int type = themeDialogType(dialog);
+ if (type >= 0) {
+ m_platformHelper = QGuiApplicationPrivate::platformTheme()
+ ->createPlatformDialogHelper(static_cast<QPlatformTheme::DialogType>(type));
+ if (m_platformHelper) {
+ QObject::connect(m_platformHelper, SIGNAL(accept()), dialog, SLOT(accept()));
+ QObject::connect(m_platformHelper, SIGNAL(reject()), dialog, SLOT(reject()));
+ QObject::connect(m_platformHelper, SIGNAL(launchNativeAppModalPanel()),
+ dialog, SLOT(_q_platformRunNativeAppModalPanel()));
+ ncThis->initHelper(m_platformHelper);
+ }
}
}
return m_platformHelper;
@@ -733,7 +748,7 @@ void QDialog::setVisible(bool visible)
}
#ifndef QT_NO_ACCESSIBILITY
- QAccessible::updateAccessibility(this, 0, QAccessible::DialogStart);
+ QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::DialogStart, this, 0));
#endif
} else {
@@ -742,7 +757,7 @@ void QDialog::setVisible(bool visible)
#ifndef QT_NO_ACCESSIBILITY
if (isVisible())
- QAccessible::updateAccessibility(this, 0, QAccessible::DialogEnd);
+ QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::DialogEnd, this, 0));
#endif
// Reimplemented to exit a modal event loop when the dialog is hidden.
diff --git a/src/widgets/dialogs/qdialog.h b/src/widgets/dialogs/qdialog.h
index 8329e6460a..40bfbb63ee 100644
--- a/src/widgets/dialogs/qdialog.h
+++ b/src/widgets/dialogs/qdialog.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -48,7 +48,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
class QPushButton;
class QDialogPrivate;
diff --git a/src/widgets/dialogs/qdialog_p.h b/src/widgets/dialogs/qdialog_p.h
index ecdfff03fd..ca99600489 100644
--- a/src/widgets/dialogs/qdialog_p.h
+++ b/src/widgets/dialogs/qdialog_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -58,7 +58,7 @@
#include "QtCore/qpointer.h"
#include "QtWidgets/qdialog.h"
#include "QtWidgets/qpushbutton.h"
-#include "QtWidgets/qplatformdialoghelper_qpa.h"
+#include <QtGui/QPlatformDialogHelper>
QT_BEGIN_NAMESPACE
diff --git a/src/widgets/dialogs/qerrormessage.cpp b/src/widgets/dialogs/qerrormessage.cpp
index 1c950a7158..4993a6d80f 100644
--- a/src/widgets/dialogs/qerrormessage.cpp
+++ b/src/widgets/dialogs/qerrormessage.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -71,9 +71,6 @@ extern bool qt_wince_is_high_dpi(); //defined in qguifunctions_wince.cpp
#if defined(QT_SOFTKEYS_ENABLED)
#include <qaction.h>
#endif
-#ifdef Q_WS_S60
-#include "private/qt_s60_p.h"
-#endif
QT_BEGIN_NAMESPACE
@@ -134,14 +131,7 @@ QSize QErrorMessageTextView::sizeHint() const
else
return QSize(300, 100);
#else
-
-#ifdef Q_WS_S60
- const int smallerDimension = qMin(S60->screenHeightInPixels, S60->screenWidthInPixels);
- // In S60 layout data, error messages seem to be one third of the screen height (in portrait) minus two.
- return QSize(smallerDimension, smallerDimension/3-2);
-#else
return QSize(250, 75);
-#endif //Q_WS_S60
#endif //Q_WS_WINCE
}
@@ -265,7 +255,7 @@ QErrorMessage::QErrorMessage(QWidget * parent)
#endif
-#if defined(Q_WS_WINCE) || defined(Q_WS_S60)
+#if defined(Q_WS_WINCE)
d->ok->setFixedSize(0,0);
#endif
connect(d->ok, SIGNAL(clicked()), this, SLOT(accept()));
diff --git a/src/widgets/dialogs/qerrormessage.h b/src/widgets/dialogs/qerrormessage.h
index c43df749f7..085fa8eb6b 100644
--- a/src/widgets/dialogs/qerrormessage.h
+++ b/src/widgets/dialogs/qerrormessage.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -48,7 +48,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
#ifndef QT_NO_ERRORMESSAGE
diff --git a/src/widgets/dialogs/qfiledialog.cpp b/src/widgets/dialogs/qfiledialog.cpp
index 2f49a226e9..db13cfea0f 100644
--- a/src/widgets/dialogs/qfiledialog.cpp
+++ b/src/widgets/dialogs/qfiledialog.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -67,11 +67,12 @@
#if defined(Q_OS_WINCE)
extern bool qt_priv_ptr_valid;
#endif
+#endif
#if defined(Q_OS_UNIX)
#include <pwd.h>
+#elif defined(Q_OS_WIN)
+# include <QtCore/qt_windows.h>
#endif
-#endif
-#include "qplatformdialoghelper_qpa.h"
QT_BEGIN_NAMESPACE
@@ -1097,15 +1098,6 @@ void QFileDialog::setNameFilter(const QString &filter)
setNameFilters(qt_make_filter_list(filter));
}
-/*!
- \obsolete
-
- Use setNameFilter() instead.
-*/
-void QFileDialog::setFilter(const QString &filter)
-{
- setNameFilter(filter);
-}
/*!
\property QFileDialog::nameFilterDetailsVisible
@@ -1178,16 +1170,6 @@ void QFileDialog::setNameFilters(const QStringList &filters)
}
/*!
- \obsolete
-
- Use setNameFilters() instead.
-*/
-void QFileDialog::setFilters(const QStringList &filters)
-{
- setNameFilters(filters);
-}
-
-/*!
\since 4.4
Returns the file type filters that are in operation on this file
@@ -1199,17 +1181,6 @@ QStringList QFileDialog::nameFilters() const
}
/*!
- \obsolete
-
- Use nameFilters() instead.
-*/
-
-QStringList QFileDialog::filters() const
-{
- return nameFilters();
-}
-
-/*!
\since 4.4
Sets the current file type \a filter. Multiple filters can be
@@ -1237,17 +1208,6 @@ void QFileDialog::selectNameFilter(const QString &filter)
}
/*!
- \obsolete
-
- Use selectNameFilter() instead.
-*/
-
-void QFileDialog::selectFilter(const QString &filter)
-{
- selectNameFilter(filter);
-}
-
-/*!
\since 4.4
Returns the filter that the user selected in the file dialog.
@@ -1264,16 +1224,6 @@ QString QFileDialog::selectedNameFilter() const
}
/*!
- \obsolete
-
- Use selectedNameFilter() instead.
-*/
-QString QFileDialog::selectedFilter() const
-{
- return selectedNameFilter();
-}
-
-/*!
\since 4.4
Returns the filter that is used when displaying files.
@@ -1437,6 +1387,25 @@ QLineEdit *QFileDialogPrivate::lineEdit() const {
return (QLineEdit*)qFileDialogUi->fileNameEdit;
}
+int QFileDialogPrivate::maxNameLength(const QString &path)
+{
+#if defined(Q_OS_UNIX)
+ return ::pathconf(QFile::encodeName(path).data(), _PC_NAME_MAX);
+#elif defined(Q_OS_WINCE)
+ Q_UNUSED(path);
+ return MAX_PATH;
+#elif defined(Q_OS_WIN)
+ DWORD maxLength;
+ const QString drive = path.left(3);
+ if (::GetVolumeInformation(reinterpret_cast<const wchar_t *>(drive.utf16()), NULL, 0, NULL, &maxLength, NULL, NULL, 0) == FALSE)
+ return -1;
+ return maxLength;
+#else
+ Q_UNUSED(path);
+#endif
+ return -1;
+}
+
/*
Sets the view root index to be the file system model index
*/
@@ -1723,25 +1692,6 @@ extern QStringList qt_win_get_open_file_names(const QFileDialogArgs &args,
extern QString qt_win_get_existing_directory(const QFileDialogArgs &args);
#endif
-/*
- For Symbian file dialogs
-*/
-#if defined(Q_WS_S60)
-extern QString qtSymbianGetOpenFileName(const QString &caption,
- const QString &dir,
- const QString &filter);
-
-extern QStringList qtSymbianGetOpenFileNames(const QString &caption,
- const QString &dir,
- const QString &filter);
-
-extern QString qtSymbianGetSaveFileName(const QString &caption,
- const QString &dir);
-
-extern QString qtSymbianGetExistingDirectory(const QString &caption,
- const QString &dir);
-#endif
-
/*!
This is a convenience static function that returns an existing file
selected by the user. If the user presses Cancel, it returns a null string.
@@ -1770,7 +1720,7 @@ extern QString qtSymbianGetExistingDirectory(const QString &caption,
The dialog's caption is set to \a caption. If \a caption is not specified
then a default caption will be used.
- On Windows, Mac OS X and Symbian^3, this static function will use the
+ On Windows, and Mac OS X, this static function will use the
native file dialog and not a QFileDialog.
On Windows the dialog will spin a blocking modal event loop that will not
@@ -1783,10 +1733,6 @@ extern QString qtSymbianGetExistingDirectory(const QString &caption,
\a options includes DontResolveSymlinks, the file dialog will treat
symlinks as regular directories.
- On Symbian^3 the parameter \a selectedFilter has no meaning and the
- \a options parameter is only used to define if the native file dialog is
- used.
-
\warning Do not delete \a parent during the execution of the dialog. If you
want to do this, you should create the dialog yourself using one of the
QFileDialog constructors.
@@ -1802,10 +1748,6 @@ QString QFileDialog::getOpenFileName(QWidget *parent,
{
if (qt_filedialog_open_filename_hook && !(options & DontUseNativeDialog))
return qt_filedialog_open_filename_hook(parent, caption, dir, filter, selectedFilter, options);
-#if defined(Q_WS_S60)
- if (QSysInfo::s60Version() > QSysInfo::SV_S60_5_0 && !(options & DontUseNativeDialog))
- return qtSymbianGetOpenFileName(caption, dir, filter);
-#endif
QFileDialogArgs args;
args.parent = parent;
args.caption = caption;
@@ -1826,7 +1768,7 @@ QString QFileDialog::getOpenFileName(QWidget *parent,
dialog.selectNameFilter(*selectedFilter);
if (dialog.exec() == QDialog::Accepted) {
if (selectedFilter)
- *selectedFilter = dialog.selectedFilter();
+ *selectedFilter = dialog.selectedNameFilter();
return dialog.selectedFiles().value(0);
}
return QString();
@@ -1856,7 +1798,7 @@ QString QFileDialog::getOpenFileName(QWidget *parent,
The dialog's caption is set to \a caption. If \a caption is not specified
then a default caption will be used.
- On Windows, Mac OS X and Symbian^3, this static function will use the
+ On Windows, and Mac OS X, this static function will use the
native file dialog and not a QFileDialog.
On Windows the dialog will spin a blocking modal event loop that will not
@@ -1875,10 +1817,6 @@ QString QFileDialog::getOpenFileName(QWidget *parent,
\snippet doc/src/snippets/code/src_gui_dialogs_qfiledialog.cpp 10
- On Symbian^3 the parameter \a selectedFilter has no meaning and the
- \a options parameter is only used to define if the native file dialog is
- used. On Symbian^3, this function can only return a single filename.
-
\warning Do not delete \a parent during the execution of the dialog. If you
want to do this, you should create the dialog yourself using one of the
QFileDialog constructors.
@@ -1894,10 +1832,6 @@ QStringList QFileDialog::getOpenFileNames(QWidget *parent,
{
if (qt_filedialog_open_filenames_hook && !(options & DontUseNativeDialog))
return qt_filedialog_open_filenames_hook(parent, caption, dir, filter, selectedFilter, options);
-#if defined(Q_WS_S60)
- if (QSysInfo::s60Version() > QSysInfo::SV_S60_5_0 && !(options & DontUseNativeDialog))
- return qtSymbianGetOpenFileNames(caption, dir, filter);
-#endif
QFileDialogArgs args;
args.parent = parent;
args.caption = caption;
@@ -1919,7 +1853,7 @@ QStringList QFileDialog::getOpenFileNames(QWidget *parent,
dialog.selectNameFilter(*selectedFilter);
if (dialog.exec() == QDialog::Accepted) {
if (selectedFilter)
- *selectedFilter = dialog.selectedFilter();
+ *selectedFilter = dialog.selectedNameFilter();
return dialog.selectedFiles();
}
return QStringList();
@@ -1955,7 +1889,7 @@ QStringList QFileDialog::getOpenFileNames(QWidget *parent,
The dialog's caption is set to \a caption. If \a caption is not specified,
a default caption will be used.
- On Windows, Mac OS X and Symbian^3, this static function will use the
+ On Windows, and Mac OS X, this static function will use the
native file dialog and not a QFileDialog.
On Windows the dialog will spin a blocking modal event loop that will not
@@ -1969,10 +1903,6 @@ QStringList QFileDialog::getOpenFileNames(QWidget *parent,
\a options includes DontResolveSymlinks the file dialog will treat symlinks
as regular directories.
- On Symbian^3 the parameters \a filter and \a selectedFilter have no
- meaning. The \a options parameter is only used to define if the native file
- dialog is used.
-
\warning Do not delete \a parent during the execution of the dialog. If you
want to do this, you should create the dialog yourself using one of the
QFileDialog constructors.
@@ -1988,10 +1918,6 @@ QString QFileDialog::getSaveFileName(QWidget *parent,
{
if (qt_filedialog_save_filename_hook && !(options & DontUseNativeDialog))
return qt_filedialog_save_filename_hook(parent, caption, dir, filter, selectedFilter, options);
-#if defined(Q_WS_S60)
- if (QSysInfo::s60Version() > QSysInfo::SV_S60_5_0 && !(options & DontUseNativeDialog))
- return qtSymbianGetSaveFileName(caption, dir);
-#endif
QFileDialogArgs args;
args.parent = parent;
args.caption = caption;
@@ -2014,7 +1940,7 @@ QString QFileDialog::getSaveFileName(QWidget *parent,
dialog.selectNameFilter(*selectedFilter);
if (dialog.exec() == QDialog::Accepted) {
if (selectedFilter)
- *selectedFilter = dialog.selectedFilter();
+ *selectedFilter = dialog.selectedNameFilter();
return dialog.selectedFiles().value(0);
}
@@ -2040,7 +1966,7 @@ QString QFileDialog::getSaveFileName(QWidget *parent,
pass. To ensure a native file dialog, \l{QFileDialog::}{ShowDirsOnly} must
be set.
- On Windows, Mac OS X and Symbian^3, this static function will use the
+ On Windows, and Mac OS X, this static function will use the
native file dialog and not a QFileDialog. On Windows CE, if the device has
no native file dialog, a QFileDialog will be used.
@@ -2054,9 +1980,6 @@ QString QFileDialog::getSaveFileName(QWidget *parent,
dispatch any QTimers, and if \a parent is not 0 then it will position the
dialog just below the parent's title bar.
- On Symbian^3 the \a options parameter is only used to define if the native
- file dialog is used.
-
\warning Do not delete \a parent during the execution of the dialog. If you
want to do this, you should create the dialog yourself using one of the
QFileDialog constructors.
@@ -2070,10 +1993,6 @@ QString QFileDialog::getExistingDirectory(QWidget *parent,
{
if (qt_filedialog_existing_directory_hook && !(options & DontUseNativeDialog))
return qt_filedialog_existing_directory_hook(parent, caption, dir, options);
-#if defined(Q_WS_S60)
- if (QSysInfo::s60Version() > QSysInfo::SV_S60_5_0 && !(options & DontUseNativeDialog))
- return qtSymbianGetExistingDirectory(caption, dir);
-#endif
QFileDialogArgs args;
args.parent = parent;
args.caption = caption;
@@ -3437,10 +3356,7 @@ QStringList QFSCompleter::splitPath(const QString &path) const
QString pathCopy = QDir::toNativeSeparators(path);
QString sep = QDir::separator();
-#if defined(Q_OS_SYMBIAN)
- if (pathCopy == QLatin1String("\\"))
- return QStringList(pathCopy);
-#elif defined(Q_OS_WIN)
+#if defined(Q_OS_WIN)
if (pathCopy == QLatin1String("\\") || pathCopy == QLatin1String("\\\\"))
return QStringList(pathCopy);
QString doubleSlash(QLatin1String("\\\\"));
@@ -3463,11 +3379,7 @@ QStringList QFSCompleter::splitPath(const QString &path) const
QRegExp re(QLatin1Char('[') + QRegExp::escape(sep) + QLatin1Char(']'));
-#if defined(Q_OS_SYMBIAN)
- QStringList parts = pathCopy.split(re, QString::SkipEmptyParts);
- if (pathCopy.endsWith(sep))
- parts.append(QString());
-#elif defined(Q_OS_WIN)
+#if defined(Q_OS_WIN)
QStringList parts = pathCopy.split(re, QString::SkipEmptyParts);
if (!doubleSlash.isEmpty() && !parts.isEmpty())
parts[0].prepend(doubleSlash);
diff --git a/src/widgets/dialogs/qfiledialog.h b/src/widgets/dialogs/qfiledialog.h
index ac011e634a..c5298b1227 100644
--- a/src/widgets/dialogs/qfiledialog.h
+++ b/src/widgets/dialogs/qfiledialog.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -50,7 +50,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
#ifndef QT_NO_FILEDIALOG
@@ -85,7 +84,6 @@ public:
enum AcceptMode { AcceptOpen, AcceptSave };
enum DialogLabel { LookIn, FileName, FileType, Accept, Reject };
- // ### Rename to FileDialogOption and FileDialogOptions for Qt 5.0
enum Option
{
ShowDirsOnly = 0x00000001,
@@ -112,13 +110,6 @@ public:
void selectFile(const QString &filename);
QStringList selectedFiles() const;
-#ifdef QT_DEPRECATED
- QT_DEPRECATED void setFilter(const QString &filter);
- QT_DEPRECATED void setFilters(const QStringList &filters);
- QT_DEPRECATED QStringList filters() const;
- QT_DEPRECATED void selectFilter(const QString &filter);
- QT_DEPRECATED QString selectedFilter() const;
-#endif
void setNameFilterDetailsVisible(bool enabled);
bool isNameFilterDetailsVisible() const;
diff --git a/src/widgets/dialogs/qfiledialog.ui b/src/widgets/dialogs/qfiledialog.ui
index ff86e9cc13..76dac823ee 100644
--- a/src/widgets/dialogs/qfiledialog.ui
+++ b/src/widgets/dialogs/qfiledialog.ui
@@ -2,8 +2,7 @@
<comment>*********************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -36,6 +35,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
*********************************************************************</comment>
diff --git a/src/widgets/dialogs/qfiledialog_embedded.ui b/src/widgets/dialogs/qfiledialog_embedded.ui
index 5eb9f52a12..deb19c1999 100644
--- a/src/widgets/dialogs/qfiledialog_embedded.ui
+++ b/src/widgets/dialogs/qfiledialog_embedded.ui
@@ -2,8 +2,7 @@
<comment>*********************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -36,6 +35,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
*********************************************************************</comment>
diff --git a/src/widgets/dialogs/qfiledialog_mac.mm b/src/widgets/dialogs/qfiledialog_mac.mm
index fe3c41a4b7..01ec736550 100644
--- a/src/widgets/dialogs/qfiledialog_mac.mm
+++ b/src/widgets/dialogs/qfiledialog_mac.mm
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/dialogs/qfiledialog_p.h b/src/widgets/dialogs/qfiledialog_p.h
index 30c73ade7b..a66ee757f6 100644
--- a/src/widgets/dialogs/qfiledialog_p.h
+++ b/src/widgets/dialogs/qfiledialog_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -143,25 +143,7 @@ public:
QLineEdit *lineEdit() const;
- int maxNameLength(const QString &path) {
-#if defined(Q_OS_UNIX)
- return ::pathconf(QFile::encodeName(path).data(), _PC_NAME_MAX);
-#elif defined(Q_OS_WIN)
-#ifndef Q_OS_WINCE
- DWORD maxLength;
- QString drive = path.left(3);
- if (::GetVolumeInformation(reinterpret_cast<const wchar_t *>(drive.utf16()), NULL, 0, NULL, &maxLength, NULL, NULL, 0) == FALSE)
- return -1;
- return maxLength;
-#else
- Q_UNUSED(path);
- return MAX_PATH;
-#endif //Q_OS_WINCE
-#else
- Q_UNUSED(path);
-#endif
- return -1;
- }
+ static int maxNameLength(const QString &path);
QString basename(const QString &path) const
{
@@ -187,7 +169,7 @@ public:
static inline QString toInternal(const QString &path)
{
-#if defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN)
+#if defined(Q_OS_WIN)
QString n(path);
n.replace(QLatin1Char('\\'), QLatin1Char('/'));
#if defined(Q_OS_WINCE)
diff --git a/src/widgets/dialogs/qfileinfogatherer.cpp b/src/widgets/dialogs/qfileinfogatherer.cpp
index bce8b3ecc1..451376b3c7 100644
--- a/src/widgets/dialogs/qfileinfogatherer.cpp
+++ b/src/widgets/dialogs/qfileinfogatherer.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -264,8 +264,6 @@ QString QFileInfoGatherer::translateDriveName(const QFileInfo &drive) const
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
if (driveName.startsWith(QLatin1Char('/'))) // UNC host
return drive.fileName();
-#endif
-#if (defined(Q_OS_WIN) && !defined(Q_OS_WINCE)) || defined(Q_OS_SYMBIAN)
if (driveName.endsWith(QLatin1Char('/')))
driveName.chop(1);
#endif
diff --git a/src/widgets/dialogs/qfileinfogatherer_p.h b/src/widgets/dialogs/qfileinfogatherer_p.h
index 3621c6b6ad..3e5d1be384 100644
--- a/src/widgets/dialogs/qfileinfogatherer_p.h
+++ b/src/widgets/dialogs/qfileinfogatherer_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/dialogs/qfilesystemmodel.cpp b/src/widgets/dialogs/qfilesystemmodel.cpp
index e44a9ea882..7ea4302a56 100644
--- a/src/widgets/dialogs/qfilesystemmodel.cpp
+++ b/src/widgets/dialogs/qfilesystemmodel.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -49,10 +49,8 @@
#include <qapplication.h>
#ifdef Q_OS_WIN
-#include <qt_windows.h>
-#endif
-#ifdef Q_OS_WIN32
-#include <QtCore/QVarLengthArray>
+# include <QtCore/QVarLengthArray>
+# include <qt_windows.h>
#endif
QT_BEGIN_NAMESPACE
@@ -367,7 +365,7 @@ QFileSystemModelPrivate::QFileSystemNode *QFileSystemModelPrivate::node(const QS
// ### TODO can we use bool QAbstractFileEngine::caseSensitive() const?
QStringList pathElements = absolutePath.split(QLatin1Char('/'), QString::SkipEmptyParts);
if ((pathElements.isEmpty())
-#if (!defined(Q_OS_WIN) || defined(Q_OS_WINCE)) && !defined(Q_OS_SYMBIAN)
+#if !defined(Q_OS_WIN) || defined(Q_OS_WINCE)
&& QDir::fromNativeSeparators(longPath) != QLatin1String("/")
#endif
)
@@ -399,11 +397,9 @@ QFileSystemModelPrivate::QFileSystemNode *QFileSystemModelPrivate::node(const QS
} else
#endif
-#if (defined(Q_OS_WIN) && !defined(Q_OS_WINCE)) || defined(Q_OS_SYMBIAN)
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
{
if (!pathElements.at(0).contains(QLatin1String(":"))) {
- // The reason we express it like this instead of with anonymous, temporary
- // variables, is to workaround a compiler crash with Q_CC_NOKIAX86.
QString rootPath = QDir(longPath).rootPath();
pathElements.prepend(rootPath);
}
@@ -1314,7 +1310,7 @@ QString QFileSystemModelPrivate::filePath(const QModelIndex &index) const
if ((fullPath.length() > 2) && fullPath[0] == QLatin1Char('/') && fullPath[1] == QLatin1Char('/'))
fullPath = fullPath.mid(1);
#endif
-#if defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN)
+#if defined(Q_OS_WIN)
if (fullPath.length() == 2 && fullPath.endsWith(QLatin1Char(':')))
fullPath.append(QLatin1Char('/'));
#endif
@@ -1655,25 +1651,13 @@ void QFileSystemModelPrivate::_q_directoryChanged(const QString &directory, cons
if (parentNode->children.count() == 0)
return;
QStringList toRemove;
-#if defined(Q_OS_SYMBIAN)
- // Filename case must be exact in qBinaryFind below, so create a list of all lowercase names.
- QStringList newFiles;
- for(int i = 0; i < files.size(); i++) {
- newFiles << files.at(i).toLower();
- }
-#else
QStringList newFiles = files;
-#endif
qSort(newFiles.begin(), newFiles.end());
QHash<QString, QFileSystemNode*>::const_iterator i = parentNode->children.constBegin();
while (i != parentNode->children.constEnd()) {
QStringList::iterator iterator;
iterator = qBinaryFind(newFiles.begin(), newFiles.end(),
-#if defined(Q_OS_SYMBIAN)
- i.value()->fileName.toLower());
-#else
i.value()->fileName);
-#endif
if (iterator == newFiles.end()) {
toRemove.append(i.value()->fileName);
}
@@ -1978,8 +1962,8 @@ bool QFileSystemModelPrivate::filtersAcceptsNode(const QFileSystemNode *node) co
const bool hideHidden = !(filters & QDir::Hidden);
const bool hideSystem = !(filters & QDir::System);
const bool hideSymlinks = (filters & QDir::NoSymLinks);
- const bool hideDot = (filters & QDir::NoDot) || (filters & QDir::NoDotAndDotDot); // ### Qt5: simplify (because NoDotAndDotDot=NoDot|NoDotDot)
- const bool hideDotDot = (filters & QDir::NoDotDot) || (filters & QDir::NoDotAndDotDot); // ### Qt5: simplify (because NoDotAndDotDot=NoDot|NoDotDot)
+ const bool hideDot = (filters & QDir::NoDot);
+ const bool hideDotDot = (filters & QDir::NoDotDot);
// Note that we match the behavior of entryList and not QFileInfo on this and this
// incompatibility won't be fixed until Qt 5 at least
diff --git a/src/widgets/dialogs/qfilesystemmodel.h b/src/widgets/dialogs/qfilesystemmodel.h
index 09e8d9d529..5a9139266d 100644
--- a/src/widgets/dialogs/qfilesystemmodel.h
+++ b/src/widgets/dialogs/qfilesystemmodel.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -52,7 +52,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
#ifndef QT_NO_FILESYSTEMMODEL
diff --git a/src/widgets/dialogs/qfilesystemmodel_p.h b/src/widgets/dialogs/qfilesystemmodel_p.h
index 2ab7838dad..0e982140b5 100644
--- a/src/widgets/dialogs/qfilesystemmodel_p.h
+++ b/src/widgets/dialogs/qfilesystemmodel_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/dialogs/qfontdialog.cpp b/src/widgets/dialogs/qfontdialog.cpp
index c8fb36d9d6..2402f2a955 100644
--- a/src/widgets/dialogs/qfontdialog.cpp
+++ b/src/widgets/dialogs/qfontdialog.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -65,10 +65,6 @@
#include <private/qdialog_p.h>
#include <private/qfont_p.h>
-#if defined(Q_WS_S60)
-#include <QtWidgets/qdesktopwidget.h>
-#endif
-
QT_BEGIN_NAMESPACE
class QFontListView : public QListView
@@ -322,8 +318,6 @@ void QFontDialogPrivate::init()
#if defined(Q_WS_WINCE)
q->resize(180, 120);
-#elif defined(Q_WS_S60)
- q->resize(QApplication::desktop()->availableGeometry(QCursor::pos()).size());
#else
q->resize(500, 360);
#endif // Q_WS_WINCE
@@ -385,23 +379,6 @@ QFont QFontDialog::getFont(bool *ok, const QFont &initial, QWidget *parent, cons
/*!
\overload
- \since 4.5
-*/
-QFont QFontDialog::getFont(bool *ok, const QFont &initial, QWidget *parent, const QString &title)
-{
- return QFontDialogPrivate::getFont(ok, initial, parent, title, 0);
-}
-
-/*!
- \overload
-*/
-QFont QFontDialog::getFont(bool *ok, const QFont &initial, QWidget *parent)
-{
- return QFontDialogPrivate::getFont(ok, initial, parent, QString(), 0);
-}
-
-/*!
- \overload
Executes a modal font dialog and returns a font.
@@ -782,11 +759,7 @@ void QFontDialogPrivate::retranslateStrings()
familyAccel->setText(QFontDialog::tr("&Font"));
styleAccel->setText(QFontDialog::tr("Font st&yle"));
sizeAccel->setText(QFontDialog::tr("&Size"));
-#ifndef Q_WS_S60
- // Removed the title due to lack of screen estate in small S60 screen.
- // The effects are descriptive without a title (strikeout, underline).
effects->setTitle(QFontDialog::tr("Effects"));
-#endif
strikeout->setText(QFontDialog::tr("Stri&keout"));
underline->setText(QFontDialog::tr("&Underline"));
sample->setTitle(QFontDialog::tr("Sample"));
diff --git a/src/widgets/dialogs/qfontdialog.h b/src/widgets/dialogs/qfontdialog.h
index f5353d512f..c5f654a50a 100644
--- a/src/widgets/dialogs/qfontdialog.h
+++ b/src/widgets/dialogs/qfontdialog.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -50,7 +50,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
#ifndef QT_NO_FONTDIALOG
@@ -97,13 +96,9 @@ public:
void setVisible(bool visible);
- // ### Qt 5: merge overloads
- static QFont getFont(bool *ok, const QFont &initial, QWidget *parent, const QString &title,
- FontDialogOptions options);
- static QFont getFont(bool *ok, const QFont &initial, QWidget *parent, const QString &title);
- static QFont getFont(bool *ok, const QFont &initial, QWidget *parent = 0);
static QFont getFont(bool *ok, QWidget *parent = 0);
-
+ static QFont getFont(bool *ok, const QFont &initial, QWidget *parent = 0, const QString &title = QString(),
+ FontDialogOptions options = 0);
Q_SIGNALS:
void currentFontChanged(const QFont &font);
@@ -112,11 +107,9 @@ Q_SIGNALS:
protected:
void changeEvent(QEvent *event);
void done(int result);
-
-private:
- // ### Qt 5: make protected
bool eventFilter(QObject *object, QEvent *event);
+private:
Q_DISABLE_COPY(QFontDialog)
Q_PRIVATE_SLOT(d_func(), void _q_sizeChanged(const QString &))
diff --git a/src/widgets/dialogs/qfontdialog_mac.mm b/src/widgets/dialogs/qfontdialog_mac.mm
index 71b142cd48..bf8b88a0c9 100644
--- a/src/widgets/dialogs/qfontdialog_mac.mm
+++ b/src/widgets/dialogs/qfontdialog_mac.mm
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/dialogs/qfontdialog_p.h b/src/widgets/dialogs/qfontdialog_p.h
index 506d52b0b6..9bf00d2657 100644
--- a/src/widgets/dialogs/qfontdialog_p.h
+++ b/src/widgets/dialogs/qfontdialog_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/dialogs/qfscompleter_p.h b/src/widgets/dialogs/qfscompleter_p.h
index c25bcf20cb..eae972aa32 100644
--- a/src/widgets/dialogs/qfscompleter_p.h
+++ b/src/widgets/dialogs/qfscompleter_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -66,7 +66,7 @@ public:
QFSCompleter(QFileSystemModel *model, QObject *parent = 0)
: QCompleter(model, parent), proxyModel(0), sourceModel(model)
{
-#if defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN)
+#if defined(Q_OS_WIN)
setCaseSensitivity(Qt::CaseInsensitive);
#endif
}
diff --git a/src/widgets/dialogs/qinputdialog.cpp b/src/widgets/dialogs/qinputdialog.cpp
index dc7e30368b..9cf41003f5 100644
--- a/src/widgets/dialogs/qinputdialog.cpp
+++ b/src/widgets/dialogs/qinputdialog.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -1173,17 +1173,6 @@ QString QInputDialog::getText(QWidget *parent, const QString &title, const QStri
}
/*!
- \internal
-*/
-// ### Qt 5: Use only the version above.
-QString QInputDialog::getText(QWidget *parent, const QString &title, const QString &label,
- QLineEdit::EchoMode mode, const QString &text, bool *ok,
- Qt::WindowFlags flags)
-{
- return getText(parent, title, label, mode, text, ok, flags, Qt::ImhNone);
-}
-
-/*!
\since 4.5
Static convenience function to get an integer input from the user.
@@ -1342,29 +1331,6 @@ QString QInputDialog::getItem(QWidget *parent, const QString &title, const QStri
}
/*!
- \internal
-*/
-// ### Qt 5: Use only the version above.
-QString QInputDialog::getItem(QWidget *parent, const QString &title, const QString &label,
- const QStringList &items, int current, bool editable, bool *ok,
- Qt::WindowFlags flags)
-{
- return getItem(parent, title, label, items, current, editable, ok, flags, Qt::ImhNone);
-}
-
-/*!
- \obsolete
-
- Use getInt() instead.
-*/
-int QInputDialog::getInteger(QWidget *parent, const QString &title, const QString &label,
- int value, int min, int max, int step, bool *ok,
- Qt::WindowFlags flags)
-{
- return getInt(parent, title, label, value, min, max, step, ok, flags);
-}
-
-/*!
\fn QString QInputDialog::getText(const QString &title, const QString &label,
QLineEdit::EchoMode echo = QLineEdit::Normal,
const QString &text = QString(), bool *ok = 0,
@@ -1377,19 +1343,6 @@ int QInputDialog::getInteger(QWidget *parent, const QString &title, const QStrin
*/
/*!
- \fn int QInputDialog::getInteger(const QString &title, const QString &label, int value = 0,
- int min = -2147483647, int max = 2147483647,
- int step = 1, bool *ok = 0,
- QWidget *parent = 0, const char *name = 0, Qt::WindowFlags flags = 0)
-
-
- Call getInteger(\a parent, \a title, \a label, \a value, \a
- min, \a max, \a step, \a ok, \a flags) instead.
-
- The \a name parameter is ignored.
-*/
-
-/*!
\fn double QInputDialog::getDouble(const QString &title, const QString &label, double value = 0,
double min = -2147483647, double max = 2147483647,
int decimals = 1, bool *ok = 0,
diff --git a/src/widgets/dialogs/qinputdialog.h b/src/widgets/dialogs/qinputdialog.h
index 164e0d1014..bf6885cccc 100644
--- a/src/widgets/dialogs/qinputdialog.h
+++ b/src/widgets/dialogs/qinputdialog.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -50,7 +50,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
#ifndef QT_NO_INPUTDIALOG
@@ -167,7 +166,6 @@ public:
void setVisible(bool visible);
-#ifdef Q_QDOC
static QString getText(QWidget *parent, const QString &title, const QString &label,
QLineEdit::EchoMode echo = QLineEdit::Normal,
const QString &text = QString(), bool *ok = 0, Qt::WindowFlags flags = 0,
@@ -176,22 +174,7 @@ public:
const QStringList &items, int current = 0, bool editable = true,
bool *ok = 0, Qt::WindowFlags flags = 0,
Qt::InputMethodHints inputMethodHints = Qt::ImhNone);
-#else
- static QString getText(QWidget *parent, const QString &title, const QString &label,
- QLineEdit::EchoMode echo = QLineEdit::Normal,
- const QString &text = QString(), bool *ok = 0, Qt::WindowFlags flags = 0);
- static QString getItem(QWidget *parent, const QString &title, const QString &label,
- const QStringList &items, int current = 0, bool editable = true,
- bool *ok = 0, Qt::WindowFlags flags = 0);
- static QString getText(QWidget *parent, const QString &title, const QString &label,
- QLineEdit::EchoMode echo,
- const QString &text, bool *ok, Qt::WindowFlags flags,
- Qt::InputMethodHints inputMethodHints);
- static QString getItem(QWidget *parent, const QString &title, const QString &label,
- const QStringList &items, int current, bool editable,
- bool *ok, Qt::WindowFlags flags,
- Qt::InputMethodHints inputMethodHints);
-#endif
+
static int getInt(QWidget *parent, const QString &title, const QString &label, int value = 0,
int minValue = -2147483647, int maxValue = 2147483647,
int step = 1, bool *ok = 0, Qt::WindowFlags flags = 0);
@@ -199,11 +182,14 @@ public:
double minValue = -2147483647, double maxValue = 2147483647,
int decimals = 1, bool *ok = 0, Qt::WindowFlags flags = 0);
- // obsolete
- static int getInteger(QWidget *parent, const QString &title, const QString &label, int value = 0,
+#if QT_DEPRECATED_SINCE(5, 0)
+ QT_DEPRECATED static inline int getInteger(QWidget *parent, const QString &title, const QString &label, int value = 0,
int minValue = -2147483647, int maxValue = 2147483647,
- int step = 1, bool *ok = 0, Qt::WindowFlags flags = 0);
-
+ int step = 1, bool *ok = 0, Qt::WindowFlags flags = 0)
+ {
+ return getInt(parent, title, label, value, minValue, maxValue, step, ok, flags);
+ }
+#endif
Q_SIGNALS:
// ### emit signals!
@@ -214,9 +200,8 @@ Q_SIGNALS:
void doubleValueChanged(double value);
void doubleValueSelected(double value);
-
public:
- void done(int result); // ### Qt 5: Make protected.
+ void done(int result);
private:
Q_DISABLE_COPY(QInputDialog)
diff --git a/src/widgets/dialogs/qmessagebox.cpp b/src/widgets/dialogs/qmessagebox.cpp
index fdba17d0ce..0f57fa67e1 100644
--- a/src/widgets/dialogs/qmessagebox.cpp
+++ b/src/widgets/dialogs/qmessagebox.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -65,20 +65,23 @@
#include <QtGui/qfontmetrics.h>
#include <QtGui/qclipboard.h>
-#ifndef QT_NO_STYLE_S60
-#include <qs60style.h>
+#ifdef Q_OS_WIN
+# include <QtCore/qt_windows.h>
+# include <QtGui/QPlatformNativeInterface>
#endif
-#ifdef Q_WS_WINCE
-extern bool qt_wince_is_mobile(); //defined in qguifunctions_wince.cpp
-extern bool qt_wince_is_smartphone();//defined in qguifunctions_wince.cpp
-extern bool qt_wince_is_pocket_pc(); //defined in qguifunctions_wince.cpp
+QT_BEGIN_NAMESPACE
-#include "qguifunctions_wince.h"
+#ifdef Q_OS_WIN
+HMENU qt_getWindowsSystemMenu(const QWidget *w)
+{
+ if (QWindow *window = QApplicationPrivate::windowForWidget(w))
+ if (void *handle = QGuiApplication::platformNativeInterface()->nativeResourceForWindow("handle", window))
+ return GetSystemMenu(reinterpret_cast<HWND>(handle), FALSE);
+ return 0;
+}
#endif
-QT_BEGIN_NAMESPACE
-
enum Button { Old_Ok = 1, Old_Cancel = 2, Old_Yes = 3, Old_No = 4, Old_Abort = 5, Old_Retry = 6,
Old_Ignore = 7, Old_YesAll = 8, Old_NoAll = 9, Old_ButtonMask = 0xFF,
NewButtonMask = 0xFFFFFC00 };
@@ -346,15 +349,6 @@ void QMessageBoxPrivate::updateSize()
width = hardLimit;
}
}
-#ifdef Q_WS_S60
- // in S60 portait messageBoxes should always occupy maximum width
- if (QApplication::desktop()->size().height() > QApplication::desktop()->size().width()){
- width = hardLimit;
- } else {
- // in landscape the messageBoxes should be of same width as in portrait
- width = qMin(QApplication::desktop()->size().height(), hardLimit);
- }
-#endif
if (informativeLabel) {
label->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);
@@ -385,15 +379,6 @@ void QMessageBoxPrivate::updateSize()
? layout->totalHeightForWidth(width)
: layout->totalMinimumSize().height();
-#ifndef QT_NO_STYLE_S60
- QS60Style *s60Style = 0;
- s60Style = qobject_cast<QS60Style *>(QApplication::style());
-
- //use custom pixel metric to deduce the minimum height of the messagebox
- if (s60Style)
- height = qMax(height, s60Style->pixelMetric((QStyle::PixelMetric)PM_MessageBoxHeight));
-#endif
-
q->setFixedSize(width, height);
QCoreApplication::removePostedEvents(q, QEvent::LayoutRequest);
}
@@ -1478,15 +1463,12 @@ void QMessageBox::showEvent(QShowEvent *e)
d->updateSize();
#ifndef QT_NO_ACCESSIBILITY
- QAccessible::updateAccessibility(this, 0, QAccessible::Alert);
+ QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::Alert, this, 0));
#endif
-#ifdef Q_WS_WIN
- HMENU systemMenu = GetSystemMenu((HWND)winId(), FALSE);
- if (!d->detectedEscapeButton) {
- EnableMenuItem(systemMenu, SC_CLOSE, MF_BYCOMMAND|MF_GRAYED);
- }
- else {
- EnableMenuItem(systemMenu, SC_CLOSE, MF_BYCOMMAND|MF_ENABLED);
+#ifdef Q_OS_WIN
+ if (const HMENU systemMenu = qt_getWindowsSystemMenu(this)) {
+ EnableMenuItem(systemMenu, SC_CLOSE, d->detectedEscapeButton ?
+ MF_BYCOMMAND|MF_ENABLED : MF_BYCOMMAND|MF_GRAYED);
}
#endif
QDialog::showEvent(e);
@@ -1810,15 +1792,6 @@ void QMessageBox::aboutQt(QWidget *parent, const QString &title)
#endif
}
-/*!
- \internal
-*/
-QSize QMessageBox::sizeHint() const
-{
- // ### Qt 5: remove
- return QDialog::sizeHint();
-}
-
/////////////////////////////////////////////////////////////////////////////////////////
// Source and binary compatibility routines for 4.0 and 4.1
diff --git a/src/widgets/dialogs/qmessagebox.h b/src/widgets/dialogs/qmessagebox.h
index 4774389a69..b42681a565 100644
--- a/src/widgets/dialogs/qmessagebox.h
+++ b/src/widgets/dialogs/qmessagebox.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -48,7 +48,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
#ifndef QT_NO_MESSAGEBOX
@@ -62,7 +61,6 @@ class Q_WIDGETS_EXPORT QMessageBox : public QDialog
Q_ENUMS(Icon)
Q_FLAGS(StandardButtons)
Q_PROPERTY(QString text READ text WRITE setText)
- // ### Qt 5: Rename 'icon' 'standardIcon' and 'iconPixmap' 'icon' (and use QIcon?)
Q_PROPERTY(Icon icon READ icon WRITE setIcon)
Q_PROPERTY(QPixmap iconPixmap READ iconPixmap WRITE setIconPixmap)
Q_PROPERTY(Qt::TextFormat textFormat READ textFormat WRITE setTextFormat)
@@ -191,10 +189,8 @@ public:
static StandardButton information(QWidget *parent, const QString &title,
const QString &text, StandardButtons buttons = Ok,
StandardButton defaultButton = NoButton);
- // ### Qt 5: Replace Ok with Yes|No in question() function.
- // Also consider if Ok == Yes and Cancel == No.
static StandardButton question(QWidget *parent, const QString &title,
- const QString &text, StandardButtons buttons = Ok,
+ const QString &text, StandardButtons buttons = StandardButtons(Yes | No),
StandardButton defaultButton = NoButton);
static StandardButton warning(QWidget *parent, const QString &title,
const QString &text, StandardButtons buttons = Ok,
@@ -205,8 +201,6 @@ public:
static void about(QWidget *parent, const QString &title, const QString &text);
static void aboutQt(QWidget *parent, const QString &title = QString());
- QSize sizeHint() const;
-
// the following functions are obsolete:
QMessageBox(const QString &title, const QString &text, Icon icon,
diff --git a/src/widgets/dialogs/qnspanelproxy_mac.mm b/src/widgets/dialogs/qnspanelproxy_mac.mm
index 4f171eab74..403c3edc24 100644
--- a/src/widgets/dialogs/qnspanelproxy_mac.mm
+++ b/src/widgets/dialogs/qnspanelproxy_mac.mm
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/dialogs/qprogressdialog.cpp b/src/widgets/dialogs/qprogressdialog.cpp
index 3cf576462d..f39a7b63ec 100644
--- a/src/widgets/dialogs/qprogressdialog.cpp
+++ b/src/widgets/dialogs/qprogressdialog.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -60,10 +60,6 @@
#if defined(QT_SOFTKEYS_ENABLED)
#include <qaction.h>
#endif
-#ifdef Q_WS_S60
-#include <QtWidgets/qdesktopwidget.h>
-#endif
-
QT_BEGIN_NAMESPACE
@@ -730,14 +726,7 @@ QSize QProgressDialog::sizeHint() const
int h = margin * 2 + bh.height() + sh.height() + spacing;
if (d->cancel)
h += d->cancel->sizeHint().height() + spacing;
-#ifdef Q_WS_S60
- if (QApplication::desktop()->size().height() > QApplication::desktop()->size().width())
- return QSize(qMax(QApplication::desktop()->size().width(), sh.width() + 2 * margin), h);
- else
- return QSize(qMax(QApplication::desktop()->size().height(), sh.width() + 2 * margin), h);
-#else
return QSize(qMax(200, sh.width() + 2 * margin), h);
-#endif
}
/*!\reimp
diff --git a/src/widgets/dialogs/qprogressdialog.h b/src/widgets/dialogs/qprogressdialog.h
index 6089de3f80..41fa821bb0 100644
--- a/src/widgets/dialogs/qprogressdialog.h
+++ b/src/widgets/dialogs/qprogressdialog.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -48,7 +48,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
#ifndef QT_NO_PROGRESSDIALOG
diff --git a/src/widgets/dialogs/qsidebar.cpp b/src/widgets/dialogs/qsidebar.cpp
index b62afec9bf..00f60f7e77 100644
--- a/src/widgets/dialogs/qsidebar.cpp
+++ b/src/widgets/dialogs/qsidebar.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/dialogs/qsidebar_p.h b/src/widgets/dialogs/qsidebar_p.h
index 265408b4ef..d19ad97639 100644
--- a/src/widgets/dialogs/qsidebar_p.h
+++ b/src/widgets/dialogs/qsidebar_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/dialogs/qwizard.cpp b/src/widgets/dialogs/qwizard.cpp
index dbdff5e34d..629b6828b7 100644
--- a/src/widgets/dialogs/qwizard.cpp
+++ b/src/widgets/dialogs/qwizard.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -2975,11 +2975,7 @@ QSize QWizard::sizeHint() const
{
Q_D(const QWizard);
QSize result = d->mainLayout->totalSizeHint();
-#ifdef Q_WS_S60
- QSize extra(QApplication::desktop()->availableGeometry(QCursor::pos()).size());
-#else
QSize extra(500, 360);
-#endif
if (d->wizStyle == MacStyle && d->current != -1) {
QSize pixmap(currentPage()->pixmap(BackgroundPixmap).size());
extra.setWidth(616);
@@ -3205,16 +3201,17 @@ void QWizard::paintEvent(QPaintEvent * event)
#endif
}
-#if defined(Q_WS_WIN)
+#if defined(Q_OS_WIN)
/*!
\reimp
*/
-bool QWizard::winEvent(MSG *message, long *result)
+bool QWizard::nativeEvent(const QByteArray &eventType, void *message, long *result)
{
#if !defined(QT_NO_STYLE_WINDOWSVISTA)
Q_D(QWizard);
- if (d->isVistaThemeEnabled()) {
- const bool winEventResult = d->vistaHelper->handleWinEvent(message, result);
+ if (d->isVistaThemeEnabled() && eventType == QByteArrayLiteral("windows_generic_MSG")) {
+ MSG *windowsMessage = static_cast<MSG *>(message);
+ const bool winEventResult = d->vistaHelper->handleWinEvent(windowsMessage, result);
if (QVistaHelper::vistaState() != d->vistaState) {
d->vistaState = QVistaHelper::vistaState();
d->vistaStateChanged = true;
@@ -3222,10 +3219,10 @@ bool QWizard::winEvent(MSG *message, long *result)
}
return winEventResult;
} else {
- return QDialog::winEvent(message, result);
+ return QDialog::nativeEvent(eventType, message, result);
}
#else
- return QDialog::winEvent(message, result);
+ return QDialog::nativeEvent(eventType, message, result);
#endif
}
#endif
diff --git a/src/widgets/dialogs/qwizard.h b/src/widgets/dialogs/qwizard.h
index f9af57c0b1..caa9d5e648 100644
--- a/src/widgets/dialogs/qwizard.h
+++ b/src/widgets/dialogs/qwizard.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -48,7 +48,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
#ifndef QT_NO_WIZARD
@@ -190,8 +189,8 @@ protected:
bool event(QEvent *event);
void resizeEvent(QResizeEvent *event);
void paintEvent(QPaintEvent *event);
-#if defined(Q_WS_WIN)
- bool winEvent(MSG * message, long * result);
+#ifdef Q_OS_WIN
+ bool nativeEvent(const QByteArray &eventType, void * message, long * result);
#endif
void done(int result);
virtual void initializePage(int id);
diff --git a/src/widgets/dialogs/qwizard_win.cpp b/src/widgets/dialogs/qwizard_win.cpp
index 06640a5864..2c4c738681 100644
--- a/src/widgets/dialogs/qwizard_win.cpp
+++ b/src/widgets/dialogs/qwizard_win.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -318,10 +318,10 @@ bool QVistaHelper::setDWMTitleBar(TitleBarChangeType type)
return value;
}
+Q_GUI_EXPORT HICON qt_pixmapToWinHICON(const QPixmap &);
+
void QVistaHelper::drawTitleBar(QPainter *painter)
{
- Q_GUI_EXPORT HICON qt_pixmapToWinHICON(const QPixmap &);
-
Q_ASSERT(backButton_);
QPlatformNativeInterface *nativeInterface = QGuiApplication::platformNativeInterface();
QBackingStore *backingStore = backButton_->backingStore();
@@ -399,12 +399,13 @@ bool QVistaHelper::winEvent(MSG* msg, long* result)
*result = DefWindowProc(msg->hwnd, msg->message, msg->wParam, msg->lParam);
break;
}
- case WM_NCCALCSIZE: {
- NCCALCSIZE_PARAMS* lpncsp = (NCCALCSIZE_PARAMS*)msg->lParam;
- *result = DefWindowProc(msg->hwnd, msg->message, msg->wParam, msg->lParam);
- lpncsp->rgrc[0].top -= (vistaState() == VistaAero ? titleBarSize() : 0);
- break;
- }
+// case WM_NCCALCSIZE: { #fixme: If the frame size is changed, it needs to be communicated to the QWindow.
+// NCCALCSIZE_PARAMS* lpncsp = (NCCALCSIZE_PARAMS*)msg->lParam;
+// *result = DefWindowProc(msg->hwnd, msg->message, msg->wParam, msg->lParam);
+// lpncsp->rgrc[0].top -= (vistaState() == VistaAero ? titleBarSize() : 0);
+//
+// break;
+// }
default:
retval = false;
}
@@ -480,8 +481,8 @@ bool QVistaHelper::handleWinEvent(MSG *message, long *result)
if (wizard->wizardStyle() == QWizard::AeroStyle && vistaState() == VistaAero) {
status = winEvent(message, result);
if (message->message == WM_NCCALCSIZE) {
- if (status)
- collapseTopFrameStrut();
+// if (status) #fixme
+// collapseTopFrameStrut();
} else if (message->message == WM_NCPAINT) {
wizard->update();
}
diff --git a/src/widgets/dialogs/qwizard_win_p.h b/src/widgets/dialogs/qwizard_win_p.h
index ab16d293af..80b5fd8241 100644
--- a/src/widgets/dialogs/qwizard_win_p.h
+++ b/src/widgets/dialogs/qwizard_win_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -56,12 +56,12 @@
#ifndef QT_NO_WIZARD
#ifndef QT_NO_STYLE_WINDOWSVISTA
-#include <qt_windows.h>
#include <qobject.h>
#include <qwidget.h>
#include <qabstractbutton.h>
#include <QtWidgets/private/qwidget_p.h>
#include <QtWidgets/private/qstylehelper_p.h>
+#include <qt_windows.h>
QT_BEGIN_NAMESPACE
diff --git a/src/widgets/effects/qgraphicseffect.cpp b/src/widgets/effects/qgraphicseffect.cpp
index ac33bffd6c..f1b4cc80f9 100644
--- a/src/widgets/effects/qgraphicseffect.cpp
+++ b/src/widgets/effects/qgraphicseffect.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/effects/qgraphicseffect.h b/src/widgets/effects/qgraphicseffect.h
index e8e97aa7e7..94e00876ce 100644
--- a/src/widgets/effects/qgraphicseffect.h
+++ b/src/widgets/effects/qgraphicseffect.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -53,7 +53,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
class QGraphicsItem;
class QStyleOption;
diff --git a/src/widgets/effects/qgraphicseffect_p.h b/src/widgets/effects/qgraphicseffect_p.h
index b2859f9a41..9dee34ca9e 100644
--- a/src/widgets/effects/qgraphicseffect_p.h
+++ b/src/widgets/effects/qgraphicseffect_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/effects/qpixmapfilter.cpp b/src/widgets/effects/qpixmapfilter.cpp
index 826bf2e93d..a141fa9e55 100644
--- a/src/widgets/effects/qpixmapfilter.cpp
+++ b/src/widgets/effects/qpixmapfilter.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/effects/qpixmapfilter_p.h b/src/widgets/effects/qpixmapfilter_p.h
index 3f6ed069a1..158cbe84bb 100644
--- a/src/widgets/effects/qpixmapfilter_p.h
+++ b/src/widgets/effects/qpixmapfilter_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -62,7 +62,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
class QPainter;
class QPlatformPixmap;
diff --git a/src/widgets/graphicsview/graphicsview.pri b/src/widgets/graphicsview/graphicsview.pri
index 547d7ce7ae..a0fc4bc8d3 100644
--- a/src/widgets/graphicsview/graphicsview.pri
+++ b/src/widgets/graphicsview/graphicsview.pri
@@ -9,6 +9,7 @@ HEADERS += graphicsview/qgraphicsgridlayout.h \
graphicsview/qgraphicslayoutitem_p.h \
graphicsview/qgraphicslinearlayout.h \
graphicsview/qgraphicsproxywidget.h \
+ graphicsview/qgraphicsproxywidget_p.h \
graphicsview/qgraphicsscene.h \
graphicsview/qgraphicsscene_bsp_p.h \
graphicsview/qgraphicsscene_p.h \
diff --git a/src/widgets/graphicsview/qgraph_p.h b/src/widgets/graphicsview/qgraph_p.h
index 676000ac3e..e41bf5a5da 100644
--- a/src/widgets/graphicsview/qgraph_p.h
+++ b/src/widgets/graphicsview/qgraph_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/graphicsview/qgraphicsanchorlayout.cpp b/src/widgets/graphicsview/qgraphicsanchorlayout.cpp
index 3fb768d30a..1ccf6fcffe 100644
--- a/src/widgets/graphicsview/qgraphicsanchorlayout.cpp
+++ b/src/widgets/graphicsview/qgraphicsanchorlayout.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/graphicsview/qgraphicsanchorlayout.h b/src/widgets/graphicsview/qgraphicsanchorlayout.h
index 8db6391987..47a520689e 100644
--- a/src/widgets/graphicsview/qgraphicsanchorlayout.h
+++ b/src/widgets/graphicsview/qgraphicsanchorlayout.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -50,9 +50,8 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
-#if !defined(QT_NO_GRAPHICSVIEW) || (QT_EDITION & QT_MODULE_GRAPHICSVIEW) != QT_MODULE_GRAPHICSVIEW
+#if !defined(QT_NO_GRAPHICSVIEW)
class QGraphicsAnchorPrivate;
class QGraphicsAnchorLayout;
diff --git a/src/widgets/graphicsview/qgraphicsanchorlayout_p.cpp b/src/widgets/graphicsview/qgraphicsanchorlayout_p.cpp
index 2ac3953676..3d20f0b07c 100644
--- a/src/widgets/graphicsview/qgraphicsanchorlayout_p.cpp
+++ b/src/widgets/graphicsview/qgraphicsanchorlayout_p.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/graphicsview/qgraphicsanchorlayout_p.h b/src/widgets/graphicsview/qgraphicsanchorlayout_p.h
index 21524e9157..328461a363 100644
--- a/src/widgets/graphicsview/qgraphicsanchorlayout_p.h
+++ b/src/widgets/graphicsview/qgraphicsanchorlayout_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/graphicsview/qgraphicsgridlayout.cpp b/src/widgets/graphicsview/qgraphicsgridlayout.cpp
index fb4cf954e4..c5e7e83cf4 100644
--- a/src/widgets/graphicsview/qgraphicsgridlayout.cpp
+++ b/src/widgets/graphicsview/qgraphicsgridlayout.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/graphicsview/qgraphicsgridlayout.h b/src/widgets/graphicsview/qgraphicsgridlayout.h
index 749af57b0a..a4846a1e71 100644
--- a/src/widgets/graphicsview/qgraphicsgridlayout.h
+++ b/src/widgets/graphicsview/qgraphicsgridlayout.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -49,9 +49,8 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
-#if !defined(QT_NO_GRAPHICSVIEW) || (QT_EDITION & QT_MODULE_GRAPHICSVIEW) != QT_MODULE_GRAPHICSVIEW
+#if !defined(QT_NO_GRAPHICSVIEW)
class QGraphicsGridLayoutPrivate;
diff --git a/src/widgets/graphicsview/qgraphicsitem.cpp b/src/widgets/graphicsview/qgraphicsitem.cpp
index eb77aee9ae..ba3b4962e7 100644
--- a/src/widgets/graphicsview/qgraphicsitem.cpp
+++ b/src/widgets/graphicsview/qgraphicsitem.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -743,7 +743,7 @@
#include <QtGui/qpixmapcache.h>
#include <QtWidgets/qstyleoption.h>
#include <QtGui/qevent.h>
-#include <QtGui/qinputpanel.h>
+#include <QtGui/qinputmethod.h>
#include <QtWidgets/qgraphicseffect.h>
#ifndef QT_NO_ACCESSIBILITY
# include "qaccessible.h"
@@ -7327,7 +7327,7 @@ void QGraphicsItem::inputMethodEvent(QInputMethodEvent *event)
surrounding text and reconversions. \a query specifies which
property is queried.
- \sa inputMethodEvent(), QInputMethodEvent, QInputContext
+ \sa inputMethodEvent(), QInputMethodEvent
*/
QVariant QGraphicsItem::inputMethodQuery(Qt::InputMethodQuery query) const
{
@@ -7354,7 +7354,7 @@ QVariant QGraphicsItem::inputMethodQuery(Qt::InputMethodQuery query) const
\since 4.6
- \sa setInputMethodHints(), inputMethodQuery(), QInputContext
+ \sa setInputMethodHints(), inputMethodQuery()
*/
Qt::InputMethodHints QGraphicsItem::inputMethodHints() const
{
@@ -7367,7 +7367,7 @@ Qt::InputMethodHints QGraphicsItem::inputMethodHints() const
\since 4.6
- \sa inputMethodHints(), inputMethodQuery(), QInputContext
+ \sa inputMethodHints(), inputMethodQuery()
*/
void QGraphicsItem::setInputMethodHints(Qt::InputMethodHints hints)
{
@@ -7379,7 +7379,7 @@ void QGraphicsItem::setInputMethodHints(Qt::InputMethodHints hints)
QWidget *fw = QApplication::focusWidget();
if (!fw)
return;
- qApp->inputPanel()->update(Qt::ImHints);
+ qApp->inputMethod()->update(Qt::ImHints);
}
/*!
@@ -7387,7 +7387,7 @@ void QGraphicsItem::setInputMethodHints(Qt::InputMethodHints hints)
\since 4.7
- \sa QInputContext
+ \sa QInputMethod
*/
void QGraphicsItem::updateMicroFocus()
{
@@ -7397,7 +7397,7 @@ void QGraphicsItem::updateMicroFocus()
for (int i = 0 ; i < scene()->views().count() ; ++i) {
if (scene()->views().at(i) == fw) {
if (qApp)
- qApp->inputPanel()->update(Qt::ImQueryAll);
+ qApp->inputMethod()->update(Qt::ImQueryAll);
#ifndef QT_NO_ACCESSIBILITY
// ##### is this correct
@@ -7695,7 +7695,7 @@ void QGraphicsObject::ungrabGesture(Qt::GestureType gesture)
\since 4.7
- \sa QInputContext
+ \sa QInputMethod
*/
void QGraphicsObject::updateMicroFocus()
{
@@ -10215,9 +10215,9 @@ bool QGraphicsTextItem::sceneEvent(QEvent *event)
// Reset the focus widget's input context, regardless
// of how this item gained or lost focus.
if (event->type() == QEvent::FocusIn || event->type() == QEvent::FocusOut) {
- qApp->inputPanel()->reset();
+ qApp->inputMethod()->reset();
} else {
- qApp->inputPanel()->update(Qt::ImQueryInput);
+ qApp->inputMethod()->update(Qt::ImQueryInput);
}
break;
case QEvent::ShortcutOverride:
diff --git a/src/widgets/graphicsview/qgraphicsitem.h b/src/widgets/graphicsview/qgraphicsitem.h
index 3873857b8a..7f9b61678c 100644
--- a/src/widgets/graphicsview/qgraphicsitem.h
+++ b/src/widgets/graphicsview/qgraphicsitem.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -56,9 +56,8 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
-#if !defined(QT_NO_GRAPHICSVIEW) || (QT_EDITION & QT_MODULE_GRAPHICSVIEW) != QT_MODULE_GRAPHICSVIEW
+#if !defined(QT_NO_GRAPHICSVIEW)
class QBrush;
class QCursor;
@@ -496,7 +495,7 @@ private:
};
Q_DECLARE_OPERATORS_FOR_FLAGS(QGraphicsItem::GraphicsItemFlags)
-Q_DECLARE_INTERFACE(QGraphicsItem, "com.trolltech.Qt.QGraphicsItem")
+Q_DECLARE_INTERFACE(QGraphicsItem, "org.qt-project.Qt.QGraphicsItem")
inline void QGraphicsItem::setPos(qreal ax, qreal ay)
{ setPos(QPointF(ax, ay)); }
diff --git a/src/widgets/graphicsview/qgraphicsitem_p.h b/src/widgets/graphicsview/qgraphicsitem_p.h
index beedbfaa27..aebb22a0ee 100644
--- a/src/widgets/graphicsview/qgraphicsitem_p.h
+++ b/src/widgets/graphicsview/qgraphicsitem_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -65,7 +65,7 @@
#include <QtCore/qpoint.h>
-#if !defined(QT_NO_GRAPHICSVIEW) || (QT_EDITION & QT_MODULE_GRAPHICSVIEW) != QT_MODULE_GRAPHICSVIEW
+#if !defined(QT_NO_GRAPHICSVIEW)
QT_BEGIN_NAMESPACE
diff --git a/src/widgets/graphicsview/qgraphicsitemanimation.cpp b/src/widgets/graphicsview/qgraphicsitemanimation.cpp
index 10c292bed1..f21220b3b1 100644
--- a/src/widgets/graphicsview/qgraphicsitemanimation.cpp
+++ b/src/widgets/graphicsview/qgraphicsitemanimation.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/graphicsview/qgraphicsitemanimation.h b/src/widgets/graphicsview/qgraphicsitemanimation.h
index 1f17d7e2e5..f42fc694fd 100644
--- a/src/widgets/graphicsview/qgraphicsitemanimation.h
+++ b/src/widgets/graphicsview/qgraphicsitemanimation.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -44,13 +44,12 @@
#include <QtCore/qobject.h>
-#if !defined(QT_NO_GRAPHICSVIEW) || (QT_EDITION & QT_MODULE_GRAPHICSVIEW) != QT_MODULE_GRAPHICSVIEW
+#if !defined(QT_NO_GRAPHICSVIEW)
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
class QGraphicsItem;
class QMatrix;
diff --git a/src/widgets/graphicsview/qgraphicslayout.cpp b/src/widgets/graphicsview/qgraphicslayout.cpp
index 6c8a2662be..cec5ba57a3 100644
--- a/src/widgets/graphicsview/qgraphicslayout.cpp
+++ b/src/widgets/graphicsview/qgraphicslayout.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/graphicsview/qgraphicslayout.h b/src/widgets/graphicsview/qgraphicslayout.h
index 4e5b2a982a..64e7881faa 100644
--- a/src/widgets/graphicsview/qgraphicslayout.h
+++ b/src/widgets/graphicsview/qgraphicslayout.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -48,9 +48,8 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
-#if !defined(QT_NO_GRAPHICSVIEW) || (QT_EDITION & QT_MODULE_GRAPHICSVIEW) != QT_MODULE_GRAPHICSVIEW
+#if !defined(QT_NO_GRAPHICSVIEW)
class QGraphicsLayoutPrivate;
class QGraphicsLayoutItem;
@@ -88,7 +87,7 @@ private:
friend class QGraphicsWidget;
};
-Q_DECLARE_INTERFACE(QGraphicsLayout, "com.trolltech.Qt.QGraphicsLayout")
+Q_DECLARE_INTERFACE(QGraphicsLayout, "org.qt-project.Qt.QGraphicsLayout")
#endif
diff --git a/src/widgets/graphicsview/qgraphicslayout_p.cpp b/src/widgets/graphicsview/qgraphicslayout_p.cpp
index ce3525b68d..50aa39570e 100644
--- a/src/widgets/graphicsview/qgraphicslayout_p.cpp
+++ b/src/widgets/graphicsview/qgraphicslayout_p.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/graphicsview/qgraphicslayout_p.h b/src/widgets/graphicsview/qgraphicslayout_p.h
index ea98a4a679..57a06b31fc 100644
--- a/src/widgets/graphicsview/qgraphicslayout_p.h
+++ b/src/widgets/graphicsview/qgraphicslayout_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -55,7 +55,7 @@
#include <QtCore/qglobal.h>
-#if !defined(QT_NO_GRAPHICSVIEW) || (QT_EDITION & QT_MODULE_GRAPHICSVIEW) != QT_MODULE_GRAPHICSVIEW
+#if !defined(QT_NO_GRAPHICSVIEW)
#include "qgraphicslayout.h"
#include "qgraphicslayoutitem_p.h"
diff --git a/src/widgets/graphicsview/qgraphicslayoutitem.cpp b/src/widgets/graphicsview/qgraphicslayoutitem.cpp
index ff53f1fd95..e58080fb95 100644
--- a/src/widgets/graphicsview/qgraphicslayoutitem.cpp
+++ b/src/widgets/graphicsview/qgraphicslayoutitem.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/graphicsview/qgraphicslayoutitem.h b/src/widgets/graphicsview/qgraphicslayoutitem.h
index 926a2b15dc..ef391f01a0 100644
--- a/src/widgets/graphicsview/qgraphicslayoutitem.h
+++ b/src/widgets/graphicsview/qgraphicslayoutitem.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -50,9 +50,8 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
-#if !defined(QT_NO_GRAPHICSVIEW) || (QT_EDITION & QT_MODULE_GRAPHICSVIEW) != QT_MODULE_GRAPHICSVIEW
+#if !defined(QT_NO_GRAPHICSVIEW)
class QGraphicsLayoutItemPrivate;
class QGraphicsItem;
@@ -122,7 +121,7 @@ private:
friend class QGraphicsLayout;
};
-Q_DECLARE_INTERFACE(QGraphicsLayoutItem, "com.trolltech.Qt.QGraphicsLayoutItem")
+Q_DECLARE_INTERFACE(QGraphicsLayoutItem, "org.qt-project.Qt.QGraphicsLayoutItem")
inline void QGraphicsLayoutItem::setMinimumSize(qreal aw, qreal ah)
{ setMinimumSize(QSizeF(aw, ah)); }
diff --git a/src/widgets/graphicsview/qgraphicslayoutitem_p.h b/src/widgets/graphicsview/qgraphicslayoutitem_p.h
index c13402dc49..eab777aa39 100644
--- a/src/widgets/graphicsview/qgraphicslayoutitem_p.h
+++ b/src/widgets/graphicsview/qgraphicslayoutitem_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/graphicsview/qgraphicslinearlayout.cpp b/src/widgets/graphicsview/qgraphicslinearlayout.cpp
index eeb4c0b01c..535e2ddf59 100644
--- a/src/widgets/graphicsview/qgraphicslinearlayout.cpp
+++ b/src/widgets/graphicsview/qgraphicslinearlayout.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/graphicsview/qgraphicslinearlayout.h b/src/widgets/graphicsview/qgraphicslinearlayout.h
index 6d869197cf..2e88bba727 100644
--- a/src/widgets/graphicsview/qgraphicslinearlayout.h
+++ b/src/widgets/graphicsview/qgraphicslinearlayout.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -49,9 +49,8 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
-#if !defined(QT_NO_GRAPHICSVIEW) || (QT_EDITION & QT_MODULE_GRAPHICSVIEW) != QT_MODULE_GRAPHICSVIEW
+#if !defined(QT_NO_GRAPHICSVIEW)
class QGraphicsLinearLayoutPrivate;
diff --git a/src/widgets/graphicsview/qgraphicsproxywidget.cpp b/src/widgets/graphicsview/qgraphicsproxywidget.cpp
index 2eadec0ef1..d532c4e541 100644
--- a/src/widgets/graphicsview/qgraphicsproxywidget.cpp
+++ b/src/widgets/graphicsview/qgraphicsproxywidget.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/graphicsview/qgraphicsproxywidget.h b/src/widgets/graphicsview/qgraphicsproxywidget.h
index 141b61bf09..90a90e07a6 100644
--- a/src/widgets/graphicsview/qgraphicsproxywidget.h
+++ b/src/widgets/graphicsview/qgraphicsproxywidget.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -48,9 +48,8 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
-#if !defined(QT_NO_GRAPHICSVIEW) || (QT_EDITION & QT_MODULE_GRAPHICSVIEW) != QT_MODULE_GRAPHICSVIEW
+#if !defined(QT_NO_GRAPHICSVIEW)
class QGraphicsProxyWidgetPrivate;
diff --git a/src/widgets/graphicsview/qgraphicsproxywidget_p.h b/src/widgets/graphicsview/qgraphicsproxywidget_p.h
index e3e2cd174b..e7e4139f3f 100644
--- a/src/widgets/graphicsview/qgraphicsproxywidget_p.h
+++ b/src/widgets/graphicsview/qgraphicsproxywidget_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -56,7 +56,7 @@
#include "qgraphicsproxywidget.h"
#include "private/qgraphicswidget_p.h"
-#if !defined(QT_NO_GRAPHICSVIEW) || (QT_EDITION & QT_MODULE_GRAPHICSVIEW) != QT_MODULE_GRAPHICSVIEW
+#if !defined(QT_NO_GRAPHICSVIEW)
QT_BEGIN_NAMESPACE
diff --git a/src/widgets/graphicsview/qgraphicsscene.cpp b/src/widgets/graphicsview/qgraphicsscene.cpp
index a8c3f8dee6..280aa7af8e 100644
--- a/src/widgets/graphicsview/qgraphicsscene.cpp
+++ b/src/widgets/graphicsview/qgraphicsscene.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -243,7 +243,7 @@
#include <QtWidgets/qstyleoption.h>
#include <QtWidgets/qtooltip.h>
#include <QtGui/qtransform.h>
-#include <QtGui/qinputpanel.h>
+#include <QtGui/qinputmethod.h>
#include <QtWidgets/qgraphicseffect.h>
#ifndef QT_NO_ACCESSIBILITY
# include <QtGui/qaccessible.h>
@@ -822,7 +822,7 @@ void QGraphicsScenePrivate::setFocusItemHelper(QGraphicsItem *item,
// the views, but if we are changing focus, we have to
// do it ourselves.
if (qApp)
- qApp->inputPanel()->reset();
+ qApp->inputMethod()->reset();
}
focusItem = 0;
@@ -843,7 +843,7 @@ void QGraphicsScenePrivate::setFocusItemHelper(QGraphicsItem *item,
#ifndef QT_NO_ACCESSIBILITY
if (focusItem) {
if (QGraphicsObject *focusObj = focusItem->toGraphicsObject()) {
- QAccessible::updateAccessibility(focusObj, 0, QAccessible::Focus);
+ QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::Focus, focusObj, 0));
}
}
#endif
diff --git a/src/widgets/graphicsview/qgraphicsscene.h b/src/widgets/graphicsview/qgraphicsscene.h
index 4e06a7483e..ee4edb391e 100644
--- a/src/widgets/graphicsview/qgraphicsscene.h
+++ b/src/widgets/graphicsview/qgraphicsscene.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -55,9 +55,8 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
-#if !defined(QT_NO_GRAPHICSVIEW) || (QT_EDITION & QT_MODULE_GRAPHICSVIEW) != QT_MODULE_GRAPHICSVIEW
+#if !defined(QT_NO_GRAPHICSVIEW)
template<typename T> class QList;
class QFocusEvent;
diff --git a/src/widgets/graphicsview/qgraphicsscene_bsp.cpp b/src/widgets/graphicsview/qgraphicsscene_bsp.cpp
index 8b35fb0022..8b9ae4c5d9 100644
--- a/src/widgets/graphicsview/qgraphicsscene_bsp.cpp
+++ b/src/widgets/graphicsview/qgraphicsscene_bsp.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/graphicsview/qgraphicsscene_bsp_p.h b/src/widgets/graphicsview/qgraphicsscene_bsp_p.h
index d371ba5f66..9071e4b93b 100644
--- a/src/widgets/graphicsview/qgraphicsscene_bsp_p.h
+++ b/src/widgets/graphicsview/qgraphicsscene_bsp_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -55,7 +55,7 @@
#include <QtCore/qlist.h>
-#if !defined(QT_NO_GRAPHICSVIEW) || (QT_EDITION & QT_MODULE_GRAPHICSVIEW) != QT_MODULE_GRAPHICSVIEW
+#if !defined(QT_NO_GRAPHICSVIEW)
#include <QtCore/qrect.h>
#include <QtCore/qset.h>
diff --git a/src/widgets/graphicsview/qgraphicsscene_p.h b/src/widgets/graphicsview/qgraphicsscene_p.h
index a693c0c309..b0410e38ce 100644
--- a/src/widgets/graphicsview/qgraphicsscene_p.h
+++ b/src/widgets/graphicsview/qgraphicsscene_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -55,7 +55,7 @@
#include "qgraphicsscene.h"
-#if !defined(QT_NO_GRAPHICSVIEW) || (QT_EDITION & QT_MODULE_GRAPHICSVIEW) != QT_MODULE_GRAPHICSVIEW
+#if !defined(QT_NO_GRAPHICSVIEW)
#include "qgraphicssceneevent.h"
#include "qgraphicsview.h"
diff --git a/src/widgets/graphicsview/qgraphicsscenebsptreeindex.cpp b/src/widgets/graphicsview/qgraphicsscenebsptreeindex.cpp
index 1c4653d522..2880a8aeaa 100644
--- a/src/widgets/graphicsview/qgraphicsscenebsptreeindex.cpp
+++ b/src/widgets/graphicsview/qgraphicsscenebsptreeindex.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/graphicsview/qgraphicsscenebsptreeindex_p.h b/src/widgets/graphicsview/qgraphicsscenebsptreeindex_p.h
index b3b31fca6a..78b2b2e358 100644
--- a/src/widgets/graphicsview/qgraphicsscenebsptreeindex_p.h
+++ b/src/widgets/graphicsview/qgraphicsscenebsptreeindex_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -55,7 +55,7 @@
#include <QtCore/qglobal.h>
-#if !defined(QT_NO_GRAPHICSVIEW) || (QT_EDITION & QT_MODULE_GRAPHICSVIEW) != QT_MODULE_GRAPHICSVIEW
+#if !defined(QT_NO_GRAPHICSVIEW)
#include "qgraphicssceneindex_p.h"
#include "qgraphicsitem_p.h"
diff --git a/src/widgets/graphicsview/qgraphicssceneevent.cpp b/src/widgets/graphicsview/qgraphicssceneevent.cpp
index ca6ff59bec..91b6fb08da 100644
--- a/src/widgets/graphicsview/qgraphicssceneevent.cpp
+++ b/src/widgets/graphicsview/qgraphicssceneevent.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/graphicsview/qgraphicssceneevent.h b/src/widgets/graphicsview/qgraphicssceneevent.h
index cf88a66e3c..be93c47476 100644
--- a/src/widgets/graphicsview/qgraphicssceneevent.h
+++ b/src/widgets/graphicsview/qgraphicssceneevent.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -54,9 +54,8 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
-#if !defined(QT_NO_GRAPHICSVIEW) || (QT_EDITION & QT_MODULE_GRAPHICSVIEW) != QT_MODULE_GRAPHICSVIEW
+#if !defined(QT_NO_GRAPHICSVIEW)
class QMimeData;
class QPointF;
diff --git a/src/widgets/graphicsview/qgraphicssceneindex.cpp b/src/widgets/graphicsview/qgraphicssceneindex.cpp
index 8fb6c666a0..e296e4da22 100644
--- a/src/widgets/graphicsview/qgraphicssceneindex.cpp
+++ b/src/widgets/graphicsview/qgraphicssceneindex.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/graphicsview/qgraphicssceneindex_p.h b/src/widgets/graphicsview/qgraphicssceneindex_p.h
index eff75e89b1..932c9afd3b 100644
--- a/src/widgets/graphicsview/qgraphicssceneindex_p.h
+++ b/src/widgets/graphicsview/qgraphicssceneindex_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -65,9 +65,8 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
-#if !defined(QT_NO_GRAPHICSVIEW) || (QT_EDITION & QT_MODULE_GRAPHICSVIEW) != QT_MODULE_GRAPHICSVIEW
+#if !defined(QT_NO_GRAPHICSVIEW)
class QGraphicsSceneIndexIntersector;
class QGraphicsSceneIndexPointIntersector;
diff --git a/src/widgets/graphicsview/qgraphicsscenelinearindex.cpp b/src/widgets/graphicsview/qgraphicsscenelinearindex.cpp
index 08fcdaf08d..5ffaac9e33 100644
--- a/src/widgets/graphicsview/qgraphicsscenelinearindex.cpp
+++ b/src/widgets/graphicsview/qgraphicsscenelinearindex.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/graphicsview/qgraphicsscenelinearindex_p.h b/src/widgets/graphicsview/qgraphicsscenelinearindex_p.h
index fdd6a82bda..ec9ab38bb2 100644
--- a/src/widgets/graphicsview/qgraphicsscenelinearindex_p.h
+++ b/src/widgets/graphicsview/qgraphicsscenelinearindex_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -55,7 +55,7 @@
#include <QtCore/qglobal.h>
-#if !defined(QT_NO_GRAPHICSVIEW) || (QT_EDITION & QT_MODULE_GRAPHICSVIEW) != QT_MODULE_GRAPHICSVIEW
+#if !defined(QT_NO_GRAPHICSVIEW)
#include <QtCore/qrect.h>
#include <QtCore/qlist.h>
@@ -66,7 +66,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
class Q_AUTOTEST_EXPORT QGraphicsSceneLinearIndex : public QGraphicsSceneIndex
{
diff --git a/src/widgets/graphicsview/qgraphicstransform.cpp b/src/widgets/graphicsview/qgraphicstransform.cpp
index 33e3a3cc4d..b22e3502ad 100644
--- a/src/widgets/graphicsview/qgraphicstransform.cpp
+++ b/src/widgets/graphicsview/qgraphicstransform.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtDeclarative module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/graphicsview/qgraphicstransform.h b/src/widgets/graphicsview/qgraphicstransform.h
index 8e93a5ee76..b6a8d8aacb 100644
--- a/src/widgets/graphicsview/qgraphicstransform.h
+++ b/src/widgets/graphicsview/qgraphicstransform.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -52,7 +52,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
class QGraphicsItem;
class QGraphicsTransformPrivate;
diff --git a/src/widgets/graphicsview/qgraphicstransform_p.h b/src/widgets/graphicsview/qgraphicstransform_p.h
index 976ffed2c3..ca5575ff10 100644
--- a/src/widgets/graphicsview/qgraphicstransform_p.h
+++ b/src/widgets/graphicsview/qgraphicstransform_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/graphicsview/qgraphicsview.cpp b/src/widgets/graphicsview/qgraphicsview.cpp
index 4c5c586ec9..cabf2eb5a5 100644
--- a/src/widgets/graphicsview/qgraphicsview.cpp
+++ b/src/widgets/graphicsview/qgraphicsview.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/graphicsview/qgraphicsview.h b/src/widgets/graphicsview/qgraphicsview.h
index 2e33548a29..ddc9aea4b0 100644
--- a/src/widgets/graphicsview/qgraphicsview.h
+++ b/src/widgets/graphicsview/qgraphicsview.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -51,9 +51,8 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
-#if !defined(QT_NO_GRAPHICSVIEW) || (QT_EDITION & QT_MODULE_GRAPHICSVIEW) != QT_MODULE_GRAPHICSVIEW
+#if !defined(QT_NO_GRAPHICSVIEW)
class QGraphicsItem;
class QPainterPath;
diff --git a/src/widgets/graphicsview/qgraphicsview_p.h b/src/widgets/graphicsview/qgraphicsview_p.h
index c8b36bc89f..9475ae5bc9 100644
--- a/src/widgets/graphicsview/qgraphicsview_p.h
+++ b/src/widgets/graphicsview/qgraphicsview_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -55,7 +55,7 @@
#include "qgraphicsview.h"
-#if !defined(QT_NO_GRAPHICSVIEW) || (QT_EDITION & QT_MODULE_GRAPHICSVIEW) != QT_MODULE_GRAPHICSVIEW
+#if !defined(QT_NO_GRAPHICSVIEW)
#include <QtGui/qevent.h>
#include <QtCore/qcoreapplication.h>
diff --git a/src/widgets/graphicsview/qgraphicswidget.cpp b/src/widgets/graphicsview/qgraphicswidget.cpp
index c415c704bc..c179aeff2b 100644
--- a/src/widgets/graphicsview/qgraphicswidget.cpp
+++ b/src/widgets/graphicsview/qgraphicswidget.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/graphicsview/qgraphicswidget.h b/src/widgets/graphicsview/qgraphicswidget.h
index b469b64acd..e0bb591231 100644
--- a/src/widgets/graphicsview/qgraphicswidget.h
+++ b/src/widgets/graphicsview/qgraphicswidget.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -51,7 +51,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
class QFont;
class QFontMetrics;
@@ -62,7 +61,7 @@ class QGraphicsSceneResizeEvent;
class QStyle;
class QStyleOption;
-#if !defined(QT_NO_GRAPHICSVIEW) || (QT_EDITION & QT_MODULE_GRAPHICSVIEW) != QT_MODULE_GRAPHICSVIEW
+#if !defined(QT_NO_GRAPHICSVIEW)
class QGraphicsWidgetPrivate;
@@ -212,17 +211,13 @@ protected:
virtual bool focusNextPrevChild(bool next);
void focusOutEvent(QFocusEvent *event);
virtual void hideEvent(QHideEvent *event);
- //virtual bool macEvent(EventHandlerCallRef caller, EventRef event);
//virtual int metric(PaintDeviceMetric m ) const;
virtual void moveEvent(QGraphicsSceneMoveEvent *event);
virtual void polishEvent();
- //virtual bool qwsEvent(QWSEvent *event);
//void resetInputContext ();
virtual void resizeEvent(QGraphicsSceneResizeEvent *event);
virtual void showEvent(QShowEvent *event);
//virtual void tabletEvent(QTabletEvent *event);
- //virtual bool winEvent(MSG *message, long *result);
- //virtual bool x11Event(XEvent *event);
virtual void hoverMoveEvent(QGraphicsSceneHoverEvent *event);
virtual void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
virtual void grabMouseEvent(QEvent *event);
diff --git a/src/widgets/graphicsview/qgraphicswidget_p.cpp b/src/widgets/graphicsview/qgraphicswidget_p.cpp
index 40333fd1b5..ee03f093c7 100644
--- a/src/widgets/graphicsview/qgraphicswidget_p.cpp
+++ b/src/widgets/graphicsview/qgraphicswidget_p.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/graphicsview/qgraphicswidget_p.h b/src/widgets/graphicsview/qgraphicswidget_p.h
index 99f5661b98..cdb9067b02 100644
--- a/src/widgets/graphicsview/qgraphicswidget_p.h
+++ b/src/widgets/graphicsview/qgraphicswidget_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -66,7 +66,7 @@ QT_BEGIN_NAMESPACE
class QGraphicsLayout;
class QStyleOptionTitleBar;
-#if !defined(QT_NO_GRAPHICSVIEW) || (QT_EDITION & QT_MODULE_GRAPHICSVIEW) != QT_MODULE_GRAPHICSVIEW
+#if !defined(QT_NO_GRAPHICSVIEW)
class QGraphicsWidgetPrivate : public QGraphicsItemPrivate
{
@@ -218,7 +218,7 @@ public:
#endif
};
-#endif //!defined(QT_NO_GRAPHICSVIEW) || (QT_EDITION & QT_MODULE_GRAPHICSVIEW) != QT_MODULE_GRAPHICSVIEW
+#endif
QT_END_NAMESPACE
diff --git a/src/widgets/graphicsview/qgridlayoutengine.cpp b/src/widgets/graphicsview/qgridlayoutengine.cpp
index d5eeea68f2..b981ed651a 100644
--- a/src/widgets/graphicsview/qgridlayoutengine.cpp
+++ b/src/widgets/graphicsview/qgridlayoutengine.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/graphicsview/qgridlayoutengine_p.h b/src/widgets/graphicsview/qgridlayoutengine_p.h
index f8ef75ab12..94ed85c320 100644
--- a/src/widgets/graphicsview/qgridlayoutengine_p.h
+++ b/src/widgets/graphicsview/qgridlayoutengine_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/graphicsview/qsimplex_p.cpp b/src/widgets/graphicsview/qsimplex_p.cpp
index 0a1472a384..f5816e2d3c 100644
--- a/src/widgets/graphicsview/qsimplex_p.cpp
+++ b/src/widgets/graphicsview/qsimplex_p.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/graphicsview/qsimplex_p.h b/src/widgets/graphicsview/qsimplex_p.h
index 82f65bac01..00ed0b9957 100644
--- a/src/widgets/graphicsview/qsimplex_p.h
+++ b/src/widgets/graphicsview/qsimplex_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/itemviews/qabstractitemdelegate.cpp b/src/widgets/itemviews/qabstractitemdelegate.cpp
index 5e000b4d70..6184a5845a 100644
--- a/src/widgets/itemviews/qabstractitemdelegate.cpp
+++ b/src/widgets/itemviews/qabstractitemdelegate.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -232,7 +232,7 @@ QAbstractItemDelegate::~QAbstractItemDelegate()
editor paints its own background (e.g., with
\l{QWidget::}{setAutoFillBackground()}).
- \sa setModelData() setEditorData()
+ \sa destroyEditor() setModelData() setEditorData()
*/
QWidget *QAbstractItemDelegate::createEditor(QWidget *,
const QStyleOptionViewItem &,
@@ -241,6 +241,19 @@ QWidget *QAbstractItemDelegate::createEditor(QWidget *,
return 0;
}
+
+/*!
+ A function called when the editor is no longer needed and should be
+ destroyed. The default behavior is a call to deleteLater on the editor.
+ It possible e.g. to avoid this delete by reimplementing this function.
+
+ \sa createEditor()
+*/
+void QAbstractItemDelegate::destroyEditor(QWidget *editor, const QModelIndex &) const
+{
+ editor->deleteLater();
+}
+
/*!
Sets the contents of the given \a editor to the data for the item
at the given \a index. Note that the index contains information
diff --git a/src/widgets/itemviews/qabstractitemdelegate.h b/src/widgets/itemviews/qabstractitemdelegate.h
index 315feda69e..2c51dfcac8 100644
--- a/src/widgets/itemviews/qabstractitemdelegate.h
+++ b/src/widgets/itemviews/qabstractitemdelegate.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -49,7 +49,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
#ifndef QT_NO_ITEMVIEWS
@@ -89,6 +88,8 @@ public:
const QStyleOptionViewItem &option,
const QModelIndex &index) const;
+ virtual void destroyEditor(QWidget *editor, const QModelIndex &index) const;
+
virtual void setEditorData(QWidget *editor, const QModelIndex &index) const;
virtual void setModelData(QWidget *editor,
diff --git a/src/widgets/itemviews/qabstractitemview.cpp b/src/widgets/itemviews/qabstractitemview.cpp
index f4a45fb22e..ff3de308e5 100644
--- a/src/widgets/itemviews/qabstractitemview.cpp
+++ b/src/widgets/itemviews/qabstractitemview.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -1098,7 +1098,7 @@ void QAbstractItemView::reset()
d->delayedReset.stop(); //make sure we stop the timer
foreach (const QEditorInfo &info, d->indexEditorHash) {
if (info.widget)
- d->releaseEditor(info.widget.data());
+ d->releaseEditor(info.widget.data(), d->indexForEditor(info.widget.data()));
}
d->editorIndexHash.clear();
d->indexEditorHash.clear();
@@ -1112,7 +1112,7 @@ void QAbstractItemView::reset()
#ifdef Q_WS_X11
if (QAccessible::isActive()) {
QAccessible::queryAccessibleInterface(this)->table2Interface()->modelReset();
- QAccessible::updateAccessibility(this, 0, QAccessible::TableModelChanged);
+ QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::TableModelChanged, this, 0));
}
#endif
#endif
@@ -2778,7 +2778,7 @@ void QAbstractItemView::closeEditor(QWidget *editor, QAbstractItemDelegate::EndE
editor = ed;
if (!isPersistent && editor)
- d->releaseEditor(editor);
+ d->releaseEditor(editor, index);
}
// The EndEditHint part
@@ -3102,7 +3102,7 @@ void QAbstractItemView::closePersistentEditor(const QModelIndex &index)
closeEditor(editor, QAbstractItemDelegate::RevertModelCache);
d->persistent.remove(editor);
d->removeEditor(editor);
- d->releaseEditor(editor);
+ d->releaseEditor(editor, index);
}
}
@@ -3314,7 +3314,7 @@ void QAbstractItemView::rowsAboutToBeRemoved(const QModelIndex &parent, int star
QEditorInfo info = d->indexEditorHash.take(index);
i = d->editorIndexHash.erase(i);
if (info.widget)
- d->releaseEditor(editor);
+ d->releaseEditor(editor, index);
} else {
++i;
}
@@ -3342,7 +3342,7 @@ void QAbstractItemViewPrivate::_q_rowsRemoved(const QModelIndex &index, int star
#ifdef Q_WS_X11
if (QAccessible::isActive()) {
QAccessible::queryAccessibleInterface(q)->table2Interface()->rowsRemoved(index, start, end);
- QAccessible::updateAccessibility(q, 0, QAccessible::TableModelChanged);
+ QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::TableModelChanged, q, 0));
}
#endif
#endif
@@ -3393,7 +3393,7 @@ void QAbstractItemViewPrivate::_q_columnsAboutToBeRemoved(const QModelIndex &par
QEditorInfo info = indexEditorHash.take(it.value());
it = editorIndexHash.erase(it);
if (info.widget)
- releaseEditor(editor);
+ releaseEditor(editor, index);
} else {
++it;
}
@@ -3422,7 +3422,7 @@ void QAbstractItemViewPrivate::_q_columnsRemoved(const QModelIndex &index, int s
#ifdef Q_WS_X11
if (QAccessible::isActive()) {
QAccessible::queryAccessibleInterface(q)->table2Interface()->columnsRemoved(index, start, end);
- QAccessible::updateAccessibility(q, 0, QAccessible::TableModelChanged);
+ QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::TableModelChanged, q, 0));
}
#endif
#endif
@@ -3445,7 +3445,7 @@ void QAbstractItemViewPrivate::_q_rowsInserted(const QModelIndex &index, int sta
Q_Q(QAbstractItemView);
if (QAccessible::isActive()) {
QAccessible::queryAccessibleInterface(q)->table2Interface()->rowsInserted(index, start, end);
- QAccessible::updateAccessibility(q, 0, QAccessible::TableModelChanged);
+ QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::TableModelChanged, q, 0));
}
#endif
#endif
@@ -3469,7 +3469,7 @@ void QAbstractItemViewPrivate::_q_columnsInserted(const QModelIndex &index, int
#ifdef Q_WS_X11
if (QAccessible::isActive()) {
QAccessible::queryAccessibleInterface(q)->table2Interface()->columnsInserted(index, start, end);
- QAccessible::updateAccessibility(q, 0, QAccessible::TableModelChanged);
+ QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::TableModelChanged, q, 0));
}
#endif
#endif
@@ -3497,7 +3497,7 @@ void QAbstractItemViewPrivate::_q_layoutChanged()
Q_Q(QAbstractItemView);
if (QAccessible::isActive()) {
QAccessible::queryAccessibleInterface(q)->table2Interface()->modelReset();
- QAccessible::updateAccessibility(q, 0, QAccessible::TableModelChanged);
+ QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::TableModelChanged, q, 0));
}
#endif
#endif
@@ -3608,38 +3608,37 @@ void QAbstractItemView::startDrag(Qt::DropActions supportedActions)
QStyleOptionViewItem QAbstractItemView::viewOptions() const
{
Q_D(const QAbstractItemView);
- QStyleOptionViewItem option;
- option.init(this);
+ return d->viewOptionsV4();
+}
+
+QStyleOptionViewItemV4 QAbstractItemViewPrivate::viewOptionsV4() const
+{
+ Q_Q(const QAbstractItemView);
+ QStyleOptionViewItemV4 option;
+ option.init(q);
option.state &= ~QStyle::State_MouseOver;
- option.font = font();
+ option.font = q->font();
#ifndef Q_WS_MAC
// On mac the focus appearance follows window activation
// not widget activation
- if (!hasFocus())
+ if (!q->hasFocus())
option.state &= ~QStyle::State_Active;
#endif
option.state &= ~QStyle::State_HasFocus;
- if (d->iconSize.isValid()) {
- option.decorationSize = d->iconSize;
+ if (iconSize.isValid()) {
+ option.decorationSize = iconSize;
} else {
- int pm = style()->pixelMetric(QStyle::PM_SmallIconSize, 0, this);
+ int pm = q->style()->pixelMetric(QStyle::PM_SmallIconSize, 0, q);
option.decorationSize = QSize(pm, pm);
}
option.decorationPosition = QStyleOptionViewItem::Left;
option.decorationAlignment = Qt::AlignCenter;
option.displayAlignment = Qt::AlignLeft|Qt::AlignVCenter;
- option.textElideMode = d->textElideMode;
+ option.textElideMode = textElideMode;
option.rect = QRect();
- option.showDecorationSelected = style()->styleHint(QStyle::SH_ItemView_ShowDecorationSelected, 0, this);
- return option;
-}
-
-QStyleOptionViewItemV4 QAbstractItemViewPrivate::viewOptionsV4() const
-{
- Q_Q(const QAbstractItemView);
- QStyleOptionViewItemV4 option = q->viewOptions();
+ option.showDecorationSelected = q->style()->styleHint(QStyle::SH_ItemView_ShowDecorationSelected, 0, q);
if (wrapItemText)
option.features = QStyleOptionViewItemV2::WrapText;
option.locale = q->locale();
diff --git a/src/widgets/itemviews/qabstractitemview.h b/src/widgets/itemviews/qabstractitemview.h
index 5ab41bae23..5bdd17e3ad 100644
--- a/src/widgets/itemviews/qabstractitemview.h
+++ b/src/widgets/itemviews/qabstractitemview.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -51,7 +51,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
#ifndef QT_NO_ITEMVIEWS
@@ -368,7 +367,7 @@ private:
friend class QTreeViewPrivate; // needed to compile with MSVC
friend class QListModeViewBase;
- friend class QListViewPrivate; // needed to compile for Symbian emulator
+ friend class QListViewPrivate;
};
Q_DECLARE_OPERATORS_FOR_FLAGS(QAbstractItemView::EditTriggers)
diff --git a/src/widgets/itemviews/qabstractitemview_p.h b/src/widgets/itemviews/qabstractitemview_p.h
index 801bb82d85..3826f3b4e9 100644
--- a/src/widgets/itemviews/qabstractitemview_p.h
+++ b/src/widgets/itemviews/qabstractitemview_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -200,13 +200,18 @@ public:
// reimplemented in subclasses
virtual void adjustViewOptionsForIndex(QStyleOptionViewItemV4*, const QModelIndex&) const {}
- inline void releaseEditor(QWidget *editor) const {
+ inline void releaseEditor(QWidget *editor, const QModelIndex &index = QModelIndex()) const {
if (editor) {
QObject::disconnect(editor, SIGNAL(destroyed(QObject*)),
q_func(), SLOT(editorDestroyed(QObject*)));
editor->removeEventFilter(itemDelegate);
editor->hide();
- editor->deleteLater();
+ QAbstractItemDelegate *delegate = delegateForIndex(index);
+
+ if (delegate)
+ delegate->destroyEditor(editor, index);
+ else
+ editor->deleteLater();
}
}
diff --git a/src/widgets/itemviews/qbsptree.cpp b/src/widgets/itemviews/qbsptree.cpp
index a049b9d095..40cf6e4a99 100644
--- a/src/widgets/itemviews/qbsptree.cpp
+++ b/src/widgets/itemviews/qbsptree.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/itemviews/qbsptree_p.h b/src/widgets/itemviews/qbsptree_p.h
index d7404010d1..1c16dab056 100644
--- a/src/widgets/itemviews/qbsptree_p.h
+++ b/src/widgets/itemviews/qbsptree_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/itemviews/qcolumnview.cpp b/src/widgets/itemviews/qcolumnview.cpp
index 8b4db02961..5dec62acc2 100644
--- a/src/widgets/itemviews/qcolumnview.cpp
+++ b/src/widgets/itemviews/qcolumnview.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/itemviews/qcolumnview.h b/src/widgets/itemviews/qcolumnview.h
index ac734c131d..1bc3a5e265 100644
--- a/src/widgets/itemviews/qcolumnview.h
+++ b/src/widgets/itemviews/qcolumnview.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -48,7 +48,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
#ifndef QT_NO_COLUMNVIEW
diff --git a/src/widgets/itemviews/qcolumnview_p.h b/src/widgets/itemviews/qcolumnview_p.h
index ce1275e220..5bdb74c56c 100644
--- a/src/widgets/itemviews/qcolumnview_p.h
+++ b/src/widgets/itemviews/qcolumnview_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/itemviews/qcolumnviewgrip.cpp b/src/widgets/itemviews/qcolumnviewgrip.cpp
index ce25fdac03..340c2e333a 100644
--- a/src/widgets/itemviews/qcolumnviewgrip.cpp
+++ b/src/widgets/itemviews/qcolumnviewgrip.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/itemviews/qcolumnviewgrip_p.h b/src/widgets/itemviews/qcolumnviewgrip_p.h
index 2991f070eb..e842b3e2ff 100644
--- a/src/widgets/itemviews/qcolumnviewgrip_p.h
+++ b/src/widgets/itemviews/qcolumnviewgrip_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/itemviews/qdatawidgetmapper.cpp b/src/widgets/itemviews/qdatawidgetmapper.cpp
index 34699039c4..e4eca4287b 100644
--- a/src/widgets/itemviews/qdatawidgetmapper.cpp
+++ b/src/widgets/itemviews/qdatawidgetmapper.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/itemviews/qdatawidgetmapper.h b/src/widgets/itemviews/qdatawidgetmapper.h
index 5ffb666fbd..e73d4b1044 100644
--- a/src/widgets/itemviews/qdatawidgetmapper.h
+++ b/src/widgets/itemviews/qdatawidgetmapper.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -50,7 +50,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
class QAbstractItemDelegate;
class QAbstractItemModel;
diff --git a/src/widgets/itemviews/qdirmodel.cpp b/src/widgets/itemviews/qdirmodel.cpp
index aa74f604e5..67a16a836d 100644
--- a/src/widgets/itemviews/qdirmodel.cpp
+++ b/src/widgets/itemviews/qdirmodel.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -854,10 +854,8 @@ QModelIndex QDirModel::index(const QString &path, int column) const
return QModelIndex();
QString absolutePath = QDir(path).absolutePath();
-#if (defined(Q_OS_WIN) && !defined(Q_OS_WINCE)) || defined(Q_OS_SYMBIAN)
- absolutePath = absolutePath.toLower();
-#endif
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
+ absolutePath = absolutePath.toLower();
// On Windows, "filename......." and "filename" are equivalent
if (absolutePath.endsWith(QLatin1Char('.'))) {
int i;
@@ -899,7 +897,7 @@ QModelIndex QDirModel::index(const QString &path, int column) const
emit const_cast<QDirModel*>(this)->layoutChanged();
} else
#endif
-#if (defined(Q_OS_WIN) && !defined(Q_OS_WINCE)) || defined(Q_OS_SYMBIAN)
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
if (pathElements.at(0).endsWith(QLatin1Char(':'))) {
pathElements[0] += QLatin1Char('/');
}
@@ -923,7 +921,7 @@ QModelIndex QDirModel::index(const QString &path, int column) const
const QFileInfo& fi = parent->children.at(j).info;
QString childFileName;
childFileName = idx.isValid() ? fi.fileName() : fi.absoluteFilePath();
-#if (defined(Q_OS_WIN) && !defined(Q_OS_WINCE)) || defined(Q_OS_SYMBIAN)
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
childFileName = childFileName.toLower();
#endif
if (childFileName == element) {
@@ -1299,8 +1297,6 @@ QString QDirModelPrivate::name(const QModelIndex &index) const
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
if (name.startsWith(QLatin1Char('/'))) // UNC host
return info.fileName();
-#endif
-#if (defined(Q_OS_WIN) && !defined(Q_OS_WINCE)) || defined(Q_OS_SYMBIAN)
if (name.endsWith(QLatin1Char('/')))
name.chop(1);
#endif
diff --git a/src/widgets/itemviews/qdirmodel.h b/src/widgets/itemviews/qdirmodel.h
index ee6ec3f4aa..de016112c6 100644
--- a/src/widgets/itemviews/qdirmodel.h
+++ b/src/widgets/itemviews/qdirmodel.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -50,7 +50,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
#ifndef QT_NO_DIRMODEL
diff --git a/src/widgets/itemviews/qfileiconprovider.cpp b/src/widgets/itemviews/qfileiconprovider.cpp
index a085f37d6c..dd52aebea5 100644
--- a/src/widgets/itemviews/qfileiconprovider.cpp
+++ b/src/widgets/itemviews/qfileiconprovider.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -46,21 +46,19 @@
#include <qapplication.h>
#include <qdir.h>
#include <qpixmapcache.h>
+#include <private/qfunctions_p.h>
+#include <private/qguiplatformplugin_p.h>
+
#if defined(Q_OS_WIN)
# define _WIN32_IE 0x0500
# include <qt_windows.h>
# include <commctrl.h>
# include <objbase.h>
-Q_GUI_EXPORT QPixmap qt_pixmapFromWinHICON(HICON icon);
-
#elif defined(Q_WS_MAC)
# include <private/qt_cocoa_helpers_mac_p.h>
#endif
-#include <private/qfunctions_p.h>
-#include <private/qguiplatformplugin_p.h>
-
#if defined(Q_WS_X11) && !defined(Q_NO_STYLE_GTK)
# include <private/qgtkstyle_p.h>
# include <private/qt_x11_p.h>
@@ -73,6 +71,10 @@ Q_GUI_EXPORT QPixmap qt_pixmapFromWinHICON(HICON icon);
QT_BEGIN_NAMESPACE
+#if defined (Q_OS_WIN)
+Q_GUI_EXPORT QPixmap qt_pixmapFromWinHICON(HICON icon);
+#endif
+
/*!
\class QFileIconProvider
diff --git a/src/widgets/itemviews/qfileiconprovider.h b/src/widgets/itemviews/qfileiconprovider.h
index 2b90e800a9..85cbf32abc 100644
--- a/src/widgets/itemviews/qfileiconprovider.h
+++ b/src/widgets/itemviews/qfileiconprovider.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -50,7 +50,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
#ifndef QT_NO_FILEICONPROVIDER
diff --git a/src/widgets/itemviews/qheaderview.cpp b/src/widgets/itemviews/qheaderview.cpp
index c9bc3423b0..33c8da4f69 100644
--- a/src/widgets/itemviews/qheaderview.cpp
+++ b/src/widgets/itemviews/qheaderview.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -481,15 +481,17 @@ void QHeaderView::setOffset(int newOffset)
/*!
\since 4.2
- Sets the offset to the start of the section at the given \a visualIndex.
+ Sets the offset to the start of the section at the given \a visualSectionNumber.
+ \a visualSectionNumber is the actual visible section when hiddenSections are
+ not considered. That is not always the same as \a visualIndex.
\sa setOffset(), sectionPosition()
*/
-void QHeaderView::setOffsetToSectionPosition(int visualIndex)
+void QHeaderView::setOffsetToSectionPosition(int visualSectionNumber)
{
Q_D(QHeaderView);
- if (visualIndex > -1 && visualIndex < d->sectionCount) {
- int position = d->headerSectionPosition(d->adjustedVisualIndex(visualIndex));
+ if (visualSectionNumber > -1 && visualSectionNumber < d->sectionCount) {
+ int position = d->headerSectionPosition(d->adjustedVisualIndex(visualSectionNumber));
setOffset(position);
}
}
@@ -517,6 +519,8 @@ void QHeaderView::setOffsetToLastSection()
int QHeaderView::length() const
{
Q_D(const QHeaderView);
+ d->executePostedLayout();
+ d->executePostedResize();
//Q_ASSERT(d->headerLength() == d->length);
return d->length;
}
@@ -870,7 +874,7 @@ void QHeaderView::swapSections(int first, int second)
void QHeaderView::resizeSection(int logical, int size)
{
Q_D(QHeaderView);
- if (logical < 0 || logical >= count())
+ if (logical < 0 || logical >= count() || size < 0)
return;
if (isSectionHidden(logical)) {
@@ -895,6 +899,8 @@ void QHeaderView::resizeSection(int logical, int size)
d->createSectionSpan(visual, visual, size, d->headerSectionResizeMode(visual));
if (!updatesEnabled()) {
+ if (d->hasAutoResizeSections())
+ d->doDelayedResizeSections();
emit sectionResized(logical, oldSize, size);
return;
}
@@ -1934,7 +1940,7 @@ void QHeaderView::initializeSections(int start, int end)
if (end + 1 < d->sectionCount) {
int newCount = end + 1;
- d->removeSectionsFromSpans(newCount, d->sectionCount);
+ d->removeSectionsFromSpans(newCount, d->sectionCount - 1);
if (!d->hiddenSectionSize.isEmpty()) {
if (d->sectionCount - newCount > d->hiddenSectionSize.count()) {
for (int i = end + 1; i < d->sectionCount; ++i)
diff --git a/src/widgets/itemviews/qheaderview.h b/src/widgets/itemviews/qheaderview.h
index 1ad79a96e1..d72b8cd735 100644
--- a/src/widgets/itemviews/qheaderview.h
+++ b/src/widgets/itemviews/qheaderview.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -48,7 +48,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
#ifndef QT_NO_ITEMVIEWS
diff --git a/src/widgets/itemviews/qheaderview_p.h b/src/widgets/itemviews/qheaderview_p.h
index 923ab36f72..e26c4a6475 100644
--- a/src/widgets/itemviews/qheaderview_p.h
+++ b/src/widgets/itemviews/qheaderview_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/itemviews/qitemdelegate.cpp b/src/widgets/itemviews/qitemdelegate.cpp
index e130953c38..a5351301a7 100644
--- a/src/widgets/itemviews/qitemdelegate.cpp
+++ b/src/widgets/itemviews/qitemdelegate.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -527,11 +527,10 @@ QWidget *QItemDelegate::createEditor(QWidget *parent,
Q_D(const QItemDelegate);
if (!index.isValid())
return 0;
- QVariant::Type t = static_cast<QVariant::Type>(index.data(Qt::EditRole).userType());
const QItemEditorFactory *factory = d->f;
if (factory == 0)
factory = QItemEditorFactory::defaultFactory();
- return factory->createEditor(t, parent);
+ return factory->createEditor(index.data(Qt::EditRole).userType(), parent);
}
/*!
@@ -568,7 +567,7 @@ void QItemDelegate::setEditorData(QWidget *editor, const QModelIndex &index) con
// ### Qt 5: give QComboBox a USER property
if (n.isEmpty() && editor->inherits("QComboBox"))
- n = d->editorFactory()->valuePropertyName(static_cast<QVariant::Type>(v.userType()));
+ n = d->editorFactory()->valuePropertyName(v.userType());
if (!n.isEmpty()) {
if (!v.isValid())
v = QVariant(editor->property(n).userType(), (const void *)0);
@@ -603,7 +602,7 @@ void QItemDelegate::setModelData(QWidget *editor,
QByteArray n = editor->metaObject()->userProperty().name();
if (n.isEmpty())
n = d->editorFactory()->valuePropertyName(
- static_cast<QVariant::Type>(model->data(index, Qt::EditRole).userType()));
+ model->data(index, Qt::EditRole).userType());
if (!n.isEmpty())
model->setData(index, editor->property(n), Qt::EditRole);
#endif
diff --git a/src/widgets/itemviews/qitemdelegate.h b/src/widgets/itemviews/qitemdelegate.h
index 5ea6b33f2d..86377c0a4c 100644
--- a/src/widgets/itemviews/qitemdelegate.h
+++ b/src/widgets/itemviews/qitemdelegate.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -51,7 +51,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
#ifndef QT_NO_ITEMVIEWS
diff --git a/src/widgets/itemviews/qitemeditorfactory.cpp b/src/widgets/itemviews/qitemeditorfactory.cpp
index 506ca79702..468929a554 100644
--- a/src/widgets/itemviews/qitemeditorfactory.cpp
+++ b/src/widgets/itemviews/qitemeditorfactory.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -126,30 +126,30 @@ public:
*/
/*!
- Creates an editor widget with the given \a parent for the specified \a type of data,
+ Creates an editor widget with the given \a parent for the specified \a userType of data,
and returns it as a QWidget.
\sa registerEditor()
*/
-QWidget *QItemEditorFactory::createEditor(QVariant::Type type, QWidget *parent) const
+QWidget *QItemEditorFactory::createEditor(int userType, QWidget *parent) const
{
- QItemEditorCreatorBase *creator = creatorMap.value(type, 0);
+ QItemEditorCreatorBase *creator = creatorMap.value(userType, 0);
if (!creator) {
const QItemEditorFactory *dfactory = defaultFactory();
- return dfactory == this ? 0 : dfactory->createEditor(type, parent);
+ return dfactory == this ? 0 : dfactory->createEditor(userType, parent);
}
return creator->createWidget(parent);
}
/*!
- Returns the property name used to access data for the given \a type of data.
+ Returns the property name used to access data for the given \a userType of data.
*/
-QByteArray QItemEditorFactory::valuePropertyName(QVariant::Type type) const
+QByteArray QItemEditorFactory::valuePropertyName(int userType) const
{
- QItemEditorCreatorBase *creator = creatorMap.value(type, 0);
+ QItemEditorCreatorBase *creator = creatorMap.value(userType, 0);
if (!creator) {
const QItemEditorFactory *dfactory = defaultFactory();
- return dfactory == this ? QByteArray() : dfactory->valuePropertyName(type);
+ return dfactory == this ? QByteArray() : dfactory->valuePropertyName(userType);
}
return creator->valuePropertyName();
}
@@ -166,16 +166,16 @@ QItemEditorFactory::~QItemEditorFactory()
}
/*!
- Registers an item editor creator specified by \a creator for the given \a type of data.
+ Registers an item editor creator specified by \a creator for the given \a userType of data.
\bold{Note:} The factory takes ownership of the item editor creator and will destroy
it if a new creator for the same type is registered later.
\sa createEditor()
*/
-void QItemEditorFactory::registerEditor(QVariant::Type type, QItemEditorCreatorBase *creator)
+void QItemEditorFactory::registerEditor(int userType, QItemEditorCreatorBase *creator)
{
- QHash<QVariant::Type, QItemEditorCreatorBase *>::iterator it = creatorMap.find(type);
+ QHash<int, QItemEditorCreatorBase *>::iterator it = creatorMap.find(userType);
if (it != creatorMap.end()) {
QItemEditorCreatorBase *oldCreator = it.value();
Q_ASSERT(oldCreator);
@@ -184,20 +184,20 @@ void QItemEditorFactory::registerEditor(QVariant::Type type, QItemEditorCreatorB
delete oldCreator; // if it is no more in use we can delete it
}
- creatorMap[type] = creator;
+ creatorMap[userType] = creator;
}
class QDefaultItemEditorFactory : public QItemEditorFactory
{
public:
inline QDefaultItemEditorFactory() {}
- QWidget *createEditor(QVariant::Type type, QWidget *parent) const;
- QByteArray valuePropertyName(QVariant::Type) const;
+ QWidget *createEditor(int userType, QWidget *parent) const;
+ QByteArray valuePropertyName(int) const;
};
-QWidget *QDefaultItemEditorFactory::createEditor(QVariant::Type type, QWidget *parent) const
+QWidget *QDefaultItemEditorFactory::createEditor(int userType, QWidget *parent) const
{
- switch (type) {
+ switch (userType) {
#ifndef QT_NO_COMBOBOX
case QVariant::Bool: {
QBooleanComboBox *cb = new QBooleanComboBox(parent);
@@ -258,9 +258,9 @@ QWidget *QDefaultItemEditorFactory::createEditor(QVariant::Type type, QWidget *p
return 0;
}
-QByteArray QDefaultItemEditorFactory::valuePropertyName(QVariant::Type type) const
+QByteArray QDefaultItemEditorFactory::valuePropertyName(int userType) const
{
- switch (type) {
+ switch (userType) {
#ifndef QT_NO_COMBOBOX
case QVariant::Bool:
return "currentIndex";
diff --git a/src/widgets/itemviews/qitemeditorfactory.h b/src/widgets/itemviews/qitemeditorfactory.h
index 3d3359dc1a..aff8de3a4c 100644
--- a/src/widgets/itemviews/qitemeditorfactory.h
+++ b/src/widgets/itemviews/qitemeditorfactory.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -51,7 +51,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
#ifndef QT_NO_ITEMVIEWS
@@ -103,16 +102,16 @@ public:
inline QItemEditorFactory() {}
virtual ~QItemEditorFactory();
- virtual QWidget *createEditor(QVariant::Type type, QWidget *parent) const;
- virtual QByteArray valuePropertyName(QVariant::Type type) const;
+ virtual QWidget *createEditor(int userType, QWidget *parent) const;
+ virtual QByteArray valuePropertyName(int userType) const;
- void registerEditor(QVariant::Type type, QItemEditorCreatorBase *creator);
+ void registerEditor(int userType, QItemEditorCreatorBase *creator);
static const QItemEditorFactory *defaultFactory();
static void setDefaultFactory(QItemEditorFactory *factory);
private:
- QHash<QVariant::Type, QItemEditorCreatorBase *> creatorMap;
+ QHash<int, QItemEditorCreatorBase *> creatorMap;
};
#endif // QT_NO_ITEMVIEWS
diff --git a/src/widgets/itemviews/qitemeditorfactory_p.h b/src/widgets/itemviews/qitemeditorfactory_p.h
index 613d4e0e81..e2c8530eff 100644
--- a/src/widgets/itemviews/qitemeditorfactory_p.h
+++ b/src/widgets/itemviews/qitemeditorfactory_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/itemviews/qlistview.cpp b/src/widgets/itemviews/qlistview.cpp
index d0b5821c93..8d069a8c7e 100644
--- a/src/widgets/itemviews/qlistview.cpp
+++ b/src/widgets/itemviews/qlistview.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -3169,7 +3169,7 @@ void QListView::currentChanged(const QModelIndex &current, const QModelIndex &pr
if (QAccessible::isActive()) {
if (current.isValid()) {
int entry = visualIndex(current) + 1;
- QAccessible::updateAccessibility(this, entry, QAccessible::Focus);
+ QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::Focus, this, entry));
}
}
#endif
@@ -3188,12 +3188,12 @@ void QListView::selectionChanged(const QItemSelection &selected,
QModelIndex sel = selected.indexes().value(0);
if (sel.isValid()) {
int entry = visualIndex(sel) + 1;
- QAccessible::updateAccessibility(this, entry, QAccessible::Selection);
+ QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::Selection, this, entry));
}
QModelIndex desel = deselected.indexes().value(0);
if (desel.isValid()) {
int entry = visualIndex(desel) + 1;
- QAccessible::updateAccessibility(this, entry, QAccessible::SelectionRemove);
+ QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::SelectionRemove, this, entry));
}
}
#endif
diff --git a/src/widgets/itemviews/qlistview.h b/src/widgets/itemviews/qlistview.h
index f78806fef1..d278dec8c6 100644
--- a/src/widgets/itemviews/qlistview.h
+++ b/src/widgets/itemviews/qlistview.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -48,7 +48,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
#ifndef QT_NO_LISTVIEW
diff --git a/src/widgets/itemviews/qlistview_p.h b/src/widgets/itemviews/qlistview_p.h
index b959e66686..3ba132afd1 100644
--- a/src/widgets/itemviews/qlistview_p.h
+++ b/src/widgets/itemviews/qlistview_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/itemviews/qlistwidget.cpp b/src/widgets/itemviews/qlistwidget.cpp
index d99d63c15f..c8a7c664b0 100644
--- a/src/widgets/itemviews/qlistwidget.cpp
+++ b/src/widgets/itemviews/qlistwidget.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/itemviews/qlistwidget.h b/src/widgets/itemviews/qlistwidget.h
index b119b62046..acd06e9cad 100644
--- a/src/widgets/itemviews/qlistwidget.h
+++ b/src/widgets/itemviews/qlistwidget.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -51,7 +51,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
#ifndef QT_NO_LISTWIDGET
diff --git a/src/widgets/itemviews/qlistwidget_p.h b/src/widgets/itemviews/qlistwidget_p.h
index 9d6b28d813..cde6ed66a4 100644
--- a/src/widgets/itemviews/qlistwidget_p.h
+++ b/src/widgets/itemviews/qlistwidget_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/itemviews/qproxymodel.cpp b/src/widgets/itemviews/qproxymodel.cpp
index 861cb95ca4..c004ccb19a 100644
--- a/src/widgets/itemviews/qproxymodel.cpp
+++ b/src/widgets/itemviews/qproxymodel.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/itemviews/qproxymodel.h b/src/widgets/itemviews/qproxymodel.h
index 870ea7b003..c043573ee9 100644
--- a/src/widgets/itemviews/qproxymodel.h
+++ b/src/widgets/itemviews/qproxymodel.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -48,7 +48,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
#ifndef QT_NO_PROXYMODEL
diff --git a/src/widgets/itemviews/qproxymodel_p.h b/src/widgets/itemviews/qproxymodel_p.h
index 3b73e844dc..fbac2ca613 100644
--- a/src/widgets/itemviews/qproxymodel_p.h
+++ b/src/widgets/itemviews/qproxymodel_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/itemviews/qstandarditemmodel.cpp b/src/widgets/itemviews/qstandarditemmodel.cpp
index 7bfece75ac..112b533f4f 100644
--- a/src/widgets/itemviews/qstandarditemmodel.cpp
+++ b/src/widgets/itemviews/qstandarditemmodel.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -2080,6 +2080,15 @@ QStandardItemModel::~QStandardItemModel()
}
/*!
+ Sets the item role names to \a roleNames.
+*/
+void QStandardItemModel::setItemRoleNames(const QHash<int,QByteArray> &roleNames)
+{
+ Q_D(QStandardItemModel);
+ d->roleNames = roleNames;
+}
+
+/*!
Removes all items (including header items) from the model and sets the
number of rows and columns to zero.
diff --git a/src/widgets/itemviews/qstandarditemmodel.h b/src/widgets/itemviews/qstandarditemmodel.h
index 41047f7ed5..e374665f20 100644
--- a/src/widgets/itemviews/qstandarditemmodel.h
+++ b/src/widgets/itemviews/qstandarditemmodel.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -54,7 +54,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
#ifndef QT_NO_STANDARDITEMMODEL
@@ -325,6 +324,8 @@ public:
QStandardItemModel(int rows, int columns, QObject *parent = 0);
~QStandardItemModel();
+ void setItemRoleNames(const QHash<int,QByteArray> &roleNames);
+
QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
QModelIndex parent(const QModelIndex &child) const;
diff --git a/src/widgets/itemviews/qstandarditemmodel_p.h b/src/widgets/itemviews/qstandarditemmodel_p.h
index 9fcddbe7d1..8278bd195b 100644
--- a/src/widgets/itemviews/qstandarditemmodel_p.h
+++ b/src/widgets/itemviews/qstandarditemmodel_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/itemviews/qstyleditemdelegate.cpp b/src/widgets/itemviews/qstyleditemdelegate.cpp
index bf6cbdb7a4..ca4c684e98 100644
--- a/src/widgets/itemviews/qstyleditemdelegate.cpp
+++ b/src/widgets/itemviews/qstyleditemdelegate.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -468,8 +468,7 @@ QWidget *QStyledItemDelegate::createEditor(QWidget *parent,
Q_D(const QStyledItemDelegate);
if (!index.isValid())
return 0;
- QVariant::Type t = static_cast<QVariant::Type>(index.data(Qt::EditRole).userType());
- return d->editorFactory()->createEditor(t, parent);
+ return d->editorFactory()->createEditor(index.data(Qt::EditRole).userType(), parent);
}
/*!
@@ -505,7 +504,7 @@ void QStyledItemDelegate::setEditorData(QWidget *editor, const QModelIndex &inde
// ### Qt 5: give QComboBox a USER property
if (n.isEmpty() && editor->inherits("QComboBox"))
- n = d->editorFactory()->valuePropertyName(static_cast<QVariant::Type>(v.userType()));
+ n = d->editorFactory()->valuePropertyName(v.userType());
if (!n.isEmpty()) {
if (!v.isValid())
v = QVariant(editor->property(n).userType(), (const void *)0);
@@ -539,7 +538,7 @@ void QStyledItemDelegate::setModelData(QWidget *editor,
QByteArray n = editor->metaObject()->userProperty().name();
if (n.isEmpty())
n = d->editorFactory()->valuePropertyName(
- static_cast<QVariant::Type>(model->data(index, Qt::EditRole).userType()));
+ model->data(index, Qt::EditRole).userType());
if (!n.isEmpty())
model->setData(index, editor->property(n), Qt::EditRole);
#endif
diff --git a/src/widgets/itemviews/qstyleditemdelegate.h b/src/widgets/itemviews/qstyleditemdelegate.h
index 67f7182446..1d9f10ff00 100644
--- a/src/widgets/itemviews/qstyleditemdelegate.h
+++ b/src/widgets/itemviews/qstyleditemdelegate.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -51,7 +51,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
#ifndef QT_NO_ITEMVIEWS
diff --git a/src/widgets/itemviews/qtableview.cpp b/src/widgets/itemviews/qtableview.cpp
index 625a7e353b..7e6420bb53 100644
--- a/src/widgets/itemviews/qtableview.cpp
+++ b/src/widgets/itemviews/qtableview.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -3167,12 +3167,12 @@ void QTableView::currentChanged(const QModelIndex &current, const QModelIndex &p
#ifdef Q_OS_UNIX
Q_D(QTableView);
int entry = d->accessibleTable2Index(current);
- QAccessible::updateAccessibility(this, entry, QAccessible::Focus);
+ QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::Focus, this, entry));
#else
int entry = visualIndex(current) + 1;
if (horizontalHeader())
++entry;
- QAccessible::updateAccessibility(viewport(), entry, QAccessible::Focus);
+ QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::Focus, viewport(), entry));
#endif
}
}
@@ -3195,24 +3195,24 @@ void QTableView::selectionChanged(const QItemSelection &selected,
if (sel.isValid()) {
#ifdef Q_OS_UNIX
int entry = d->accessibleTable2Index(sel);
- QAccessible::updateAccessibility(this, entry, QAccessible::Selection);
+ QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::Selection, this, entry));
#else
int entry = visualIndex(sel);
if (horizontalHeader())
++entry;
- QAccessible::updateAccessibility(viewport(), entry, QAccessible::Selection);
+ QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::Selection, viewport(), entry));
#endif
}
QModelIndex desel = deselected.indexes().value(0);
if (desel.isValid()) {
#ifdef Q_OS_UNIX
int entry = d->accessibleTable2Index(desel);
- QAccessible::updateAccessibility(this, entry, QAccessible::SelectionRemove);
+ QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::SelectionRemove, this, entry));
#else
int entry = visualIndex(sel);
if (horizontalHeader())
++entry;
- QAccessible::updateAccessibility(viewport(), entry, QAccessible::SelectionRemove);
+ QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::SelectionRemove, viewport(), entry));
#endif
}
}
diff --git a/src/widgets/itemviews/qtableview.h b/src/widgets/itemviews/qtableview.h
index d2773c650e..f608d8dede 100644
--- a/src/widgets/itemviews/qtableview.h
+++ b/src/widgets/itemviews/qtableview.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -48,7 +48,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
#ifndef QT_NO_TABLEVIEW
diff --git a/src/widgets/itemviews/qtableview_p.h b/src/widgets/itemviews/qtableview_p.h
index 49ec36f680..13e526f93a 100644
--- a/src/widgets/itemviews/qtableview_p.h
+++ b/src/widgets/itemviews/qtableview_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/itemviews/qtablewidget.cpp b/src/widgets/itemviews/qtablewidget.cpp
index abfba19117..82055ad11e 100644
--- a/src/widgets/itemviews/qtablewidget.cpp
+++ b/src/widgets/itemviews/qtablewidget.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/itemviews/qtablewidget.h b/src/widgets/itemviews/qtablewidget.h
index 37b6d0f530..3d08e204d1 100644
--- a/src/widgets/itemviews/qtablewidget.h
+++ b/src/widgets/itemviews/qtablewidget.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -51,7 +51,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
#ifndef QT_NO_TABLEWIDGET
diff --git a/src/widgets/itemviews/qtablewidget_p.h b/src/widgets/itemviews/qtablewidget_p.h
index 881c4bd8a3..eae992f186 100644
--- a/src/widgets/itemviews/qtablewidget_p.h
+++ b/src/widgets/itemviews/qtablewidget_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/itemviews/qtreeview.cpp b/src/widgets/itemviews/qtreeview.cpp
index 368be3a6c8..179b122805 100644
--- a/src/widgets/itemviews/qtreeview.cpp
+++ b/src/widgets/itemviews/qtreeview.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -2937,7 +2937,7 @@ void QTreeViewPrivate::insertViewItems(int pos, int count, const QTreeViewItem &
#ifndef QT_NO_ACCESSIBILITY
#ifdef Q_OS_UNIX
if (QAccessible::isActive()) {
- QAccessible::updateAccessibility(q, 0, QAccessible::TableModelChanged);
+ QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::TableModelChanged, q, 0));
}
#endif
#endif
@@ -2955,7 +2955,7 @@ void QTreeViewPrivate::removeViewItems(int pos, int count)
#ifndef QT_NO_ACCESSIBILITY
#ifdef Q_OS_UNIX
if (QAccessible::isActive()) {
- QAccessible::updateAccessibility(q, 0, QAccessible::TableModelChanged);
+ QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::TableModelChanged, q, 0));
}
#endif
#endif
@@ -3769,7 +3769,7 @@ void QTreeView::currentChanged(const QModelIndex &current, const QModelIndex &pr
if (QAccessible::isActive() && current.isValid()) {
#ifdef Q_OS_UNIX
int entry = (visualIndex(current) + (header()?1:0))*current.model()->columnCount()+current.column() + 1;
- QAccessible::updateAccessibility(this, entry, QAccessible::Focus);
+ QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::Focus, this, entry));
#else
int entry = visualIndex(current) + 1;
if (header())
@@ -3794,13 +3794,13 @@ void QTreeView::selectionChanged(const QItemSelection &selected,
if (sel.isValid()) {
int entry = (visualIndex(sel) + (header()?1:0))*sel.model()->columnCount()+sel.column() + 1;
Q_ASSERT(entry > 0);
- QAccessible::updateAccessibility(this, entry, QAccessible::Selection);
+ QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::Selection, this, entry));
}
QModelIndex desel = deselected.indexes().value(0);
if (desel.isValid()) {
int entry = (visualIndex(desel) + (header()?1:0))*desel.model()->columnCount()+desel.column() + 1;
Q_ASSERT(entry > 0);
- QAccessible::updateAccessibility(this, entry, QAccessible::SelectionRemove);
+ QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::SelectionRemove, this, entry));
}
}
#endif
diff --git a/src/widgets/itemviews/qtreeview.h b/src/widgets/itemviews/qtreeview.h
index bc68fd413a..72cfe1722d 100644
--- a/src/widgets/itemviews/qtreeview.h
+++ b/src/widgets/itemviews/qtreeview.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -48,7 +48,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
#ifndef QT_NO_TREEVIEW
diff --git a/src/widgets/itemviews/qtreeview_p.h b/src/widgets/itemviews/qtreeview_p.h
index 7f6413d76c..c8fb8853a6 100644
--- a/src/widgets/itemviews/qtreeview_p.h
+++ b/src/widgets/itemviews/qtreeview_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/itemviews/qtreewidget.cpp b/src/widgets/itemviews/qtreewidget.cpp
index 71797b182c..ca8b9c4e09 100644
--- a/src/widgets/itemviews/qtreewidget.cpp
+++ b/src/widgets/itemviews/qtreewidget.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/itemviews/qtreewidget.h b/src/widgets/itemviews/qtreewidget.h
index 9f30e94580..c9654d3e8e 100644
--- a/src/widgets/itemviews/qtreewidget.h
+++ b/src/widgets/itemviews/qtreewidget.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -51,7 +51,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
#ifndef QT_NO_TREEWIDGET
diff --git a/src/widgets/itemviews/qtreewidget_p.h b/src/widgets/itemviews/qtreewidget_p.h
index a26666dd40..4d4f872b15 100644
--- a/src/widgets/itemviews/qtreewidget_p.h
+++ b/src/widgets/itemviews/qtreewidget_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/itemviews/qtreewidgetitemiterator.cpp b/src/widgets/itemviews/qtreewidgetitemiterator.cpp
index 5fdab5d024..116860ce89 100644
--- a/src/widgets/itemviews/qtreewidgetitemiterator.cpp
+++ b/src/widgets/itemviews/qtreewidgetitemiterator.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/itemviews/qtreewidgetitemiterator.h b/src/widgets/itemviews/qtreewidgetitemiterator.h
index d994b88b12..99c8b3cad9 100644
--- a/src/widgets/itemviews/qtreewidgetitemiterator.h
+++ b/src/widgets/itemviews/qtreewidgetitemiterator.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -49,7 +49,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
#ifndef QT_NO_TREEWIDGET
diff --git a/src/widgets/itemviews/qtreewidgetitemiterator_p.h b/src/widgets/itemviews/qtreewidgetitemiterator_p.h
index c338b944a1..98f4096578 100644
--- a/src/widgets/itemviews/qtreewidgetitemiterator_p.h
+++ b/src/widgets/itemviews/qtreewidgetitemiterator_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/itemviews/qwidgetitemdata_p.h b/src/widgets/itemviews/qwidgetitemdata_p.h
index cae3e8d1ff..491169e791 100644
--- a/src/widgets/itemviews/qwidgetitemdata_p.h
+++ b/src/widgets/itemviews/qwidgetitemdata_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/kernel/kernel.pri b/src/widgets/kernel/kernel.pri
index 1f27602466..32934dc705 100644
--- a/src/widgets/kernel/kernel.pri
+++ b/src/widgets/kernel/kernel.pri
@@ -20,7 +20,6 @@ HEADERS += \
kernel/qiconloader_p.h \
kernel/qiconengine.h \
kernel/qiconengineplugin.h \
- kernel/qinputcontext.h \
kernel/qlayout.h \
kernel/qlayout_p.h \
kernel/qlayoutengine_p.h \
@@ -44,8 +43,7 @@ HEADERS += \
kernel/qguiplatformplugin_p.h \
kernel/qdesktopwidget_qpa_p.h \
kernel/qwidgetwindow_qpa_p.h \
- kernel/qplatformmenu_qpa.h \
- kernel/qplatformdialoghelper_qpa.h
+ kernel/qplatformmenu_qpa.h
SOURCES += \
kernel/qaction.cpp \
@@ -59,7 +57,6 @@ SOURCES += \
kernel/qiconloader.cpp \
kernel/qiconengine.cpp \
kernel/qiconengineplugin.cpp \
- kernel/qinputcontext.cpp \
kernel/qlayout.cpp \
kernel/qlayoutengine.cpp \
kernel/qlayoutitem.cpp \
@@ -81,8 +78,7 @@ SOURCES += \
kernel/qdesktopwidget_qpa.cpp \
kernel/qwidget_qpa.cpp \
kernel/qwidgetwindow_qpa.cpp \
- kernel/qplatformmenu_qpa.cpp \
- kernel/qplatformdialoghelper_qpa.cpp
+ kernel/qplatformmenu_qpa.cpp
# TODO
false:!x11:mac {
diff --git a/src/widgets/kernel/qaction.cpp b/src/widgets/kernel/qaction.cpp
index 408e088f0f..d3d63a8c7b 100644
--- a/src/widgets/kernel/qaction.cpp
+++ b/src/widgets/kernel/qaction.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -662,10 +662,6 @@ QActionGroup *QAction::actionGroup() const
it is displayed to the left of the menu text. There is no default
icon.
- On Symbian the icons which are passed to softkeys, i.e. to actions with
- softkey role, need to have pixmap alpha channel correctly set otherwise
- drawing artifacts will appear when softkey is pressed down.
-
If a null icon (QIcon::isNull() is passed into this function,
the icon of the action is cleared.
*/
diff --git a/src/widgets/kernel/qaction.h b/src/widgets/kernel/qaction.h
index a2cafa2027..485b5928b0 100644
--- a/src/widgets/kernel/qaction.h
+++ b/src/widgets/kernel/qaction.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -52,7 +52,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
#ifndef QT_NO_ACTION
diff --git a/src/widgets/kernel/qaction_p.h b/src/widgets/kernel/qaction_p.h
index d57cd05cff..7a8cd5e0fe 100644
--- a/src/widgets/kernel/qaction_p.h
+++ b/src/widgets/kernel/qaction_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/kernel/qactiongroup.cpp b/src/widgets/kernel/qactiongroup.cpp
index 67e0ee7adf..46ca378bbe 100644
--- a/src/widgets/kernel/qactiongroup.cpp
+++ b/src/widgets/kernel/qactiongroup.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/kernel/qactiongroup.h b/src/widgets/kernel/qactiongroup.h
index bdef33294c..3cff248b65 100644
--- a/src/widgets/kernel/qactiongroup.h
+++ b/src/widgets/kernel/qactiongroup.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -48,7 +48,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
#ifndef QT_NO_ACTION
diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp
index fc295eb874..ae15c9f62a 100644
--- a/src/widgets/kernel/qapplication.cpp
+++ b/src/widgets/kernel/qapplication.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -69,9 +69,8 @@
#include "qmessagebox.h"
#include <QtWidgets/qgraphicsproxywidget.h>
#include <QtGui/qstylehints.h>
-#include <QtGui/qinputpanel.h>
+#include <QtGui/qinputmethod.h>
-#include "qinputcontext.h"
#include "private/qkeymapper_p.h"
#ifdef Q_WS_X11
@@ -141,10 +140,6 @@ Q_CORE_EXPORT void qt_call_post_routines();
QApplicationPrivate *QApplicationPrivate::self = 0;
-QInputContext *QApplicationPrivate::inputContext = 0;
-
-bool QApplicationPrivate::quitOnLastWindowClosed = true;
-
#ifdef Q_WS_WINCE
int QApplicationPrivate::autoMaximizeThreshold = -1;
bool QApplicationPrivate::autoSipEnabled = false;
@@ -161,8 +156,6 @@ QApplicationPrivate::QApplicationPrivate(int &argc, char **argv, QApplication::T
is_session_restored = false;
#endif
- quitOnLastWindowClosed = true;
-
#if defined(Q_WS_QWS) && !defined(QT_NO_DIRECTPAINTER)
directPainters = 0;
#endif
@@ -1204,7 +1197,7 @@ bool QApplication::compressEvent(QEvent *event, QObject *receiver, QPostEventLis
a virtual keyboard on devices which have very few or no keys.
\bold{ The property only has an effect on platforms which use software input
- panels, such as Windows CE and Symbian.}
+ panels, such as Windows CE.}
The default is platform dependent.
*/
@@ -1980,8 +1973,7 @@ void QApplicationPrivate::setFocusWidget(QWidget *focus, Qt::FocusReason reason)
// or it is not created fully yet.
|| (focus_widget && (!focus_widget->testAttribute(Qt::WA_InputMethodEnabled)
|| !focus_widget->testAttribute(Qt::WA_WState_Created))))) {
- qApp->inputPanel()->reset();
- qApp->inputPanel()->setInputItem(0);
+ qApp->inputMethod()->reset();
}
#endif //QT_NO_IM
@@ -2005,13 +1997,6 @@ void QApplicationPrivate::setFocusWidget(QWidget *focus, Qt::FocusReason reason)
QApplication::sendEvent(that->style(), &out);
}
if(focus && QApplicationPrivate::focus_widget == focus) {
-#ifndef QT_NO_IM
- if (focus->testAttribute(Qt::WA_InputMethodEnabled)
- && focus->testAttribute(Qt::WA_WState_Created)
- && focus->isEnabled()) {
- qApp->inputPanel()->setInputItem(focus);
- }
-#endif //QT_NO_IM
QFocusEvent in(QEvent::FocusIn, reason);
QPointer<QWidget> that = focus;
QApplication::sendEvent(focus, &in);
@@ -2019,6 +2004,7 @@ void QApplicationPrivate::setFocusWidget(QWidget *focus, Qt::FocusReason reason)
QApplication::sendEvent(that->style(), &in);
}
emit qApp->focusChanged(prev, focus_widget);
+ emit qApp->focusObjectChanged(focus_widget);
}
}
}
@@ -2112,29 +2098,6 @@ void QApplication::aboutQt()
#endif // QT_NO_MESSAGEBOX
}
-
-/*!
- \fn void QApplication::lastWindowClosed()
-
- This signal is emitted from QApplication::exec() when the last visible
- primary window (i.e. window with no parent) with the Qt::WA_QuitOnClose
- attribute set is closed.
-
- By default,
-
- \list
- \o this attribute is set for all widgets except transient windows such
- as splash screens, tool windows, and popup menus
-
- \o QApplication implicitly quits when this signal is emitted.
- \endlist
-
- This feature can be turned off by setting \l quitOnLastWindowClosed to
- false.
-
- \sa QWidget::close()
-*/
-
/*!
\since 4.1
\fn void QApplication::focusChanged(QWidget *old, QWidget *now)
@@ -3700,11 +3663,11 @@ bool QApplication::notify(QObject *receiver, QEvent *e)
{
QWidget *w = static_cast<QWidget *>(receiver);
QTabletEvent *tablet = static_cast<QTabletEvent*>(e);
- QPoint relpos = tablet->pos();
+ QPointF relpos = tablet->posF();
bool eventAccepted = tablet->isAccepted();
while (w) {
- QTabletEvent te(tablet->type(), relpos, tablet->globalPos(),
- tablet->hiResGlobalPos(), tablet->device(), tablet->pointerType(),
+ QTabletEvent te(tablet->type(), relpos, tablet->globalPosF(),
+ tablet->device(), tablet->pointerType(),
tablet->pressure(), tablet->xTilt(), tablet->yTilt(),
tablet->tangentialPressure(), tablet->rotation(), tablet->z(),
tablet->modifiers(), tablet->uniqueId());
@@ -3799,7 +3762,7 @@ bool QApplication::notify(QObject *receiver, QEvent *e)
}
if (w->isWindow())
break;
- dragEvent->p = w->mapToParent(dragEvent->p);
+ dragEvent->p = w->mapToParent(dragEvent->p.toPoint());
w = w->parentWidget();
}
}
@@ -3838,7 +3801,7 @@ bool QApplication::notify(QObject *receiver, QEvent *e)
QDropEvent *dragEvent = static_cast<QDropEvent *>(e);
QWidget *origReciver = static_cast<QWidget *>(receiver);
while (origReciver && w != origReciver) {
- dragEvent->p = origReciver->mapToParent(dragEvent->p);
+ dragEvent->p = origReciver->mapToParent(dragEvent->p.toPoint());
origReciver = origReciver->parentWidget();
}
}
@@ -3907,10 +3870,10 @@ bool QApplication::notify(QObject *receiver, QEvent *e)
break;
}
case QEvent::RequestSoftwareInputPanel:
- inputPanel()->show();
+ inputMethod()->show();
break;
case QEvent::CloseSoftwareInputPanel:
- inputPanel()->hide();
+ inputMethod()->hide();
break;
#ifndef QT_NO_GESTURES
@@ -4609,45 +4572,6 @@ bool QApplicationPrivate::inPopupMode() const
return QApplicationPrivate::popupWidgets != 0;
}
-/*!
- \property QApplication::quitOnLastWindowClosed
-
- \brief whether the application implicitly quits when the last window is
- closed.
-
- The default is true.
-
- If this property is true, the applications quits when the last visible
- primary window (i.e. window with no parent) with the Qt::WA_QuitOnClose
- attribute set is closed. By default this attribute is set for all widgets
- except for sub-windows. Refer to \l{Qt::WindowType} for a detailed list of
- Qt::Window objects.
-
- \sa quit(), QWidget::close()
- */
-
-void QApplication::setQuitOnLastWindowClosed(bool quit)
-{
- QApplicationPrivate::quitOnLastWindowClosed = quit;
-}
-
-bool QApplication::quitOnLastWindowClosed()
-{
- return QApplicationPrivate::quitOnLastWindowClosed;
-}
-
-void QApplicationPrivate::emitLastWindowClosed()
-{
- if (qApp && qApp->d_func()->in_exec) {
- if (QApplicationPrivate::quitOnLastWindowClosed) {
- // get ready to quit, this event might be removed if the
- // event loop is re-entered, however
- QApplication::postEvent(qApp, new QEvent(QEvent::Quit));
- }
- emit qApp->lastWindowClosed();
- }
-}
-
/*! \variable QApplication::NormalColors
\compat
@@ -4664,19 +4588,13 @@ void QApplicationPrivate::emitLastWindowClosed()
/*!
Sets the kind of focus navigation Qt should use to \a mode.
- This feature is available in Qt for Embedded Linux, Symbian and Windows CE
+ This feature is available in Qt for Embedded Linux, and Windows CE
only.
\note On Windows CE this feature is disabled by default for touch device
mkspecs. To enable keypad navigation, build Qt with
QT_KEYPAD_NAVIGATION defined.
- \note On Symbian, setting the mode to Qt::NavigationModeCursorAuto will enable a
- virtual mouse cursor on non touchscreen devices, which is controlled
- by the cursor keys if there is no analog pointer device.
- On other platforms and on touchscreen devices, it has the same
- meaning as Qt::NavigationModeNone.
-
\since 4.6
\sa keypadNavigationEnabled()
@@ -4689,16 +4607,12 @@ void QApplication::setNavigationMode(Qt::NavigationMode mode)
/*!
Returns what kind of focus navigation Qt is using.
- This feature is available in Qt for Embedded Linux, Symbian and Windows CE
- only.
+ This feature is available in Qt for Embedded Linux, and Windows CE only.
\note On Windows CE this feature is disabled by default for touch device
mkspecs. To enable keypad navigation, build Qt with
QT_KEYPAD_NAVIGATION defined.
- \note On Symbian, the default mode is Qt::NavigationModeNone for touch
- devices, and Qt::NavigationModeKeypadDirectional.
-
\since 4.6
\sa keypadNavigationEnabled()
@@ -4712,8 +4626,7 @@ Qt::NavigationMode QApplication::navigationMode()
Sets whether Qt should use focus navigation suitable for use with a
minimal keypad.
- This feature is available in Qt for Embedded Linux, Symbian and Windows CE
- only.
+ This feature is available in Qt for Embedded Linux, and Windows CE only.
\note On Windows CE this feature is disabled by default for touch device
mkspecs. To enable keypad navigation, build Qt with
@@ -4734,10 +4647,9 @@ void QApplication::setKeypadNavigationEnabled(bool enable)
/*!
Returns true if Qt is set to use keypad navigation; otherwise returns
- false. The default value is true on Symbian, but false on other platforms.
+ false. The default value is false.
- This feature is available in Qt for Embedded Linux, Symbian and Windows CE
- only.
+ This feature is available in Qt for Embedded Linux, and Windows CE only.
\note On Windows CE this feature is disabled by default for touch device
mkspecs. To enable keypad navigation, build Qt with
@@ -4932,40 +4844,27 @@ int QApplication::keyboardInputInterval()
\sa QCoreApplication::instance()
*/
-#ifndef QT_NO_IM
-// ************************************************************************
-// Input Method support
-// ************************************************************************
-
-/*
- This function replaces the QInputContext instance used by the application
- with \a inputContext.
+/*!
+ \since 4.2
+ \obsolete
- Qt takes ownership of the given \a inputContext.
+ Returns the current keyboard input locale. Replaced with QInputMethod::locale()
*/
-void QApplicationPrivate::setInputContext(QInputContext *newInputContext)
+QLocale QApplication::keyboardInputLocale()
{
- Q_Q(QApplication);
-
- if (newInputContext == inputContext)
- return;
- if (!newInputContext) {
- qWarning("QApplicationPrivate::setInputContext: called with 0 input context");
- return;
- }
- delete inputContext;
- inputContext = newInputContext;
- inputContext->setParent(q);
+ return qApp ? qApp->inputMethod()->locale() : QLocale::c();
}
/*!
- Returns the QInputContext instance used by the application.
+ \since 4.2
+ \obsolete
+
+ Returns the current keyboard input direction. Replaced with QInputMethod::inputDirection()
*/
-QInputContext *QApplication::inputContext() const
+Qt::LayoutDirection QApplication::keyboardInputDirection()
{
- return QApplicationPrivate::inputContext;
+ return qApp ? qApp->inputMethod()->inputDirection() : Qt::LeftToRight;
}
-#endif // QT_NO_IM
bool qt_sendSpontaneousEvent(QObject *receiver, QEvent *event)
{
diff --git a/src/widgets/kernel/qapplication.h b/src/widgets/kernel/qapplication.h
index 4347aa3521..b613b0f7c0 100644
--- a/src/widgets/kernel/qapplication.h
+++ b/src/widgets/kernel/qapplication.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -56,14 +56,12 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
class QSessionManager;
class QDesktopWidget;
class QStyle;
class QEventLoop;
class QIcon;
-class QInputContext;
template <typename T> class QList;
class QLocale;
class QPlatformNativeInterface;
@@ -88,7 +86,6 @@ class Q_WIDGETS_EXPORT QApplication : public QGuiApplication
Q_PROPERTY(QSize globalStrut READ globalStrut WRITE setGlobalStrut)
Q_PROPERTY(int startDragTime READ startDragTime WRITE setStartDragTime)
Q_PROPERTY(int startDragDistance READ startDragDistance WRITE setStartDragDistance)
- Q_PROPERTY(bool quitOnLastWindowClosed READ quitOnLastWindowClosed WRITE setQuitOnLastWindowClosed)
#ifndef QT_NO_STYLE_STYLESHEET
Q_PROPERTY(QString styleSheet READ styleSheet WRITE setStyleSheet)
#endif
@@ -222,17 +219,12 @@ public:
virtual void saveState(QSessionManager& sm);
#endif
-#ifndef QT_NO_IM
- QInputContext *inputContext() const;
-#endif
+ QT_DEPRECATED static QLocale keyboardInputLocale();
+ QT_DEPRECATED static Qt::LayoutDirection keyboardInputDirection();
static int exec();
bool notify(QObject *, QEvent *);
-
- static void setQuitOnLastWindowClosed(bool quit);
- static bool quitOnLastWindowClosed();
-
#ifdef QT_KEYPAD_NAVIGATION
static Q_DECL_DEPRECATED void setKeypadNavigationEnabled(bool);
static bool keypadNavigationEnabled();
@@ -303,7 +295,6 @@ private:
friend class QAction;
#if defined(Q_WS_QWS)
- friend class QInputContext;
friend class QWSDirectPainterSurface;
friend class QDirectPainter;
friend class QDirectPainterPrivate;
diff --git a/src/widgets/kernel/qapplication_p.h b/src/widgets/kernel/qapplication_p.h
index f8d02ed437..601c511438 100644
--- a/src/widgets/kernel/qapplication_p.h
+++ b/src/widgets/kernel/qapplication_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -79,7 +79,6 @@ QT_BEGIN_NAMESPACE
class QClipboard;
class QGraphicsScene;
-class QInputContext;
class QObject;
class QWidget;
class QSocketNotifier;
@@ -188,8 +187,6 @@ public:
static bool qws_apply_settings();
static QWidget *findWidget(const QObjectList&, const QPoint &, bool rec);
#endif
- static bool quitOnLastWindowClosed;
- static void emitLastWindowClosed();
#ifdef Q_WS_WINCE
static int autoMaximizeThreshold;
#endif
@@ -251,12 +248,6 @@ public:
QPoint toolTipPos, toolTipGlobalPos, hoverGlobalPos;
QPointer<QWidget> toolTipWidget;
-#ifndef QT_NO_IM
- void setInputContext(QInputContext *);
-#endif
-
- static QInputContext *inputContext;
-
static Qt::MouseButtons mouse_buttons;
static Qt::KeyboardModifiers modifier_buttons;
@@ -350,11 +341,23 @@ public:
QWidget *native, QWidget **buttonDown, QPointer<QWidget> &lastMouseReceiver,
bool spontaneous = true);
void sendSyntheticEnterLeave(QWidget *widget);
+
+ static QWindow *windowForWidget(const QWidget *widget)
+ {
+ if (QWindow *window = widget->windowHandle())
+ return window;
+ if (const QWidget *nativeParent = widget->nativeParentWidget())
+ return nativeParent->windowHandle();
+ return 0;
+ }
+
#ifdef Q_OS_WIN
- static HWND getHWNDForWidget(QWidget *widget)
+ static HWND getHWNDForWidget(const QWidget *widget)
{
- QWindow *window = widget->windowHandle();
- return static_cast<HWND> (QGuiApplication::platformNativeInterface()->nativeResourceForWindow("handle", window));
+ if (QWindow *window = windowForWidget(widget))
+ return static_cast<HWND> (QGuiApplication::platformNativeInterface()->
+ nativeResourceForWindow(QByteArrayLiteral("handle"), window));
+ return 0;
}
#endif
diff --git a/src/widgets/kernel/qapplication_qpa.cpp b/src/widgets/kernel/qapplication_qpa.cpp
index d61b8560a8..e221df7ef7 100644
--- a/src/widgets/kernel/qapplication_qpa.cpp
+++ b/src/widgets/kernel/qapplication_qpa.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -54,7 +54,6 @@
#include "private/qplatformintegrationfactory_qpa_p.h"
#include <qdesktopwidget.h>
-#include <qinputcontext.h>
#include <QPlatformCursor>
#include <qdebug.h>
#include <QWindowSystemInterface>
@@ -64,6 +63,10 @@
#include "qdesktopwidget_qpa_p.h"
#include "qwidgetwindow_qpa_p.h"
+#ifdef Q_OS_WIN
+# include <QtCore/qt_windows.h> // for qt_win_display_dc()
+#endif
+
QT_BEGIN_NAMESPACE
static QString appName;
@@ -391,13 +394,10 @@ void qt_init(QApplicationPrivate *priv, int type)
QColormap::initialize();
qApp->setObjectName(appName);
-
-#ifndef QT_NO_QWS_INPUTMETHODS
- priv->setInputContext(new QInputContext(qApp));
-#endif
}
#ifdef Q_OS_WIN
+// #fixme: Remove.
static HDC displayDC = 0; // display device context
Q_WIDGETS_EXPORT HDC qt_win_display_dc() // get display DC
@@ -413,8 +413,6 @@ void qt_cleanup()
{
QPixmapCache::clear();
QColormap::cleanup();
- delete QApplicationPrivate::inputContext;
- QApplicationPrivate::inputContext = 0;
QApplicationPrivate::active_window = 0; //### this should not be necessary
#ifdef Q_OS_WIN
diff --git a/src/widgets/kernel/qboxlayout.cpp b/src/widgets/kernel/qboxlayout.cpp
index e8d653e25d..4b7153715d 100644
--- a/src/widgets/kernel/qboxlayout.cpp
+++ b/src/widgets/kernel/qboxlayout.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/kernel/qboxlayout.h b/src/widgets/kernel/qboxlayout.h
index 8df0fbca94..aac46ef1ec 100644
--- a/src/widgets/kernel/qboxlayout.h
+++ b/src/widgets/kernel/qboxlayout.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -53,7 +53,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
class QBoxLayoutPrivate;
diff --git a/src/widgets/kernel/qdesktopwidget.cpp b/src/widgets/kernel/qdesktopwidget.cpp
index 871715fed4..7adad05402 100644
--- a/src/widgets/kernel/qdesktopwidget.cpp
+++ b/src/widgets/kernel/qdesktopwidget.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/kernel/qdesktopwidget.h b/src/widgets/kernel/qdesktopwidget.h
index ec38b32239..e8678fb0a3 100644
--- a/src/widgets/kernel/qdesktopwidget.h
+++ b/src/widgets/kernel/qdesktopwidget.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -48,7 +48,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
class QApplication;
class QDesktopWidgetPrivate;
diff --git a/src/widgets/kernel/qdesktopwidget.qdoc b/src/widgets/kernel/qdesktopwidget.qdoc
index 10690dfe35..1a5024aaf7 100644
--- a/src/widgets/kernel/qdesktopwidget.qdoc
+++ b/src/widgets/kernel/qdesktopwidget.qdoc
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -21,6 +20,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/kernel/qdesktopwidget_qpa.cpp b/src/widgets/kernel/qdesktopwidget_qpa.cpp
index 8ac2b357c6..56efb27e78 100644
--- a/src/widgets/kernel/qdesktopwidget_qpa.cpp
+++ b/src/widgets/kernel/qdesktopwidget_qpa.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/kernel/qdesktopwidget_qpa_p.h b/src/widgets/kernel/qdesktopwidget_qpa_p.h
index 50b5f4826e..d5924b5f69 100644
--- a/src/widgets/kernel/qdesktopwidget_qpa_p.h
+++ b/src/widgets/kernel/qdesktopwidget_qpa_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/kernel/qformlayout.cpp b/src/widgets/kernel/qformlayout.cpp
index 955ef4e3c7..dd61528124 100644
--- a/src/widgets/kernel/qformlayout.cpp
+++ b/src/widgets/kernel/qformlayout.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -1124,15 +1124,14 @@ QStyle* QFormLayoutPrivate::getStyle() const
\value DontWrapRows
Fields are always laid out next to their label. This is
- the default policy for all styles except Qt Extended styles
- and QS60Style.
+ the default policy for all styles except Qt Extended styles.
\value WrapLongRows
Labels are given enough horizontal space to fit the widest label,
and the rest of the space is given to the fields. If the minimum
size of a field pair is wider than the available space, the field
is wrapped to the next line. This is the default policy for
- Qt Extended styles and and QS60Style.
+ Qt Extended styles.
\value WrapAllRows
Fields are always laid out below their label.
@@ -1721,7 +1720,7 @@ QFormLayout::FieldGrowthPolicy QFormLayout::fieldGrowthPolicy() const
\brief the way in which the form's rows wrap
The default value depends on the widget or application style. For
- Qt Extended styles and QS60Style, the default is WrapLongRows;
+ Qt Extended styles, the default is WrapLongRows;
for the other styles, the default is DontWrapRows.
If you want to display each label above its associated field
diff --git a/src/widgets/kernel/qformlayout.h b/src/widgets/kernel/qformlayout.h
index b37d2b6e3a..dab97c18a9 100644
--- a/src/widgets/kernel/qformlayout.h
+++ b/src/widgets/kernel/qformlayout.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -48,7 +48,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
class QFormLayoutPrivate;
diff --git a/src/widgets/kernel/qgesture.cpp b/src/widgets/kernel/qgesture.cpp
index f79b577765..070af65c70 100644
--- a/src/widgets/kernel/qgesture.cpp
+++ b/src/widgets/kernel/qgesture.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/kernel/qgesture.h b/src/widgets/kernel/qgesture.h
index 25dba1c886..8c412680b8 100644
--- a/src/widgets/kernel/qgesture.h
+++ b/src/widgets/kernel/qgesture.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -59,7 +59,6 @@ Q_DECLARE_METATYPE(Qt::GestureType)
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
class QGesturePrivate;
class Q_WIDGETS_EXPORT QGesture : public QObject
diff --git a/src/widgets/kernel/qgesture_p.h b/src/widgets/kernel/qgesture_p.h
index be8e38cd7f..ceccf17a6c 100644
--- a/src/widgets/kernel/qgesture_p.h
+++ b/src/widgets/kernel/qgesture_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/kernel/qgesturemanager.cpp b/src/widgets/kernel/qgesturemanager.cpp
index 5abbbde4cb..2e9edb1481 100644
--- a/src/widgets/kernel/qgesturemanager.cpp
+++ b/src/widgets/kernel/qgesturemanager.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/kernel/qgesturemanager_p.h b/src/widgets/kernel/qgesturemanager_p.h
index 800d7c5ad9..68945a7b66 100644
--- a/src/widgets/kernel/qgesturemanager_p.h
+++ b/src/widgets/kernel/qgesturemanager_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/kernel/qgesturerecognizer.cpp b/src/widgets/kernel/qgesturerecognizer.cpp
index fc0e918987..b8e85aabb9 100644
--- a/src/widgets/kernel/qgesturerecognizer.cpp
+++ b/src/widgets/kernel/qgesturerecognizer.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/kernel/qgesturerecognizer.h b/src/widgets/kernel/qgesturerecognizer.h
index 92f9f622c0..23ecbe7a6d 100644
--- a/src/widgets/kernel/qgesturerecognizer.h
+++ b/src/widgets/kernel/qgesturerecognizer.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -51,7 +51,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
class QObject;
class QEvent;
diff --git a/src/widgets/kernel/qgridlayout.cpp b/src/widgets/kernel/qgridlayout.cpp
index 80834a0105..3607d88d9e 100644
--- a/src/widgets/kernel/qgridlayout.cpp
+++ b/src/widgets/kernel/qgridlayout.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/kernel/qgridlayout.h b/src/widgets/kernel/qgridlayout.h
index f72ed32dcb..02789b7794 100644
--- a/src/widgets/kernel/qgridlayout.h
+++ b/src/widgets/kernel/qgridlayout.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -53,7 +53,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
class QGridLayoutPrivate;
diff --git a/src/widgets/kernel/qguiplatformplugin.cpp b/src/widgets/kernel/qguiplatformplugin.cpp
index 7faf17b9ab..f5f00cc769 100644
--- a/src/widgets/kernel/qguiplatformplugin.cpp
+++ b/src/widgets/kernel/qguiplatformplugin.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -135,7 +135,7 @@ QString QGuiPlatformPlugin::styleName()
return QLatin1String("WindowsMobile");
else
return QLatin1String("WindowsCE");
-#elif defined(Q_WS_WIN)
+#elif defined(Q_OS_WIN)
if ((QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA
&& QSysInfo::WindowsVersion < QSysInfo::WV_NT_based))
return QLatin1String("WindowsVista");
diff --git a/src/widgets/kernel/qguiplatformplugin_p.h b/src/widgets/kernel/qguiplatformplugin_p.h
index 74a01b9d58..09b6564061 100644
--- a/src/widgets/kernel/qguiplatformplugin_p.h
+++ b/src/widgets/kernel/qguiplatformplugin_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -61,7 +61,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
class QStyle;
class QPalette;
diff --git a/src/widgets/kernel/qicon.cpp b/src/widgets/kernel/qicon.cpp
index 185542420e..1d3236aa46 100644
--- a/src/widgets/kernel/qicon.cpp
+++ b/src/widgets/kernel/qicon.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -128,9 +128,7 @@ static void qt_cleanup_icon_cache()
QIconPrivate::QIconPrivate()
: engine(0), ref(1),
serialNum(serialNumCounter.fetchAndAddRelaxed(1)),
- detach_no(0),
- engine_version(2),
- v1RefCount(0)
+ detach_no(0)
{
}
@@ -139,7 +137,7 @@ QPixmapIconEngine::QPixmapIconEngine()
}
QPixmapIconEngine::QPixmapIconEngine(const QPixmapIconEngine &other)
- : QIconEngineV2(other), pixmaps(other.pixmaps)
+ : QIconEngine(other), pixmaps(other.pixmaps)
{
}
@@ -374,7 +372,7 @@ QString QPixmapIconEngine::key() const
return QLatin1String("QPixmapIconEngine");
}
-QIconEngineV2 *QPixmapIconEngine::clone() const
+QIconEngine *QPixmapIconEngine::clone() const
{
return new QPixmapIconEngine(*this);
}
@@ -430,9 +428,9 @@ bool QPixmapIconEngine::write(QDataStream &out) const
void QPixmapIconEngine::virtual_hook(int id, void *data)
{
switch (id) {
- case QIconEngineV2::AvailableSizesHook: {
- QIconEngineV2::AvailableSizesArgument &arg =
- *reinterpret_cast<QIconEngineV2::AvailableSizesArgument*>(data);
+ case QIconEngine::AvailableSizesHook: {
+ QIconEngine::AvailableSizesArgument &arg =
+ *reinterpret_cast<QIconEngine::AvailableSizesArgument*>(data);
arg.sizes.clear();
for (int i = 0; i < pixmaps.size(); ++i) {
QPixmapIconEngineEntry &pe = pixmaps[i];
@@ -446,15 +444,13 @@ void QPixmapIconEngine::virtual_hook(int id, void *data)
break;
}
default:
- QIconEngineV2::virtual_hook(id, data);
+ QIconEngine::virtual_hook(id, data);
}
}
#ifndef QT_NO_LIBRARY
Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
(QIconEngineFactoryInterface_iid, QLatin1String("/iconengines"), Qt::CaseInsensitive))
-Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loaderV2,
- (QIconEngineFactoryInterfaceV2_iid, QLatin1String("/iconengines"), Qt::CaseInsensitive))
#endif
@@ -584,19 +580,6 @@ QIcon::QIcon(const QString &fileName)
QIcon::QIcon(QIconEngine *engine)
:d(new QIconPrivate)
{
- d->engine_version = 1;
- d->engine = engine;
- d->v1RefCount = new QAtomicInt(1);
-}
-
-/*!
- Creates an icon with a specific icon \a engine. The icon takes
- ownership of the engine.
-*/
-QIcon::QIcon(QIconEngineV2 *engine)
- :d(new QIconPrivate)
-{
- d->engine_version = 2;
d->engine = engine;
}
@@ -777,15 +760,7 @@ void QIcon::detach()
if (d) {
if (d->ref.load() != 1) {
QIconPrivate *x = new QIconPrivate;
- if (d->engine_version > 1) {
- QIconEngineV2 *engine = static_cast<QIconEngineV2 *>(d->engine);
- x->engine = engine->clone();
- } else {
- x->engine = d->engine;
- x->v1RefCount = d->v1RefCount;
- x->v1RefCount->ref();
- }
- x->engine_version = d->engine_version;
+ x->engine = d->engine->clone();
if (!d->ref.deref())
delete d;
d = x;
@@ -851,23 +826,12 @@ void QIcon::addFile(const QString &fileName, const QSize &size, Mode mode, State
QString suffix = info.suffix();
if (!suffix.isEmpty()) {
// first try version 2 engines..
- if (QIconEngineFactoryInterfaceV2 *factory = qobject_cast<QIconEngineFactoryInterfaceV2*>(loaderV2()->instance(suffix))) {
+ if (QIconEngineFactoryInterface *factory = qobject_cast<QIconEngineFactoryInterface*>(loader()->instance(suffix))) {
if (QIconEngine *engine = factory->create(fileName)) {
d = new QIconPrivate;
d->engine = engine;
}
}
- // ..then fall back and try to load version 1 engines
- if (!d) {
- if (QIconEngineFactoryInterface *factory = qobject_cast<QIconEngineFactoryInterface*>(loader()->instance(suffix))) {
- if (QIconEngine *engine = factory->create(fileName)) {
- d = new QIconPrivate;
- d->engine = engine;
- d->engine_version = 1;
- d->v1RefCount = new QAtomicInt(1);
- }
- }
- }
}
#endif
// ...then fall back to the default engine
@@ -889,10 +853,9 @@ void QIcon::addFile(const QString &fileName, const QSize &size, Mode mode, State
*/
QList<QSize> QIcon::availableSizes(Mode mode, State state) const
{
- if (!d || !d->engine || d->engine_version < 2)
+ if (!d || !d->engine)
return QList<QSize>();
- QIconEngineV2 *engine = static_cast<QIconEngineV2*>(d->engine);
- return engine->availableSizes(mode, state);
+ return d->engine->availableSizes(mode, state);
}
/*!
@@ -908,10 +871,9 @@ QList<QSize> QIcon::availableSizes(Mode mode, State state) const
*/
QString QIcon::name() const
{
- if (!d || !d->engine || d->engine_version < 2)
+ if (!d || !d->engine)
return QString();
- QIconEngineV2 *engine = static_cast<QIconEngineV2*>(d->engine);
- return engine->iconName();
+ return d->engine->iconName();
}
/*!
@@ -1066,14 +1028,8 @@ QDataStream &operator<<(QDataStream &s, const QIcon &icon)
if (icon.isNull()) {
s << QString();
} else {
- if (icon.d->engine_version > 1) {
- QIconEngineV2 *engine = static_cast<QIconEngineV2 *>(icon.d->engine);
- s << engine->key();
- engine->write(s);
- } else {
- // not really supported
- qWarning("QIcon: Cannot stream QIconEngine. Use QIconEngineV2 instead.");
- }
+ s << icon.d->engine->key();
+ icon.d->engine->write(s);
}
} else if (s.version() == QDataStream::Qt_4_2) {
if (icon.isNull()) {
@@ -1113,17 +1069,17 @@ QDataStream &operator>>(QDataStream &s, QIcon &icon)
s >> key;
if (key == QLatin1String("QPixmapIconEngine")) {
icon.d = new QIconPrivate;
- QIconEngineV2 *engine = new QPixmapIconEngine;
+ QIconEngine *engine = new QPixmapIconEngine;
icon.d->engine = engine;
engine->read(s);
} else if (key == QLatin1String("QIconLoaderEngine")) {
icon.d = new QIconPrivate;
- QIconEngineV2 *engine = new QIconLoaderEngine();
+ QIconEngine *engine = new QIconLoaderEngine();
icon.d->engine = engine;
engine->read(s);
#if !defined (QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS)
- } else if (QIconEngineFactoryInterfaceV2 *factory = qobject_cast<QIconEngineFactoryInterfaceV2*>(loaderV2()->instance(key))) {
- if (QIconEngineV2 *engine= factory->create()) {
+ } else if (QIconEngineFactoryInterface *factory = qobject_cast<QIconEngineFactoryInterface*>(loader()->instance(key))) {
+ if (QIconEngine *engine= factory->create()) {
icon.d = new QIconPrivate;
icon.d->engine = engine;
engine->read(s);
diff --git a/src/widgets/kernel/qicon.h b/src/widgets/kernel/qicon.h
index a72ae236f1..7bef500946 100644
--- a/src/widgets/kernel/qicon.h
+++ b/src/widgets/kernel/qicon.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -51,11 +51,9 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
class QIconPrivate;
class QIconEngine;
-class QIconEngineV2;
class Q_WIDGETS_EXPORT QIcon
{
@@ -68,7 +66,6 @@ public:
QIcon(const QIcon &other);
explicit QIcon(const QString &fileName); // file or resource name
explicit QIcon(QIconEngine *engine);
- explicit QIcon(QIconEngineV2 *engine);
~QIcon();
QIcon &operator=(const QIcon &other);
#ifdef Q_COMPILER_RVALUE_REFS
diff --git a/src/widgets/kernel/qicon_p.h b/src/widgets/kernel/qicon_p.h
index 02ac3afed4..37c4b7cb1f 100644
--- a/src/widgets/kernel/qicon_p.h
+++ b/src/widgets/kernel/qicon_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -69,14 +69,7 @@ public:
QIconPrivate();
~QIconPrivate() {
- if (engine_version == 1) {
- if (!v1RefCount->deref()) {
- delete engine;
- delete v1RefCount;
- }
- } else if (engine_version == 2) {
- delete engine;
- }
+ delete engine;
}
QIconEngine *engine;
@@ -84,9 +77,6 @@ public:
QAtomicInt ref;
int serialNum;
int detach_no;
- int engine_version;
-
- QAtomicInt *v1RefCount;
};
@@ -107,7 +97,7 @@ struct QPixmapIconEngineEntry
-class QPixmapIconEngine : public QIconEngineV2 {
+class QPixmapIconEngine : public QIconEngine {
public:
QPixmapIconEngine();
QPixmapIconEngine(const QPixmapIconEngine &);
@@ -119,9 +109,8 @@ public:
void addPixmap(const QPixmap &pixmap, QIcon::Mode mode, QIcon::State state);
void addFile(const QString &fileName, const QSize &size, QIcon::Mode mode, QIcon::State state);
- // v2 functions
QString key() const;
- QIconEngineV2 *clone() const;
+ QIconEngine *clone() const;
bool read(QDataStream &in);
bool write(QDataStream &out) const;
void virtual_hook(int id, void *data);
diff --git a/src/widgets/kernel/qiconengine.cpp b/src/widgets/kernel/qiconengine.cpp
index 930d7e1699..0a2d92ed69 100644
--- a/src/widgets/kernel/qiconengine.cpp
+++ b/src/widgets/kernel/qiconengine.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -52,8 +52,6 @@ QT_BEGIN_NAMESPACE
\ingroup painting
\inmodule QtWidgets
- \bold {Use QIconEngineV2 instead.}
-
An icon engine provides the rendering functions for a QIcon. Each icon has a
corresponding icon engine that is responsible for drawing the icon with a
requested size, mode and state.
@@ -67,7 +65,7 @@ QT_BEGIN_NAMESPACE
The paint(), pixmap(), and addPixmap() functions are all virtual, and can
therefore be reimplemented in subclasses of QIconEngine.
- \sa QIconEngineV2, QIconEnginePlugin
+ \sa QIconEnginePlugin
*/
@@ -136,45 +134,8 @@ void QIconEngine::addFile(const QString &/*fileName*/, const QSize &/*size*/, QI
}
-
-// version 2 functions
-
-
-/*!
- \class QIconEngineV2
-
- \brief The QIconEngineV2 class provides an abstract base class for QIcon renderers.
-
- \ingroup painting
- \inmodule QtWidgets
-
- \since 4.3
-
- An icon engine renders \l{QIcon}s. With icon engines, you can
- customize icons. Qt provides a default engine that makes icons
- adhere to the current style by scaling the icons and providing a
- disabled appearance.
-
- An engine is installed on an icon either through a QIcon
- constructor or through a QIconEnginePluginV2. The plugins are used
- by Qt if a specific engine is not given when the icon is created.
- See the QIconEngineV2 class description to learn how to create
- icon engine plugins.
-
- An icon engine provides the rendering functions for a QIcon. Each
- icon has a corresponding icon engine that is responsible for drawing
- the icon with a requested size, mode and state.
-
- QIconEngineV2 extends the API of QIconEngine to allow streaming of
- the icon engine contents, and should be used instead of QIconEngine
- for implementing new icon engines.
-
- \sa QIconEnginePluginV2
-
-*/
-
/*!
- \enum QIconEngineV2::IconEngineHook
+ \enum QIconEngine::IconEngineHook
\since 4.5
These enum values are used for virtual_hook() to allow additional
@@ -194,33 +155,33 @@ void QIconEngine::addFile(const QString &/*fileName*/, const QSize &/*size*/, QI
*/
/*!
- \class QIconEngineV2::AvailableSizesArgument
+ \class QIconEngine::AvailableSizesArgument
\since 4.5
\inmodule QtWidgets
This struct represents arguments to virtual_hook() function when
- \a id parameter is QIconEngineV2::AvailableSizesHook.
+ \a id parameter is QIconEngine::AvailableSizesHook.
- \sa virtual_hook(), QIconEngineV2::IconEngineHook
+ \sa virtual_hook(), QIconEngine::IconEngineHook
*/
/*!
- \variable QIconEngineV2::AvailableSizesArgument::mode
+ \variable QIconEngine::AvailableSizesArgument::mode
\brief the requested mode of an image.
\sa QIcon::Mode
*/
/*!
- \variable QIconEngineV2::AvailableSizesArgument::state
+ \variable QIconEngine::AvailableSizesArgument::state
\brief the requested state of an image.
\sa QIcon::State
*/
/*!
- \variable QIconEngineV2::AvailableSizesArgument::sizes
+ \variable QIconEngine::AvailableSizesArgument::sizes
\brief image sizes that are available with specified \a mode and
\a state. This is an output parameter and is filled after call to
@@ -232,26 +193,23 @@ void QIconEngine::addFile(const QString &/*fileName*/, const QSize &/*size*/, QI
/*!
Returns a key that identifies this icon engine.
*/
-QString QIconEngineV2::key() const
+QString QIconEngine::key() const
{
return QString();
}
-/*!
- Returns a clone of this icon engine.
+/*! \fn QIconEngine *QIconEngine::clone() const
+
+ Reimplement this method to return a clone of this icon engine.
*/
-QIconEngineV2 *QIconEngineV2::clone() const
-{
- return 0;
-}
/*!
Reads icon engine contents from the QDataStream \a in. Returns
true if the contents were read; otherwise returns false.
- QIconEngineV2's default implementation always return false.
+ QIconEngine's default implementation always return false.
*/
-bool QIconEngineV2::read(QDataStream &)
+bool QIconEngine::read(QDataStream &)
{
return false;
}
@@ -260,9 +218,9 @@ bool QIconEngineV2::read(QDataStream &)
Writes the contents of this engine to the QDataStream \a out.
Returns true if the contents were written; otherwise returns false.
- QIconEngineV2's default implementation always return false.
+ QIconEngine's default implementation always return false.
*/
-bool QIconEngineV2::write(QDataStream &) const
+bool QIconEngine::write(QDataStream &) const
{
return false;
}
@@ -270,19 +228,19 @@ bool QIconEngineV2::write(QDataStream &) const
/*!
\since 4.5
- Additional method to allow extending QIconEngineV2 without
+ Additional method to allow extending QIconEngine without
adding new virtual methods (and without breaking binary compatibility).
The actual action and format of \a data depends on \a id argument
which is in fact a constant from IconEngineHook enum.
\sa IconEngineHook
*/
-void QIconEngineV2::virtual_hook(int id, void *data)
+void QIconEngine::virtual_hook(int id, void *data)
{
switch (id) {
- case QIconEngineV2::AvailableSizesHook: {
- QIconEngineV2::AvailableSizesArgument &arg =
- *reinterpret_cast<QIconEngineV2::AvailableSizesArgument*>(data);
+ case QIconEngine::AvailableSizesHook: {
+ QIconEngine::AvailableSizesArgument &arg =
+ *reinterpret_cast<QIconEngine::AvailableSizesArgument*>(data);
arg.sizes.clear();
break;
}
@@ -301,12 +259,12 @@ void QIconEngineV2::virtual_hook(int id, void *data)
virtual_hook() method, hence this method depends on icon engine support
and may not work with all icon engines.
*/
-QList<QSize> QIconEngineV2::availableSizes(QIcon::Mode mode, QIcon::State state)
+QList<QSize> QIconEngine::availableSizes(QIcon::Mode mode, QIcon::State state) const
{
AvailableSizesArgument arg;
arg.mode = mode;
arg.state = state;
- virtual_hook(QIconEngineV2::AvailableSizesHook, reinterpret_cast<void*>(&arg));
+ const_cast<QIconEngine *>(this)->virtual_hook(QIconEngine::AvailableSizesHook, reinterpret_cast<void*>(&arg));
return arg.sizes;
}
@@ -319,10 +277,10 @@ QList<QSize> QIconEngineV2::availableSizes(QIcon::Mode mode, QIcon::State state)
virtual_hook() method, hence this method depends on icon engine support
and may not work with all icon engines.
*/
-QString QIconEngineV2::iconName()
+QString QIconEngine::iconName() const
{
QString name;
- virtual_hook(QIconEngineV2::IconNameHook, reinterpret_cast<void*>(&name));
+ const_cast<QIconEngine *>(this)->virtual_hook(QIconEngine::IconNameHook, reinterpret_cast<void*>(&name));
return name;
}
diff --git a/src/widgets/kernel/qiconengine.h b/src/widgets/kernel/qiconengine.h
index 083ceee33d..acadef97c3 100644
--- a/src/widgets/kernel/qiconengine.h
+++ b/src/widgets/kernel/qiconengine.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -50,7 +50,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
class Q_WIDGETS_EXPORT QIconEngine
{
@@ -63,23 +62,11 @@ public:
virtual void addPixmap(const QPixmap &pixmap, QIcon::Mode mode, QIcon::State state);
virtual void addFile(const QString &fileName, const QSize &size, QIcon::Mode mode, QIcon::State state);
-#if 0
- virtual int frameCount(QIcon::Mode fromMode, QIcon::State fromState, QIcon::Mode toMode, QIcon::State toState);
- virtual void paintFrame(QPainter *painter, const QRect &rect, int frameNumber, QIcon::Mode fromMode, QIcon::State fromState, QIcon::Mode toMode, QIcon::State toState);
-#endif
-};
-
-// ### Qt 5: move the below into QIconEngine
-class Q_WIDGETS_EXPORT QIconEngineV2 : public QIconEngine
-{
-public:
virtual QString key() const;
- virtual QIconEngineV2 *clone() const;
+ virtual QIconEngine *clone() const = 0;
virtual bool read(QDataStream &in);
virtual bool write(QDataStream &out) const;
- virtual void virtual_hook(int id, void *data);
-public:
enum IconEngineHook { AvailableSizesHook = 1, IconNameHook };
struct AvailableSizesArgument
@@ -89,14 +76,18 @@ public:
QList<QSize> sizes;
};
- // ### Qt 5: make this function const and virtual.
- QList<QSize> availableSizes(QIcon::Mode mode = QIcon::Normal,
- QIcon::State state = QIcon::Off);
+ virtual QList<QSize> availableSizes(QIcon::Mode mode = QIcon::Normal,
+ QIcon::State state = QIcon::Off) const;
+
+ virtual QString iconName() const;
- // ### Qt 5: make this function const and virtual.
- QString iconName();
+ virtual void virtual_hook(int id, void *data);
};
+#if QT_DEPRECATED_SINCE(5, 0)
+typedef QIconEngine QIconEngineV2;
+#endif
+
QT_END_NAMESPACE
QT_END_HEADER
diff --git a/src/widgets/kernel/qiconengineplugin.cpp b/src/widgets/kernel/qiconengineplugin.cpp
index 895572120e..ced4f5dd3e 100644
--- a/src/widgets/kernel/qiconengineplugin.cpp
+++ b/src/widgets/kernel/qiconengineplugin.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -103,72 +103,5 @@ QIconEnginePlugin::~QIconEnginePlugin()
{
}
-// version 2
-
-/*!
- \class QIconEnginePluginV2
- \brief The QIconEnginePluginV2 class provides an abstract base for custom QIconEngineV2 plugins.
-
- \ingroup plugins
- \inmodule QtWidgets
-
- \since 4.3
-
- Icon engine plugins produces \l{QIconEngine}s for \l{QIcon}s; an
- icon engine is used to render the icon. The keys that identifies
- the engines the plugin can create are suffixes of
- icon filenames; they are returned by keys(). The create() function
- receives the icon filename to return an engine for; it should
- return 0 if it cannot produce an engine for the file.
-
- Writing an icon engine plugin is achieved by inheriting
- QIconEnginePluginV2, reimplementing keys() and create(), and
- adding the Q_EXPORT_PLUGIN2() macro.
-
- You should ensure that you do not duplicate keys. Qt will query
- the plugins for icon engines in the order in which the plugins are
- found during plugin search (see the plugins \l{How to Create Qt
- Plugins}{overview document}).
-
- \sa {How to Create Qt Plugins}
-*/
-
-/*!
- \fn QStringList QIconEnginePluginV2::keys() const
-
- Returns a list of icon engine keys that this plugin supports. The keys correspond
- to the suffix of the file or resource name used when the plugin was created.
- Keys are case insensitive.
-
- \sa create()
-*/
-
-/*!
- \fn QIconEngineV2* QIconEnginePluginV2::create(const QString& filename = QString())
-
- Creates and returns a QIconEngine object for the icon with the given
- \a filename.
-
- \sa keys()
-*/
-
-/*!
- Constructs a icon engine plugin with the given \a parent. This is invoked
- automatically by the Q_EXPORT_PLUGIN2() macro.
-*/
-QIconEnginePluginV2::QIconEnginePluginV2(QObject *parent)
- : QObject(parent)
-{
-}
-
-/*!
- Destroys the icon engine plugin.
-
- You never have to call this explicitly. Qt destroys a plugin
- automatically when it is no longer used.
-*/
-QIconEnginePluginV2::~QIconEnginePluginV2()
-{
-}
QT_END_NAMESPACE
diff --git a/src/widgets/kernel/qiconengineplugin.h b/src/widgets/kernel/qiconengineplugin.h
index 1bd9075866..a30c5475ba 100644
--- a/src/widgets/kernel/qiconengineplugin.h
+++ b/src/widgets/kernel/qiconengineplugin.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -49,18 +49,16 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
class QIconEngine;
-class QIconEngineV2;
struct Q_WIDGETS_EXPORT QIconEngineFactoryInterface : public QFactoryInterface
{
- virtual QIconEngine *create(const QString &filename) = 0;
+ virtual QIconEngine *create(const QString &filename = QString()) = 0;
};
#define QIconEngineFactoryInterface_iid \
- "com.trolltech.Qt.QIconEngineFactoryInterface"
+ "org.qt-project.Qt.QIconEngineFactoryInterface"
Q_DECLARE_INTERFACE(QIconEngineFactoryInterface, QIconEngineFactoryInterface_iid)
class Q_WIDGETS_EXPORT QIconEnginePlugin : public QObject, public QIconEngineFactoryInterface
@@ -72,29 +70,7 @@ public:
~QIconEnginePlugin();
virtual QStringList keys() const = 0;
- virtual QIconEngine *create(const QString &filename) = 0;
-};
-
-// ### Qt 5: remove version 2
-struct Q_WIDGETS_EXPORT QIconEngineFactoryInterfaceV2 : public QFactoryInterface
-{
- virtual QIconEngineV2 *create(const QString &filename = QString()) = 0;
-};
-
-#define QIconEngineFactoryInterfaceV2_iid \
- "com.trolltech.Qt.QIconEngineFactoryInterfaceV2"
-Q_DECLARE_INTERFACE(QIconEngineFactoryInterfaceV2, QIconEngineFactoryInterfaceV2_iid)
-
-class Q_WIDGETS_EXPORT QIconEnginePluginV2 : public QObject, public QIconEngineFactoryInterfaceV2
-{
- Q_OBJECT
- Q_INTERFACES(QIconEngineFactoryInterfaceV2:QFactoryInterface)
-public:
- QIconEnginePluginV2(QObject *parent = 0);
- ~QIconEnginePluginV2();
-
- virtual QStringList keys() const = 0;
- virtual QIconEngineV2 *create(const QString &filename = QString()) = 0;
+ virtual QIconEngine *create(const QString &filename = QString()) = 0;
};
QT_END_NAMESPACE
diff --git a/src/widgets/kernel/qiconloader.cpp b/src/widgets/kernel/qiconloader.cpp
index d8bef74dd8..0b86189b5e 100644
--- a/src/widgets/kernel/qiconloader.cpp
+++ b/src/widgets/kernel/qiconloader.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -45,6 +45,7 @@
#include <private/qicon_p.h>
#include <private/qguiplatformplugin_p.h>
+#include <QtWidgets/QApplication>
#include <QtWidgets/QIconEnginePlugin>
#include <QtGui/QPixmapCache>
#include <QtWidgets/QIconEngine>
@@ -104,7 +105,7 @@ void QIconLoader::ensureInitialized()
if (m_systemTheme.isEmpty())
m_systemTheme = fallbackTheme();
#ifndef QT_NO_LIBRARY
- QFactoryLoader iconFactoryLoader(QIconEngineFactoryInterfaceV2_iid,
+ QFactoryLoader iconFactoryLoader(QIconEngineFactoryInterface_iid,
QLatin1String("/iconengines"),
Qt::CaseInsensitive);
if (iconFactoryLoader.keys().contains(QLatin1String("svg")))
@@ -322,13 +323,13 @@ QIconLoaderEngine::~QIconLoaderEngine()
}
QIconLoaderEngine::QIconLoaderEngine(const QIconLoaderEngine &other)
- : QIconEngineV2(other),
+ : QIconEngine(other),
m_iconName(other.m_iconName),
m_key(0)
{
}
-QIconEngineV2 *QIconLoaderEngine::clone() const
+QIconEngine *QIconLoaderEngine::clone() const
{
return new QIconLoaderEngine(*this);
}
@@ -477,7 +478,7 @@ QSize QIconLoaderEngine::actualSize(const QSize &size, QIcon::Mode mode,
return QSize(result, result);
}
}
- return QIconEngineV2::actualSize(size, mode, state);
+ return QIconEngine::actualSize(size, mode, state);
}
QPixmap PixmapEntry::pixmap(const QSize &size, QIcon::Mode mode, QIcon::State state)
@@ -489,7 +490,6 @@ QPixmap PixmapEntry::pixmap(const QSize &size, QIcon::Mode mode, QIcon::State st
if (basePixmap.isNull())
basePixmap.load(filename);
-#if 0 // ### Qt5
int actualSize = qMin(size.width(), size.height());
QString key = QLatin1Literal("$qt_theme_")
% HexString<qint64>(basePixmap.cacheKey())
@@ -507,9 +507,6 @@ QPixmap PixmapEntry::pixmap(const QSize &size, QIcon::Mode mode, QIcon::State st
QPixmapCache::insert(key, cachedPixmap);
}
return cachedPixmap;
-#else
- return basePixmap;
-#endif
}
QPixmap ScalableEntry::pixmap(const QSize &size, QIcon::Mode mode, QIcon::State state)
@@ -543,10 +540,10 @@ void QIconLoaderEngine::virtual_hook(int id, void *data)
ensureLoaded();
switch (id) {
- case QIconEngineV2::AvailableSizesHook:
+ case QIconEngine::AvailableSizesHook:
{
- QIconEngineV2::AvailableSizesArgument &arg
- = *reinterpret_cast<QIconEngineV2::AvailableSizesArgument*>(data);
+ QIconEngine::AvailableSizesArgument &arg
+ = *reinterpret_cast<QIconEngine::AvailableSizesArgument*>(data);
const QList<QIconDirInfo> directoryKey = iconLoaderInstance()->theme().keyList();
arg.sizes.clear();
@@ -557,14 +554,14 @@ void QIconLoaderEngine::virtual_hook(int id, void *data)
}
}
break;
- case QIconEngineV2::IconNameHook:
+ case QIconEngine::IconNameHook:
{
QString &name = *reinterpret_cast<QString*>(data);
name = m_iconName;
}
break;
default:
- QIconEngineV2::virtual_hook(id, data);
+ QIconEngine::virtual_hook(id, data);
}
}
diff --git a/src/widgets/kernel/qiconloader_p.h b/src/widgets/kernel/qiconloader_p.h
index 840a2858b6..1b9043675b 100644
--- a/src/widgets/kernel/qiconloader_p.h
+++ b/src/widgets/kernel/qiconloader_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -109,7 +109,7 @@ struct PixmapEntry : public QIconLoaderEngineEntry
typedef QList<QIconLoaderEngineEntry*> QThemeIconEntries;
-class QIconLoaderEngine : public QIconEngineV2
+class QIconLoaderEngine : public QIconEngine
{
public:
QIconLoaderEngine(const QString& iconName = QString());
@@ -118,7 +118,7 @@ public:
void paint(QPainter *painter, const QRect &rect, QIcon::Mode mode, QIcon::State state);
QPixmap pixmap(const QSize &size, QIcon::Mode mode, QIcon::State state);
QSize actualSize(const QSize &size, QIcon::Mode mode, QIcon::State state);
- QIconEngineV2 *clone() const;
+ QIconEngine *clone() const;
bool read(QDataStream &in);
bool write(QDataStream &out) const;
diff --git a/src/widgets/kernel/qinputcontext.cpp b/src/widgets/kernel/qinputcontext.cpp
deleted file mode 100644
index 27576193e9..0000000000
--- a/src/widgets/kernel/qinputcontext.cpp
+++ /dev/null
@@ -1,408 +0,0 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
-
-/****************************************************************************
-**
-** Implementation of QInputContext class
-**
-** Copyright (C) 2003-2004 immodule for Qt Project. All rights reserved.
-**
-** This file is written to contribute to Nokia Corporation and/or its subsidiary(-ies) under their own
-** license. You may use this file under your Qt license. Following
-** description is copied from their original file headers. Contact
-** immodule-qt@freedesktop.org if any conditions of this licensing are
-** not clear to you.
-**
-****************************************************************************/
-
-//#define QT_NO_IM_PREEDIT_RELOCATION
-
-#include "qinputcontext.h"
-
-#ifndef QT_NO_IM
-
-#include "qplatformdefs.h"
-
-#include "qapplication.h"
-#include "qmenu.h"
-#include "qtextformat.h"
-#include "qpalette.h"
-#include <QtGui/qinputpanel.h>
-#include <QtGui/qevent.h>
-
-#include <stdlib.h>
-#include <limits.h>
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QInputContext
- \brief The QInputContext class abstracts the input method dependent data and composing state.
-
- \ingroup i18n
- \inmodule QtWidgets
-
- An input method is responsible for inputting complex text that cannot
- be inputted via simple keymap. It converts a sequence of input
- events (typically key events) into a text string through the input
- method specific converting process. The class of the processes are
- widely ranging from simple finite state machine to complex text
- translator that pools a whole paragraph of a text with text
- editing capability to perform grammar and semantic analysis.
-
- To abstract such different input method specific intermediate
- information, Qt offers the QInputContext as base class. The
- concept is well known as 'input context' in the input method
- domain. An input context is created for a text widget in response
- to a demand. It is ensured that an input context is prepared for
- an input method before input to a text widget.
-
- Multiple input contexts that belong to a single input method
- may concurrently coexist. Suppose multi-window text editor. Each
- text widget of window A and B holds different QInputContext
- instance which contains different state information such as
- partially composed text.
-
- \section1 Groups of Functions
-
- \table
- \header \o Context \o Functions
-
- \row \o Receiving information \o
- x11FilterEvent(),
- filterEvent(),
- mouseHandler()
-
- \row \o Sending back composed text \o
- sendEvent()
-
- \row \o State change notification \o
- setFocusWidget(),
- reset()
-
- \row \o Context information \o
- identifierName(),
- language(),
- font(),
- isComposing()
-
- \endtable
-
- \section1 Licensing Information
-
- \legalese
- Copyright (C) 2003-2004 immodule for Qt Project. All rights reserved.
-
- This file is written to contribute to Nokia Corporation and/or its subsidiary(-ies) under their own
- license. You may use this file under your Qt license. Following
- description is copied from their original file headers. Contact
- immodule-qt@freedesktop.org if any conditions of this licensing are
- not clear to you.
- \endlegalese
-
- \sa QInputContextPlugin, QInputContextFactory, QApplication::setInputContext()
-*/
-
-/*!
- Constructs an input context with the given \a parent.
-*/
-QInputContext::QInputContext(QObject* parent)
- : QObject(parent)
-{
-}
-
-
-/*!
- Destroys the input context.
-*/
-QInputContext::~QInputContext()
-{
-}
-
-/*!
- Returns the widget that has an input focus for this input
- context.
-
- The return value may differ from holderWidget() if the input
- context is shared between several text widgets.
-
- \warning To ensure platform independence and support flexible
- configuration of widgets, ordinary input methods should not call
- this function directly.
-
- \sa setFocusWidget()
-*/
-QWidget *QInputContext::focusWidget() const
-{
- return qobject_cast<QWidget *>(qApp->inputPanel()->inputItem());
-}
-
-
-/*!
- Sets the \a widget that has an input focus for this input context.
-
- \warning Ordinary input methods must not call this function
- directly.
-
- \sa focusWidget()
-*/
-void QInputContext::setFocusWidget(QWidget *widget)
-{
- qApp->inputPanel()->setInputItem(widget);
-}
-
-/*!
- \fn bool QInputContext::isComposing() const
- \obsolete
-
- This function indicates whether InputMethodStart event had been
- sent to the current focus widget. It is ensured that an input
- context can send InputMethodCompose or InputMethodEnd event safely
- if this function returned true.
-
- The state is automatically being tracked through sendEvent().
-
- \sa sendEvent()
-*/
-
-
-/*!
- Sends an input method event specified by \a event to the current focus
- widget. Implementations of QInputContext should call this method to
- send the generated input method events and not
- QApplication::sendEvent(), as the events might have to get dispatched
- to a different application on some platforms.
-
- Some complex input methods route the handling to several child
- contexts (e.g. to enable language switching). To account for this,
- QInputContext will check if the parent object is a QInputContext. If
- yes, it will call the parents sendEvent() implementation instead of
- sending the event directly.
-
- \sa QInputMethodEvent
-*/
-void QInputContext::sendEvent(const QInputMethodEvent &event)
-{
-
- QObject *focus = qApp->inputPanel()->inputItem();
- if (!focus)
- return;
-
- QInputMethodEvent e(event);
- QApplication::sendEvent(focus, &e);
-}
-
-
-/*!
- This function can be reimplemented in a subclass to handle mouse
- press, release, double-click, and move events within the preedit
- text. You can use the function to implement mouse-oriented user
- interface such as text selection or popup menu for candidate
- selection.
-
- The \a x parameter is the offset within the string that was sent
- with the InputMethodCompose event. The alteration boundary of \a
- x is ensured as character boundary of preedit string accurately.
-
- The \a event parameter is the event that was sent to the editor
- widget. The event type is QEvent::MouseButtonPress,
- QEvent::MouseButtonRelease, QEvent::MouseButtonDblClick or
- QEvent::MouseMove. The event's button and state indicate
- the kind of operation that was performed.
-*/
-void QInputContext::mouseHandler(int x, QMouseEvent *event)
-{
- if (event->type() == QEvent::MouseButtonRelease)
- qApp->inputPanel()->invokeAction(QInputPanel::Click, x);
-}
-
-
-/*!
- Returns the font of the current input widget
-*/
-QFont QInputContext::font() const
-{
- QWidget *focus = focusWidget();
- if (!focus)
- return QApplication::font();
-
- return qvariant_cast<QFont>(focus->inputMethodQuery(Qt::ImFont));
-}
-
-/*!
- This virtual function is called when a state in the focus widget
- has changed. QInputContext can then use
- QWidget::inputMethodQuery() to query the new state of the widget.
-*/
-void QInputContext::update()
-{
- qApp->inputPanel()->update(Qt::ImQueryAll);
-}
-
-/*!
- This virtual function is called when the specified \a widget is
- destroyed. The \a widget is a widget on which this input context
- is installed.
-*/
-void QInputContext::widgetDestroyed(QWidget *widget)
-{
- Q_UNUSED(widget)
- // nothing to be done here, as we use a weak pointer in the input panel
-}
-
-/*!
- \fn void QInputContext::reset()
-
- This function can be reimplemented in a subclass to reset the
- state of the input method.
-
- This function is called by several widgets to reset input
- state. For example, a text widget call this function before
- inserting a text to make widget ready to accept a text.
-
- Default implementation is sufficient for simple input method. You
- can override this function to reset external input method engines
- in complex input method. In the case, call QInputContext::reset()
- to ensure proper termination of inputting.
-
- In a reimplementation of reset(), you must not send any
- QInputMethodEvent containing preedit text. You can only commit
- string and attributes; otherwise, you risk breaking input state
- consistency.
-*/
-void QInputContext::reset()
-{
- qApp->inputPanel()->reset();
-}
-
-
-/*!
- \fn QString QInputContext::identifierName()
-
- This function must be implemented in any subclasses to return the
- identifier name of the input method.
-
- Return value is the name to identify and specify input methods for
- the input method switching mechanism and so on. The name has to be
- consistent with QInputContextPlugin::keys(). The name has to
- consist of ASCII characters only.
-
- There are two different names with different responsibility in the
- input method domain. This function returns one of them. Another
- name is called 'display name' that stands for the name for
- endusers appeared in a menu and so on.
-
- \sa QInputContextPlugin::keys(), QInputContextPlugin::displayName()
-*/
-QString QInputContext::identifierName()
-{
- return QLatin1String("qpa");
-}
-
-
-/*!
- \fn QString QInputContext::language()
-
- This function must be implemented in any subclasses to return a
- language code (e.g. "zh_CN", "zh_TW", "zh_HK", "ja", "ko", ...)
- of the input context. If the input context can handle multiple
- languages, return the currently used one. The name has to be
- consistent with QInputContextPlugin::language().
-
- This information will be used by language tagging feature in
- QInputMethodEvent. It is required to distinguish unified han characters
- correctly. It enables proper font and character code
- handling. Suppose CJK-awared multilingual web browser
- (that automatically modifies fonts in CJK-mixed text) and XML editor
- (that automatically inserts lang attr).
-*/
-QString QInputContext::language()
-{
- return QString();
-}
-
-
-/*!
- This is a preliminary interface for Qt 4.
-*/
-QList<QAction *> QInputContext::actions()
-{
- return QList<QAction *>();
-}
-
-/*!
- \enum QInputContext::StandardFormat
-
- \value PreeditFormat The preedit text.
- \value SelectionFormat The selection text.
-
- \sa standardFormat()
-*/
-
-/*!
- Returns a QTextFormat object that specifies the format for
- component \a s.
-*/
-QTextFormat QInputContext::standardFormat(StandardFormat s) const
-{
- QWidget *focus = focusWidget();
- const QPalette &pal = focus ? focus->palette() : QApplication::palette();
-
- QTextCharFormat fmt;
- QColor bg;
- switch (s) {
- case QInputContext::PreeditFormat: {
- fmt.setUnderlineStyle(QTextCharFormat::DashUnderline);
- break;
- }
- case QInputContext::SelectionFormat: {
- bg = pal.text().color();
- fmt.setBackground(QBrush(bg));
- fmt.setForeground(pal.background());
- break;
- }
- }
- return fmt;
-}
-
-QT_END_NAMESPACE
-
-#endif //Q_NO_IM
diff --git a/src/widgets/kernel/qinputcontext.h b/src/widgets/kernel/qinputcontext.h
deleted file mode 100644
index 147061f221..0000000000
--- a/src/widgets/kernel/qinputcontext.h
+++ /dev/null
@@ -1,128 +0,0 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
-
-/****************************************************************************
-**
-** Definition of QInputContext class
-**
-** Copyright (C) 2003-2004 immodule for Qt Project. All rights reserved.
-**
-** This file is written to contribute to Nokia Corporation and/or its subsidiary(-ies) under their own
-** license. You may use this file under your Qt license. Following
-** description is copied from their original file headers. Contact
-** immodule-qt@freedesktop.org if any conditions of this licensing are
-** not clear to you.
-**
-****************************************************************************/
-
-#ifndef QINPUTCONTEXT_H
-#define QINPUTCONTEXT_H
-
-#include <QtCore/qobject.h>
-#include <QtCore/qglobal.h>
-#include <QtGui/qevent.h>
-#include <QtCore/qstring.h>
-#include <QtCore/qlist.h>
-#include <QtWidgets/qaction.h>
-
-#ifndef QT_NO_IM
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Gui)
-
-class QWidget;
-class QFont;
-class QPopupMenu;
-class QInputContextPrivate;
-
-class Q_WIDGETS_EXPORT QInputContext : public QObject
-{
- Q_OBJECT
-public:
- explicit QInputContext(QObject* parent = 0);
- virtual ~QInputContext();
-
- virtual QString identifierName();
- virtual QString language();
-
- virtual void reset();
- virtual void update();
-
- virtual void mouseHandler( int x, QMouseEvent *event);
- virtual QFont font() const;
-
- QWidget *focusWidget() const;
- virtual void setFocusWidget( QWidget *w );
-
- virtual void widgetDestroyed(QWidget *w);
-
- virtual QList<QAction *> actions();
-
- void sendEvent(const QInputMethodEvent &event);
-
- virtual bool isComposing() const { return false; }
-
- enum StandardFormat {
- PreeditFormat,
- SelectionFormat
- };
- QTextFormat standardFormat(StandardFormat s) const;
-private:
- friend class QWidget;
- friend class QWidgetPrivate;
- friend class QInputContextFactory;
- friend class QApplication;
-private: // Disabled copy constructor and operator=
- QInputContext( const QInputContext & );
- QInputContext &operator=( const QInputContext & );
-
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif //Q_NO_IM
-
-#endif // QINPUTCONTEXT_H
diff --git a/src/widgets/kernel/qlayout.cpp b/src/widgets/kernel/qlayout.cpp
index a682354df1..d5d739e431 100644
--- a/src/widgets/kernel/qlayout.cpp
+++ b/src/widgets/kernel/qlayout.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/kernel/qlayout.h b/src/widgets/kernel/qlayout.h
index 4d9213c1ec..5524443ab1 100644
--- a/src/widgets/kernel/qlayout.h
+++ b/src/widgets/kernel/qlayout.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -54,7 +54,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
class QLayout;
class QSize;
diff --git a/src/widgets/kernel/qlayout_p.h b/src/widgets/kernel/qlayout_p.h
index cc80987500..bf67c838f4 100644
--- a/src/widgets/kernel/qlayout_p.h
+++ b/src/widgets/kernel/qlayout_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/kernel/qlayoutengine.cpp b/src/widgets/kernel/qlayoutengine.cpp
index 38e6555658..7948c8df2e 100644
--- a/src/widgets/kernel/qlayoutengine.cpp
+++ b/src/widgets/kernel/qlayoutengine.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/kernel/qlayoutengine_p.h b/src/widgets/kernel/qlayoutengine_p.h
index 5f5d0aa49e..a7acf241ac 100644
--- a/src/widgets/kernel/qlayoutengine_p.h
+++ b/src/widgets/kernel/qlayoutengine_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/kernel/qlayoutitem.cpp b/src/widgets/kernel/qlayoutitem.cpp
index 732c941c74..860f1cc193 100644
--- a/src/widgets/kernel/qlayoutitem.cpp
+++ b/src/widgets/kernel/qlayoutitem.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/kernel/qlayoutitem.h b/src/widgets/kernel/qlayoutitem.h
index a09dcf33de..76aae6f794 100644
--- a/src/widgets/kernel/qlayoutitem.h
+++ b/src/widgets/kernel/qlayoutitem.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -51,7 +51,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
static const int QLAYOUTSIZE_MAX = INT_MAX/256/16;
diff --git a/src/widgets/kernel/qplatformdialoghelper_qpa.cpp b/src/widgets/kernel/qplatformdialoghelper_qpa.cpp
deleted file mode 100644
index cfe2b15572..0000000000
--- a/src/widgets/kernel/qplatformdialoghelper_qpa.cpp
+++ /dev/null
@@ -1,556 +0,0 @@
-/****************************************************************************
- **
- ** 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$
- **
- ****************************************************************************/
-
-#include "qplatformdialoghelper_qpa.h"
-
-#include <QtCore/QVariant>
-#include <QtCore/QSharedData>
-#include <QtCore/QSettings>
-#include <QtCore/QHash>
-#include <QtCore/QUrl>
-#include <QtGui/QColor>
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QPlatformDialogHelper
- \since 5.0
- \internal
- \brief The QPlatformDialogHelper class allows for platform-specific customization of dialogs.
-
-*/
-
-/*!
- \enum QPlatformDialogHelper::StyleHint
-
- This enum type specifies platform-specific style hints.
-
- \value SnapToDefaultButton Snap the mouse to the center of the default
- button. There is corresponding system
- setting on Windows.
-
- \sa styleHint()
-*/
-
-QPlatformDialogHelper::QPlatformDialogHelper()
-{
-}
-
-QPlatformDialogHelper::~QPlatformDialogHelper()
-{
-}
-
-QVariant QPlatformDialogHelper::styleHint(StyleHint hint) const
-{
- return QPlatformDialogHelper::defaultStyleHint(hint);
-}
-
-QVariant QPlatformDialogHelper::defaultStyleHint(QPlatformDialogHelper::StyleHint hint)
-{
- switch (hint) {
- case QPlatformDialogHelper::SnapToDefaultButton:
- return QVariant(false);
- }
- return QVariant();
-}
-
-void QPlatformDialogHelper::emitLaunchNativeAppModalPanel()
-{
- emit launchNativeAppModalPanel();
-}
-
-// Font dialog
-
-class QFontDialogOptionsPrivate : public QSharedData
-{
-public:
- QFontDialogOptionsPrivate() : options(0) {}
-
- QFontDialogOptions::FontDialogOptions options;
- QString windowTitle;
-};
-
-QFontDialogOptions::QFontDialogOptions() : d(new QFontDialogOptionsPrivate)
-{
-}
-
-QFontDialogOptions::QFontDialogOptions(const QFontDialogOptions &rhs) : d(rhs.d)
-{
-}
-
-QFontDialogOptions &QFontDialogOptions::operator=(const QFontDialogOptions &rhs)
-{
- if (this != &rhs)
- d = rhs.d;
- return *this;
-}
-
-QFontDialogOptions::~QFontDialogOptions()
-{
-}
-
-QString QFontDialogOptions::windowTitle() const
-{
- return d->windowTitle;
-}
-
-void QFontDialogOptions::setWindowTitle(const QString &title)
-{
- d->windowTitle = title;
-}
-
-void QFontDialogOptions::setOption(QFontDialogOptions::FontDialogOption option, bool on)
-{
- if (!(d->options & option) != !on)
- setOptions(d->options ^ option);
-}
-
-bool QFontDialogOptions::testOption(QFontDialogOptions::FontDialogOption option) const
-{
- return d->options & option;
-}
-
-void QFontDialogOptions::setOptions(FontDialogOptions options)
-{
- if (options != d->options)
- d->options = options;
-}
-
-QFontDialogOptions::FontDialogOptions QFontDialogOptions::options() const
-{
- return d->options;
-}
-
-const QSharedPointer<QFontDialogOptions> &QPlatformFontDialogHelper::options() const
-{
- return m_options;
-}
-
-void QPlatformFontDialogHelper::setOptions(const QSharedPointer<QFontDialogOptions> &options)
-{
- m_options = options;
-}
-
-// Color dialog
-
-class QColorDialogStaticData
-{
-public:
- enum { CustomColorCount = 16, StandardColorCount = 6 * 8 };
-
- QColorDialogStaticData();
- inline void readSettings();
- inline void writeSettings() const;
-
- QRgb customRgb[CustomColorCount];
- QRgb standardRgb[StandardColorCount];
- bool customSet;
-};
-
-QColorDialogStaticData::QColorDialogStaticData() : customSet(false)
-{
- int i = 0;
- for (int g = 0; g < 4; ++g)
- for (int r = 0; r < 4; ++r)
- for (int b = 0; b < 3; ++b)
- standardRgb[i++] = qRgb(r * 255 / 3, g * 255 / 3, b * 255 / 2);
- qFill(customRgb, customRgb + CustomColorCount, 0xffffffff);
- readSettings();
-}
-
-void QColorDialogStaticData::readSettings()
-{
-#ifndef QT_NO_SETTINGS
- const QSettings settings(QSettings::UserScope, QStringLiteral("Trolltech"));
- for (int i = 0; i < int(CustomColorCount); ++i) {
- const QVariant v = settings.value(QStringLiteral("Qt/customColors/") + QString::number(i));
- if (v.isValid())
- customRgb[i] = v.toUInt();
- }
-#endif
-}
-
-void QColorDialogStaticData::writeSettings() const
-{
-#ifndef QT_NO_SETTINGS
- if (!customSet) {
- QSettings settings(QSettings::UserScope, QStringLiteral("Trolltech"));
- for (int i = 0; i < int(CustomColorCount); ++i)
- settings.setValue(QStringLiteral("Qt/customColors/") + QString::number(i), customRgb[i]);
- }
-#endif
-}
-
-Q_GLOBAL_STATIC(QColorDialogStaticData, qColorDialogStaticData)
-
-class QColorDialogOptionsPrivate : public QSharedData
-{
-public:
- QColorDialogOptionsPrivate() : options(0) {}
- // Write out settings around destruction of dialogs
- ~QColorDialogOptionsPrivate() { qColorDialogStaticData()->writeSettings(); }
-
- QColorDialogOptions::ColorDialogOptions options;
- QString windowTitle;
-};
-
-QColorDialogOptions::QColorDialogOptions() : d(new QColorDialogOptionsPrivate)
-{
-}
-
-QColorDialogOptions::QColorDialogOptions(const QColorDialogOptions &rhs) : d(rhs.d)
-{
-}
-
-QColorDialogOptions &QColorDialogOptions::operator=(const QColorDialogOptions &rhs)
-{
- if (this != &rhs)
- d = rhs.d;
- return *this;
-}
-
-QColorDialogOptions::~QColorDialogOptions()
-{
-}
-
-QString QColorDialogOptions::windowTitle() const
-{
- return d->windowTitle;
-}
-
-void QColorDialogOptions::setWindowTitle(const QString &title)
-{
- d->windowTitle = title;
-}
-
-void QColorDialogOptions::setOption(QColorDialogOptions::ColorDialogOption option, bool on)
-{
- if (!(d->options & option) != !on)
- setOptions(d->options ^ option);
-}
-
-bool QColorDialogOptions::testOption(QColorDialogOptions::ColorDialogOption option) const
-{
- return d->options & option;
-}
-
-void QColorDialogOptions::setOptions(ColorDialogOptions options)
-{
- if (options != d->options)
- d->options = options;
-}
-
-QColorDialogOptions::ColorDialogOptions QColorDialogOptions::options() const
-{
- return d->options;
-}
-
-int QColorDialogOptions::customColorCount()
-{
- return QColorDialogStaticData::CustomColorCount;
-}
-
-QRgb QColorDialogOptions::customColor(int index)
-{
- if (uint(index) >= uint(QColorDialogStaticData::CustomColorCount))
- return qRgb(255, 255, 255);
- return qColorDialogStaticData()->customRgb[index];
-}
-
-QRgb *QColorDialogOptions::customColors()
-{
- return qColorDialogStaticData()->customRgb;
-}
-
-void QColorDialogOptions::setCustomColor(int index, QRgb color)
-{
- if (uint(index) >= uint(QColorDialogStaticData::CustomColorCount))
- return;
- qColorDialogStaticData()->customSet;
- qColorDialogStaticData()->customRgb[index] = color;
-}
-
-QRgb *QColorDialogOptions::standardColors()
-{
- return qColorDialogStaticData()->standardRgb;
-}
-
-QRgb QColorDialogOptions::standardColor(int index)
-{
- if (uint(index) >= uint(QColorDialogStaticData::StandardColorCount))
- return qRgb(255, 255, 255);
- return qColorDialogStaticData()->standardRgb[index];
-}
-
-void QColorDialogOptions::setStandardColor(int index, QRgb color)
-{
- if (uint(index) >= uint(QColorDialogStaticData::StandardColorCount))
- return;
- qColorDialogStaticData()->standardRgb[index] = color;
-}
-
-const QSharedPointer<QColorDialogOptions> &QPlatformColorDialogHelper::options() const
-{
- return m_options;
-}
-
-void QPlatformColorDialogHelper::setOptions(const QSharedPointer<QColorDialogOptions> &options)
-{
- m_options = options;
-}
-
-// File dialog
-
-class QFileDialogOptionsPrivate : public QSharedData
-{
-public:
- QFileDialogOptionsPrivate() : options(0),
- viewMode(QFileDialogOptions::Detail),
- fileMode(QFileDialogOptions::AnyFile),
- acceptMode(QFileDialogOptions::AcceptOpen),
- filters(QDir::AllEntries | QDir::NoDotAndDotDot | QDir::AllDirs)
- {}
-
- QFileDialogOptions::FileDialogOptions options;
- QString windowTitle;
-
- QFileDialogOptions::ViewMode viewMode;
- QFileDialogOptions::FileMode fileMode;
- QFileDialogOptions::AcceptMode acceptMode;
- QString labels[QFileDialogOptions::DialogLabelCount];
- QDir::Filters filters;
- QList<QUrl> sidebarUrls;
- QStringList nameFilters;
- QString defaultSuffix;
- QStringList history;
- QString initialDirectory;
- QString initiallySelectedNameFilter;
- QStringList initiallySelectedFiles;
-};
-
-QFileDialogOptions::QFileDialogOptions() : d(new QFileDialogOptionsPrivate)
-{
-}
-
-QFileDialogOptions::QFileDialogOptions(const QFileDialogOptions &rhs) : d(rhs.d)
-{
-}
-
-QFileDialogOptions &QFileDialogOptions::operator=(const QFileDialogOptions &rhs)
-{
- if (this != &rhs)
- d = rhs.d;
- return *this;
-}
-
-QFileDialogOptions::~QFileDialogOptions()
-{
-}
-
-QString QFileDialogOptions::windowTitle() const
-{
- return d->windowTitle;
-}
-
-void QFileDialogOptions::setWindowTitle(const QString &title)
-{
- d->windowTitle = title;
-}
-
-void QFileDialogOptions::setOption(QFileDialogOptions::FileDialogOption option, bool on)
-{
- if (!(d->options & option) != !on)
- setOptions(d->options ^ option);
-}
-
-bool QFileDialogOptions::testOption(QFileDialogOptions::FileDialogOption option) const
-{
- return d->options & option;
-}
-
-void QFileDialogOptions::setOptions(FileDialogOptions options)
-{
- if (options != d->options)
- d->options = options;
-}
-
-QFileDialogOptions::FileDialogOptions QFileDialogOptions::options() const
-{
- return d->options;
-}
-
-QDir::Filters QFileDialogOptions::filter() const
-{
- return d->filters;
-}
-
-void QFileDialogOptions::setFilter(QDir::Filters filters)
-{
- d->filters = filters;
-}
-
-void QFileDialogOptions::setViewMode(QFileDialogOptions::ViewMode mode)
-{
- d->viewMode = mode;
-}
-
-QFileDialogOptions::ViewMode QFileDialogOptions::viewMode() const
-{
- return d->viewMode;
-}
-
-void QFileDialogOptions::setFileMode(QFileDialogOptions::FileMode mode)
-{
- d->fileMode = mode;
-}
-
-QFileDialogOptions::FileMode QFileDialogOptions::fileMode() const
-{
- return d->fileMode;
-}
-
-void QFileDialogOptions::setAcceptMode(QFileDialogOptions::AcceptMode mode)
-{
- d->acceptMode = mode;
-}
-
-QFileDialogOptions::AcceptMode QFileDialogOptions::acceptMode() const
-{
- return d->acceptMode;
-}
-
-void QFileDialogOptions::setSidebarUrls(const QList<QUrl> &urls)
-{
- d->sidebarUrls = urls;
-}
-
-QList<QUrl> QFileDialogOptions::sidebarUrls() const
-{
- return d->sidebarUrls;
-}
-
-void QFileDialogOptions::setNameFilters(const QStringList &filters)
-{
- d->nameFilters = filters;
-}
-
-QStringList QFileDialogOptions::nameFilters() const
-{
- return d->nameFilters;
-}
-
-void QFileDialogOptions::setDefaultSuffix(const QString &suffix)
-{
- d->defaultSuffix = suffix;
-}
-
-QString QFileDialogOptions::defaultSuffix() const
-{
- return d->defaultSuffix;
-}
-
-void QFileDialogOptions::setHistory(const QStringList &paths)
-{
- d->history = paths;
-}
-
-QStringList QFileDialogOptions::history() const
-{
- return d->history;
-}
-
-void QFileDialogOptions::setLabelText(QFileDialogOptions::DialogLabel label, const QString &text)
-{
- if (label >= 0 && label < DialogLabelCount)
- d->labels[label] = text;
-}
-
-QString QFileDialogOptions::labelText(QFileDialogOptions::DialogLabel label) const
-{
- return (label >= 0 && label < DialogLabelCount) ? d->labels[label] : QString();
-}
-
-bool QFileDialogOptions::isLabelExplicitlySet(DialogLabel label)
-{
- return label >= 0 && label < DialogLabelCount && !d->labels[label].isEmpty();
-}
-
-QString QFileDialogOptions::initialDirectory() const
-{
- return d->initialDirectory;
-}
-
-void QFileDialogOptions::setInitialDirectory(const QString &directory)
-{
- d->initialDirectory = directory;
-}
-
-QString QFileDialogOptions::initiallySelectedNameFilter() const
-{
- return d->initiallySelectedNameFilter;
-}
-
-void QFileDialogOptions::setInitiallySelectedNameFilter(const QString &filter)
-{
- d->initiallySelectedNameFilter = filter;
-}
-
-QStringList QFileDialogOptions::initiallySelectedFiles() const
-{
- return d->initiallySelectedFiles;
-}
-
-void QFileDialogOptions::setInitiallySelectedFiles(const QStringList &files)
-{
- d->initiallySelectedFiles = files;
-}
-
-const QSharedPointer<QFileDialogOptions> &QPlatformFileDialogHelper::options() const
-{
- return m_options;
-}
-
-void QPlatformFileDialogHelper::setOptions(const QSharedPointer<QFileDialogOptions> &options)
-{
- m_options = options;
-}
-
-QT_END_NAMESPACE
diff --git a/src/widgets/kernel/qplatformdialoghelper_qpa.h b/src/widgets/kernel/qplatformdialoghelper_qpa.h
deleted file mode 100644
index b0b8b3a5b3..0000000000
--- a/src/widgets/kernel/qplatformdialoghelper_qpa.h
+++ /dev/null
@@ -1,315 +0,0 @@
-/****************************************************************************
- **
- ** 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 QPLATFORMDIALOGHELPER_H
-#define QPLATFORMDIALOGHELPER_H
-
-#include <QtCore/QtGlobal>
-#include <QtCore/QObject>
-#include <QtCore/QList>
-#include <QtCore/QSharedDataPointer>
-#include <QtCore/QSharedPointer>
-#include <QtCore/QDir>
-#include <QtGui/QRgb>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Gui)
-
-class QString;
-class QColor;
-class QFont;
-class QWindow;
-class QVariant;
-class QUrl;
-class QColorDialogOptionsPrivate;
-class QFontDialogOptionsPrivate;
-class QFileDialogOptionsPrivate;
-
-class Q_WIDGETS_EXPORT QPlatformDialogHelper : public QObject
-{
- Q_OBJECT
-public:
- enum StyleHint {
- SnapToDefaultButton
- };
- enum DialogCode { Rejected, Accepted };
- enum ShowFlag {
- ShowModal = 0x00000001
- };
-
- Q_DECLARE_FLAGS(ShowFlags, ShowFlag)
-
- QPlatformDialogHelper();
- virtual ~QPlatformDialogHelper();
-
- virtual QVariant styleHint(StyleHint hint) const;
-
- virtual void platformNativeDialogModalHelp() = 0;
- virtual void _q_platformRunNativeAppModalPanel() = 0;
-
- virtual void deleteNativeDialog_sys() = 0;
- virtual bool show_sys(ShowFlags showFlags,
- Qt::WindowFlags windowFlags,
- QWindow *parent) = 0;
- virtual void hide_sys() = 0;
-
- virtual DialogCode dialogResultCode_sys() = 0;
-
- static QVariant defaultStyleHint(QPlatformDialogHelper::StyleHint hint);
-
-Q_SIGNALS:
- void launchNativeAppModalPanel();
- void accept();
- void reject();
-
-protected Q_SLOTS:
- void emitLaunchNativeAppModalPanel();
-};
-
-class Q_WIDGETS_EXPORT QColorDialogOptions
-{
-public:
- enum ColorDialogOption {
- ShowAlphaChannel = 0x00000001,
- NoButtons = 0x00000002,
- DontUseNativeDialog = 0x00000004
- };
-
- Q_DECLARE_FLAGS(ColorDialogOptions, ColorDialogOption)
-
- QColorDialogOptions();
- QColorDialogOptions(const QColorDialogOptions &rhs);
- QColorDialogOptions &operator=(const QColorDialogOptions &rhs);
- ~QColorDialogOptions();
-
- QString windowTitle() const;
- void setWindowTitle(const QString &);
-
- void setOption(ColorDialogOption option, bool on = true);
- bool testOption(ColorDialogOption option) const;
- void setOptions(ColorDialogOptions options);
- ColorDialogOptions options() const;
-
- static int customColorCount();
- static QRgb customColor(int index);
- static QRgb *customColors();
- static void setCustomColor(int index, QRgb color);
-
- static QRgb *standardColors();
- static QRgb standardColor(int index);
- static void setStandardColor(int index, QRgb color);
-
-private:
- QSharedDataPointer<QColorDialogOptionsPrivate> d;
-};
-
-class Q_WIDGETS_EXPORT QPlatformColorDialogHelper : public QPlatformDialogHelper
-{
- Q_OBJECT
-public:
- const QSharedPointer<QColorDialogOptions> &options() const;
- void setOptions(const QSharedPointer<QColorDialogOptions> &options);
-
- virtual void setCurrentColor_sys(const QColor &) = 0;
- virtual QColor currentColor_sys() const = 0;
-
-Q_SIGNALS:
- void currentColorChanged(const QColor &color);
- void colorSelected(const QColor &color);
-
-private:
- QSharedPointer<QColorDialogOptions> m_options;
-};
-
-class Q_WIDGETS_EXPORT QFontDialogOptions
-{
-public:
- enum FontDialogOption {
- NoButtons = 0x00000001,
- DontUseNativeDialog = 0x00000002
- };
-
- Q_DECLARE_FLAGS(FontDialogOptions, FontDialogOption)
-
- QFontDialogOptions();
- QFontDialogOptions(const QFontDialogOptions &rhs);
- QFontDialogOptions &operator=(const QFontDialogOptions &rhs);
- ~QFontDialogOptions();
-
- QString windowTitle() const;
- void setWindowTitle(const QString &);
-
- void setOption(FontDialogOption option, bool on = true);
- bool testOption(FontDialogOption option) const;
- void setOptions(FontDialogOptions options);
- FontDialogOptions options() const;
-
-private:
- QSharedDataPointer<QFontDialogOptionsPrivate> d;
-};
-
-class Q_WIDGETS_EXPORT QPlatformFontDialogHelper : public QPlatformDialogHelper
-{
- Q_OBJECT
-public:
- virtual void setCurrentFont_sys(const QFont &) = 0;
- virtual QFont currentFont_sys() const = 0;
-
- const QSharedPointer<QFontDialogOptions> &options() const;
- void setOptions(const QSharedPointer<QFontDialogOptions> &options);
-
-Q_SIGNALS:
- void currentFontChanged(const QFont &font);
- void fontSelected(const QFont &font);
-
-private:
- QSharedPointer<QFontDialogOptions> m_options;
-};
-
-class Q_WIDGETS_EXPORT QFileDialogOptions
-{
-public:
- enum ViewMode { Detail, List };
- enum FileMode { AnyFile, ExistingFile, Directory, ExistingFiles, DirectoryOnly };
- enum AcceptMode { AcceptOpen, AcceptSave };
- enum DialogLabel { LookIn, FileName, FileType, Accept, Reject, DialogLabelCount };
-
- enum FileDialogOption
- {
- ShowDirsOnly = 0x00000001,
- DontResolveSymlinks = 0x00000002,
- DontConfirmOverwrite = 0x00000004,
- DontUseSheet = 0x00000008,
- DontUseNativeDialog = 0x00000010,
- ReadOnly = 0x00000020,
- HideNameFilterDetails = 0x00000040
- };
- Q_DECLARE_FLAGS(FileDialogOptions, FileDialogOption)
-
- QFileDialogOptions();
- QFileDialogOptions(const QFileDialogOptions &rhs);
- QFileDialogOptions &operator=(const QFileDialogOptions &rhs);
- ~QFileDialogOptions();
-
- QString windowTitle() const;
- void setWindowTitle(const QString &);
-
- void setOption(FileDialogOption option, bool on = true);
- bool testOption(FileDialogOption option) const;
- void setOptions(FileDialogOptions options);
- FileDialogOptions options() const;
-
- QDir::Filters filter() const;
- void setFilter(QDir::Filters filters);
-
- void setViewMode(ViewMode mode);
- ViewMode viewMode() const;
-
- void setFileMode(FileMode mode);
- FileMode fileMode() const;
-
- void setAcceptMode(AcceptMode mode);
- AcceptMode acceptMode() const;
-
- void setSidebarUrls(const QList<QUrl> &urls);
- QList<QUrl> sidebarUrls() const;
-
- void setNameFilters(const QStringList &filters);
- QStringList nameFilters() const;
-
- void setDefaultSuffix(const QString &suffix);
- QString defaultSuffix() const;
-
- void setHistory(const QStringList &paths);
- QStringList history() const;
-
- void setLabelText(DialogLabel label, const QString &text);
- QString labelText(DialogLabel label) const;
- bool isLabelExplicitlySet(DialogLabel label);
-
- QString initialDirectory() const;
- void setInitialDirectory(const QString &);
-
- QString initiallySelectedNameFilter() const;
- void setInitiallySelectedNameFilter(const QString &);
-
- QStringList initiallySelectedFiles() const;
- void setInitiallySelectedFiles(const QStringList &);
-
-private:
- QSharedDataPointer<QFileDialogOptionsPrivate> d;
-};
-
-class Q_WIDGETS_EXPORT QPlatformFileDialogHelper : public QPlatformDialogHelper
-{
- Q_OBJECT
-public:
- virtual bool defaultNameFilterDisables() const = 0;
- virtual void setDirectory_sys(const QString &directory) = 0;
- virtual QString directory_sys() const = 0;
- virtual void selectFile_sys(const QString &filename) = 0;
- virtual QStringList selectedFiles_sys() const = 0;
- virtual void setFilter_sys() = 0;
- virtual void selectNameFilter_sys(const QString &filter) = 0;
- virtual QString selectedNameFilter_sys() const = 0;
-
- const QSharedPointer<QFileDialogOptions> &options() const;
- void setOptions(const QSharedPointer<QFileDialogOptions> &options);
-
-Q_SIGNALS:
- void fileSelected(const QString &file);
- void filesSelected(const QStringList &files);
- void currentChanged(const QString &path);
- void directoryEntered(const QString &directory);
- void filterSelected(const QString &filter);
-
-private:
- QSharedPointer<QFileDialogOptions> m_options;
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif // QPLATFORMDIALOGHELPER_H
diff --git a/src/widgets/kernel/qplatformmenu_qpa.cpp b/src/widgets/kernel/qplatformmenu_qpa.cpp
index 2a11884a67..cf11ed811d 100644
--- a/src/widgets/kernel/qplatformmenu_qpa.cpp
+++ b/src/widgets/kernel/qplatformmenu_qpa.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtWidgets module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/kernel/qplatformmenu_qpa.h b/src/widgets/kernel/qplatformmenu_qpa.h
index b6473c0b15..cbd7eae6ac 100644
--- a/src/widgets/kernel/qplatformmenu_qpa.h
+++ b/src/widgets/kernel/qplatformmenu_qpa.h
@@ -1,43 +1,43 @@
/****************************************************************************
- **
- ** 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$
- **
- ****************************************************************************/
+**
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
+**
+** 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 QPLATFORMMENU_H
#define QPLATFORMMENU_H
@@ -50,7 +50,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
class QMenuPrivate;
class Q_WIDGETS_EXPORT QPlatformMenuAction
diff --git a/src/widgets/kernel/qshortcut.cpp b/src/widgets/kernel/qshortcut.cpp
index cb2d08956b..07c7a02d4d 100644
--- a/src/widgets/kernel/qshortcut.cpp
+++ b/src/widgets/kernel/qshortcut.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/kernel/qshortcut.h b/src/widgets/kernel/qshortcut.h
index 077028ccd3..bfb934bedb 100644
--- a/src/widgets/kernel/qshortcut.h
+++ b/src/widgets/kernel/qshortcut.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -49,7 +49,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
#ifndef QT_NO_SHORTCUT
diff --git a/src/widgets/kernel/qsizepolicy.h b/src/widgets/kernel/qsizepolicy.h
index 8932eb8ed8..5a3ef19e16 100644
--- a/src/widgets/kernel/qsizepolicy.h
+++ b/src/widgets/kernel/qsizepolicy.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -48,7 +48,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
class QVariant;
diff --git a/src/widgets/kernel/qsizepolicy.qdoc b/src/widgets/kernel/qsizepolicy.qdoc
index a0e565caff..670491e5dd 100644
--- a/src/widgets/kernel/qsizepolicy.qdoc
+++ b/src/widgets/kernel/qsizepolicy.qdoc
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -21,6 +20,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/kernel/qsoftkeymanager.cpp b/src/widgets/kernel/qsoftkeymanager.cpp
index a7c128337f..c0e7260d47 100644
--- a/src/widgets/kernel/qsoftkeymanager.cpp
+++ b/src/widgets/kernel/qsoftkeymanager.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -46,14 +46,6 @@
#include "private/qaction_p.h"
#include "private/qsoftkeymanager_common_p.h"
-#ifdef Q_WS_S60
-#include "private/qsoftkeymanager_s60_p.h"
-#endif
-
-#ifdef SYMBIAN_VERSION_SYMBIAN3
-#include "private/qt_s60_p.h"
-#endif
-
#ifndef QT_NO_SOFTKEYMANAGER
QT_BEGIN_NAMESPACE
@@ -94,41 +86,13 @@ QSoftKeyManager *QSoftKeyManager::instance()
}
QSoftKeyManager::QSoftKeyManager() :
-#ifdef Q_WS_S60
- QObject(*(new QSoftKeyManagerPrivateS60), 0)
-#else
QObject(*(new QSoftKeyManagerPrivate), 0)
-#endif
{
}
QAction *QSoftKeyManager::createAction(StandardSoftKey standardKey, QWidget *actionWidget)
{
QAction *action = new QAction(standardSoftKeyText(standardKey), actionWidget);
-#ifdef SYMBIAN_VERSION_SYMBIAN3
- int key = 0;
- switch (standardKey) {
- case OkSoftKey:
- key = EAknSoftkeyOk;
- break;
- case SelectSoftKey:
- key = EAknSoftkeySelect;
- break;
- case DoneSoftKey:
- key = EAknSoftkeyDone;
- break;
- case MenuSoftKey:
- key = EAknSoftkeyOptions;
- break;
- case CancelSoftKey:
- key = EAknSoftkeyCancel;
- break;
- default:
- break;
- };
- if (key != 0)
- QSoftKeyManager::instance()->d_func()->softKeyCommandActions.insert(action, key);
-#endif
QAction::SoftKeyRole softKeyRole = QAction::NoSoftKey;
switch (standardKey) {
case MenuSoftKey: // FALL-THROUGH
@@ -171,9 +135,6 @@ void QSoftKeyManager::cleanupHash(QObject *obj)
Q_D(QSoftKeyManager);
QAction *action = qobject_cast<QAction*>(obj);
d->keyedActions.remove(action);
-#ifdef SYMBIAN_VERSION_SYMBIAN3
- d->softKeyCommandActions.remove(action);
-#endif
}
void QSoftKeyManager::sendKeyEvent()
@@ -305,15 +266,5 @@ bool QSoftKeyManager::event(QEvent *e)
return false;
}
-#ifdef Q_WS_S60
-bool QSoftKeyManager::handleCommand(int command)
-{
- if (QSoftKeyManager::instance()->d_func()->pendingUpdate)
- (void)QSoftKeyManager::instance()->handleUpdateSoftKeys();
-
- return static_cast<QSoftKeyManagerPrivateS60*>(QSoftKeyManager::instance()->d_func())->handleCommand(command);
-}
-#endif
-
QT_END_NAMESPACE
#endif //QT_NO_SOFTKEYMANAGER
diff --git a/src/widgets/kernel/qsoftkeymanager_common_p.h b/src/widgets/kernel/qsoftkeymanager_common_p.h
index 121d4f8e22..2a170d30d8 100644
--- a/src/widgets/kernel/qsoftkeymanager_common_p.h
+++ b/src/widgets/kernel/qsoftkeymanager_common_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -74,9 +74,6 @@ protected:
QMultiHash<int, QAction*> requestedSoftKeyActions;
QWidget *initialSoftKeySource;
bool pendingUpdate;
-#ifdef SYMBIAN_VERSION_SYMBIAN3
- QHash<QAction*, int> softKeyCommandActions;
-#endif
};
QT_END_NAMESPACE
diff --git a/src/widgets/kernel/qsoftkeymanager_p.h b/src/widgets/kernel/qsoftkeymanager_p.h
index ad49a1b586..2b0cea5eea 100644
--- a/src/widgets/kernel/qsoftkeymanager_p.h
+++ b/src/widgets/kernel/qsoftkeymanager_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -79,9 +79,6 @@ public:
};
static void updateSoftKeys();
-#ifdef Q_WS_S60
- static bool handleCommand(int);
-#endif
static QAction *createAction(StandardSoftKey standardKey, QWidget *actionWidget);
static QAction *createKeyedAction(StandardSoftKey standardKey, Qt::Key key, QWidget *actionWidget);
diff --git a/src/widgets/kernel/qstackedlayout.cpp b/src/widgets/kernel/qstackedlayout.cpp
index 7179ddc62c..9b40063e65 100644
--- a/src/widgets/kernel/qstackedlayout.cpp
+++ b/src/widgets/kernel/qstackedlayout.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/kernel/qstackedlayout.h b/src/widgets/kernel/qstackedlayout.h
index e80e909eae..e54efa886e 100644
--- a/src/widgets/kernel/qstackedlayout.h
+++ b/src/widgets/kernel/qstackedlayout.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -48,7 +48,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
class QStackedLayoutPrivate;
diff --git a/src/widgets/kernel/qstandardgestures.cpp b/src/widgets/kernel/qstandardgestures.cpp
index 3a9bd2bc38..58c3dbf165 100644
--- a/src/widgets/kernel/qstandardgestures.cpp
+++ b/src/widgets/kernel/qstandardgestures.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/kernel/qstandardgestures_p.h b/src/widgets/kernel/qstandardgestures_p.h
index 28b0b71797..7e23288a2c 100644
--- a/src/widgets/kernel/qstandardgestures_p.h
+++ b/src/widgets/kernel/qstandardgestures_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/kernel/qt_widgets_pch.h b/src/widgets/kernel/qt_widgets_pch.h
index 8e8985d21f..e742623651 100644
--- a/src/widgets/kernel/qt_widgets_pch.h
+++ b/src/widgets/kernel/qt_widgets_pch.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/kernel/qtooltip.cpp b/src/widgets/kernel/qtooltip.cpp
index fc0efc3dc2..0bd831c974 100644
--- a/src/widgets/kernel/qtooltip.cpp
+++ b/src/widgets/kernel/qtooltip.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/kernel/qtooltip.h b/src/widgets/kernel/qtooltip.h
index 8218a18338..3fb98e0502 100644
--- a/src/widgets/kernel/qtooltip.h
+++ b/src/widgets/kernel/qtooltip.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -48,7 +48,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
#ifndef QT_NO_TOOLTIP
diff --git a/src/widgets/kernel/qwhatsthis.cpp b/src/widgets/kernel/qwhatsthis.cpp
index e1a1cd05ef..3d8bb5e4bf 100644
--- a/src/widgets/kernel/qwhatsthis.cpp
+++ b/src/widgets/kernel/qwhatsthis.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -411,7 +411,7 @@ QWhatsThisPrivate::QWhatsThisPrivate()
#endif
}
#ifndef QT_NO_ACCESSIBILITY
- QAccessible::updateAccessibility(this, 0, QAccessible::ContextHelpStart);
+ QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::ContextHelpStart, this, 0));
#endif
}
@@ -423,7 +423,7 @@ QWhatsThisPrivate::~QWhatsThisPrivate()
QApplication::restoreOverrideCursor();
#endif
#ifndef QT_NO_ACCESSIBILITY
- QAccessible::updateAccessibility(this, 0, QAccessible::ContextHelpEnd);
+ QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::ContextHelpEnd, this, 0));
#endif
instance = 0;
}
diff --git a/src/widgets/kernel/qwhatsthis.h b/src/widgets/kernel/qwhatsthis.h
index 93e97ddff8..3ab3514365 100644
--- a/src/widgets/kernel/qwhatsthis.h
+++ b/src/widgets/kernel/qwhatsthis.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -49,7 +49,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
#ifndef QT_NO_WHATSTHIS
diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp
index 531a217b1d..4709a89d27 100644
--- a/src/widgets/kernel/qwidget.cpp
+++ b/src/widgets/kernel/qwidget.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -60,9 +60,6 @@
#ifndef QT_NO_ACCESSIBILITY
# include "qaccessible.h"
#endif
-#if defined(Q_WS_WIN)
-# include "qt_windows.h"
-#endif
#ifdef Q_WS_MAC
# include "qt_mac_p.h"
# include "qt_cocoa_helpers_mac_p.h"
@@ -78,10 +75,9 @@
#include "qdebug.h"
#include "private/qstylesheetstyle_p.h"
#include "private/qstyle_p.h"
-#include "qinputcontext.h"
#include "qfileinfo.h"
#include "private/qsoftkeymanager_p.h"
-#include <QtGui/qinputpanel.h>
+#include <QtGui/qinputmethod.h>
#include <private/qgraphicseffect_p.h>
#include <qbackingstore.h>
@@ -92,6 +88,7 @@
#include <private/qpaintengine_raster_p.h>
#include "qwidget_p.h"
+#include <QtGui/private/qwindow_p.h>
#include "qaction_p.h"
#include "qlayout_p.h"
#include "QtWidgets/qgraphicsproxywidget.h"
@@ -107,9 +104,6 @@
#include "qtabwidget.h" // Needed in inTabWidget()
#endif // QT_KEYPAD_NAVIGATION
-#ifdef Q_WS_S60
-#include <aknappui.h>
-#endif
// widget/widget data creation count
//#define QWIDGET_EXTRA_DEBUG
@@ -355,32 +349,14 @@ void QWidgetPrivate::scrollChildren(int dx, int dy)
void QWidgetPrivate::updateWidgetTransform()
{
Q_Q(QWidget);
- if (q == qApp->inputPanel()->inputItem()) {
+ if (q == qGuiApp->focusObject()) {
QTransform t;
QPoint p = q->mapTo(q->topLevelWidget(), QPoint(0,0));
t.translate(p.x(), p.y());
- qApp->inputPanel()->setInputItemTransform(t);
+ qApp->inputMethod()->setInputItemTransform(t);
}
}
-/*!
- This function returns the QInputContext for this widget. By
- default the input context is inherited from the widgets
- parent. For toplevels it is inherited from QApplication.
-
- You can override this and set a special input context for this
- widget by using the setInputContext() method.
-
- \sa setInputContext()
-*/
-QInputContext *QWidget::inputContext()
-{
- if (!testAttribute(Qt::WA_InputMethodEnabled))
- return 0;
-
- return qApp->inputContext();
-}
-
#ifdef QT_KEYPAD_NAVIGATION
QPointer<QWidget> QWidgetPrivate::editingWidget;
@@ -407,8 +383,7 @@ bool QWidget::hasEditFocus() const
normally; otherwise, Qt::Key_Up and Qt::Key_Down are used to
change focus.
- This feature is only available in Qt for Embedded Linux and Qt
- for Symbian.
+ This feature is only available in Qt for Embedded Linux.
\sa hasEditFocus(), QApplication::keypadNavigationEnabled()
*/
@@ -2052,14 +2027,6 @@ void QWidgetPrivate::updateIsOpaque()
}
#endif
-#ifdef Q_WS_S60
- if (q->windowType() == Qt::Dialog && q->testAttribute(Qt::WA_TranslucentBackground)
- && S60->avkonComponentsSupportTransparency) {
- setOpaque(false);
- return;
- }
-#endif
-
if (q->testAttribute(Qt::WA_OpaquePaintEvent) || q->testAttribute(Qt::WA_PaintOnScreen)) {
setOpaque(true);
return;
@@ -2126,11 +2093,6 @@ static inline void fillRegion(QPainter *painter, const QRegion &rgn, const QBrus
extern void qt_mac_fill_background(QPainter *painter, const QRegion &rgn, const QBrush &brush);
qt_mac_fill_background(painter, rgn, brush);
#else
-#if !defined(QT_NO_STYLE_S60)
- // Defined in qs60style.cpp
- extern bool qt_s60_fill_background(QPainter *painter, const QRegion &rgn, const QBrush &brush);
- if (!qt_s60_fill_background(painter, rgn, brush))
-#endif // !defined(QT_NO_STYLE_S60)
{
const QRect rect(rgn.boundingRect());
painter->setClipRegion(rgn);
@@ -3125,10 +3087,10 @@ void QWidgetPrivate::setEnabled_helper(bool enable)
if (enable) {
if (focusWidget->testAttribute(Qt::WA_InputMethodEnabled))
- qApp->inputPanel()->setInputItem(focusWidget);
+ qApp->inputMethod()->update(Qt::ImEnabled);
} else {
- qApp->inputPanel()->reset();
- qApp->inputPanel()->setInputItem(0);
+ qApp->inputMethod()->reset();
+ qApp->inputMethod()->update(Qt::ImEnabled);
}
}
#endif //QT_NO_IM
@@ -6003,7 +5965,7 @@ void QWidget::setFocus(Qt::FocusReason reason)
// menus update the focus manually and this would create bogus events
if (!(f->inherits("QMenuBar") || f->inherits("QMenu") || f->inherits("QMenuItem")))
# endif
- QAccessible::updateAccessibility(f, 0, QAccessible::Focus);
+ QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::Focus, f, 0));
#endif
#ifndef QT_NO_GRAPHICSVIEW
if (QWExtra *topData = window()->d_func()->extra) {
@@ -6083,7 +6045,7 @@ void QWidget::clearFocus()
#endif
{
#ifndef QT_NO_ACCESSIBILITY
- QAccessible::updateAccessibility(this, 0, QAccessible::Focus);
+ QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::Focus, this, 0));
#endif
}
}
@@ -7090,7 +7052,7 @@ void QWidgetPrivate::show_helper()
#ifndef QT_NO_ACCESSIBILITY
if (q->windowType() != Qt::ToolTip) // Tooltips are read aloud twice in MS narrator.
- QAccessible::updateAccessibility(q, 0, QAccessible::ObjectShow);
+ QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::ObjectShow, q, 0));
#endif
if (QApplicationPrivate::hidden_focus_widget == q) {
@@ -7181,7 +7143,7 @@ void QWidgetPrivate::hide_helper()
#ifndef QT_NO_ACCESSIBILITY
if (wasVisible)
- QAccessible::updateAccessibility(q, 0, QAccessible::ObjectHide);
+ QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::ObjectHide, q, 0));
#endif
}
@@ -7416,7 +7378,7 @@ void QWidgetPrivate::hideChildren(bool spontaneous)
qApp->d_func()->sendSyntheticEnterLeave(widget);
#ifndef QT_NO_ACCESSIBILITY
if (!spontaneous)
- QAccessible::updateAccessibility(widget, 0, QAccessible::ObjectHide);
+ QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::ObjectHide, widget, 0));
#endif
}
}
@@ -7451,23 +7413,11 @@ bool QWidgetPrivate::close_helper(CloseMode mode)
// Attempt to close the application only if this has WA_QuitOnClose set and a non-visible parent
quitOnClose = quitOnClose && (parentWidget.isNull() || !parentWidget->isVisible());
- if (quitOnClose) {
- /* if there is no non-withdrawn primary window left (except
- the ones without QuitOnClose), we emit the lastWindowClosed
- signal */
- QWidgetList list = QApplication::topLevelWidgets();
- bool lastWindowClosed = true;
- for (int i = 0; i < list.size(); ++i) {
- QWidget *w = list.at(i);
- if (!w->isVisible() || w->parentWidget() || !w->testAttribute(Qt::WA_QuitOnClose))
- continue;
- lastWindowClosed = false;
- break;
- }
- if (lastWindowClosed)
- QApplicationPrivate::emitLastWindowClosed();
+ if (quitOnClose && q->windowHandle()) {
+ static_cast<QWindowPrivate*>(QObjectPrivate::get(q->windowHandle()))->maybeQuitOnLastWindowClosed();
}
+
if (!that.isNull()) {
data.is_closing = 0;
if (q->testAttribute(Qt::WA_DeleteOnClose)) {
@@ -7929,6 +7879,8 @@ bool QWidget::event(QEvent *event)
Qt::InputMethodQuery q = (Qt::InputMethodQuery)(int)(queries & (1<<i));
if (q) {
QVariant v = inputMethodQuery(q);
+ if (q == Qt::ImEnabled && !v.isValid() && isEnabled())
+ v = QVariant(true); // special case for Qt4 compatibility
query->setValue(q, v);
}
}
@@ -8280,7 +8232,7 @@ void QWidget::changeEvent(QEvent * event)
case QEvent::EnabledChange:
update();
#ifndef QT_NO_ACCESSIBILITY
- QAccessible::updateAccessibility(this, 0, QAccessible::StateChanged);
+ QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::StateChanged, this, 0));
#endif
break;
@@ -8781,7 +8733,7 @@ void QWidget::inputMethodEvent(QInputMethodEvent *event)
\a query specifies which property is queried.
- \sa inputMethodEvent(), QInputMethodEvent, QInputContext, inputMethodHints
+ \sa inputMethodEvent(), QInputMethodEven, inputMethodHints
*/
QVariant QWidget::inputMethodQuery(Qt::InputMethodQuery query) const
{
@@ -8819,7 +8771,7 @@ QVariant QWidget::inputMethodQuery(Qt::InputMethodQuery query) const
\since 4.6
- \sa inputMethodQuery(), QInputContext
+ \sa inputMethodQuery()
*/
Qt::InputMethodHints QWidget::inputMethodHints() const
{
@@ -8840,7 +8792,7 @@ void QWidget::setInputMethodHints(Qt::InputMethodHints hints)
#ifndef QT_NO_IM
Q_D(QWidget);
d->imHints = hints;
- qApp->inputPanel()->update(Qt::ImHints);
+ qApp->inputMethod()->update(Qt::ImHints);
#endif //QT_NO_IM
}
@@ -8961,111 +8913,36 @@ void QWidget::hideEvent(QHideEvent *)
{
}
-/*
- \fn QWidget::x11Event(MSG *)
-
- This special event handler can be reimplemented in a subclass to receive
- native X11 events.
-
- In your reimplementation of this function, if you want to stop Qt from
- handling the event, return true. If you return false, this native event
- is passed back to Qt, which translates it into a Qt event and sends it to
- the widget.
-
- \note Events are only delivered to this event handler if the widget is
- native.
-
- \warning This function is not portable.
-
- \sa QApplication::x11EventFilter(), QWidget::winId()
-*/
-
-
-#if defined(Q_WS_MAC)
-
/*!
- \fn bool QWidget::macEvent(EventHandlerCallRef caller, EventRef event)
-
This special event handler can be reimplemented in a subclass to
- receive native Macintosh events.
-
- The parameters are a bit different depending if Qt is build against Carbon
- or Cocoa. In Carbon, \a caller and \a event are the corresponding
- EventHandlerCallRef and EventRef that correspond to the Carbon event
- handlers that are installed. In Cocoa, \a caller is always 0 and the
- EventRef is the EventRef generated from the NSEvent.
+ receive native platform events identified by \a eventType
+ which are passed in the \a message parameter.
In your reimplementation of this function, if you want to stop the
- event being handled by Qt, return true. If you return false, this
- native event is passed back to Qt, which translates the event into
- a Qt event and sends it to the widget.
+ event being handled by Qt, return true and set \a result.
+ If you return false, this native event is passed back to Qt,
+ which translates the event into a Qt event and sends it to the widget.
- \warning This function is not portable.
+ \note Events are only delivered to this event handler if the widget is
+ has a native Window handle.
- \warning This function was not called inside of Qt until Qt 4.4.
- If you need compatibility with earlier versions of Qt, consider QApplication::macEventFilter() instead.
+ \note This function superseedes the event filter functions
+ x11Event(), winEvent() and macEvent() of Qt 4.
- \sa QApplication::macEventFilter()
+ \table
+ \header \i Platform \i Event Type Identifier \i Message Type \i Result Type
+ \row \i Windows \i "windows_generic_MSG" \i MSG * \i LRESULT
+ \endtable
*/
-bool QWidget::macEvent(EventHandlerCallRef, EventRef)
-{
- return false;
-}
-
-#endif
-#if defined(Q_WS_WIN)
-
-/*!
- This special event handler can be reimplemented in a subclass to
- receive native Windows events which are passed in the \a message
- parameter.
-
- In your reimplementation of this function, if you want to stop the
- event being handled by Qt, return true and set \a result to the value
- that the window procedure should return. If you return false, this
- native event is passed back to Qt, which translates the event into
- a Qt event and sends it to the widget.
-
- \warning This function is not portable.
-
- \sa QApplication::winEventFilter()
-*/
-bool QWidget::winEvent(MSG *message, long *result)
+bool QWidget::nativeEvent(const QByteArray &eventType, void *message, long *result)
{
+ Q_UNUSED(eventType);
Q_UNUSED(message);
Q_UNUSED(result);
return false;
}
-#endif
-#if defined(Q_WS_X11)
-
-/*!
- \fn bool QWidget::x11Event(XEvent *event)
-
- This special event handler can be reimplemented in a subclass to receive
- native X11 events passed in the \a event parameter.
-
- In your reimplementation of this function, if you want to stop Qt from
- handling the event, return true. If you return false, this native event
- is passed back to Qt, which translates it into a Qt event and sends it to
- the widget.
-
- \note Events are only delivered to this event handler if the widget is
- native.
-
- \warning This function is not portable.
-
- \sa QApplication::x11EventFilter(), QWidget::winId()
-*/
-bool QWidget::x11Event(XEvent *)
-{
- return false;
-}
-
-#endif
-
/*!
Ensures that the widget has been polished by QStyle (i.e., has a
proper font and palette).
@@ -10134,8 +10011,8 @@ void QWidget::setAttribute(Qt::WidgetAttribute attribute, bool on)
QWidget *focusWidget = d->effectiveFocusWidget();
if (on && !internalWinId() && hasFocus()
&& focusWidget->testAttribute(Qt::WA_InputMethodEnabled)) {
- qApp->inputPanel()->reset();
- qApp->inputPanel()->setInputItem(0);
+ qApp->inputMethod()->reset();
+ qApp->inputMethod()->update(Qt::ImEnabled);
}
if (!qApp->testAttribute(Qt::AA_DontCreateNativeWidgetSiblings) && parentWidget()
#ifdef Q_WS_MAC
@@ -10149,7 +10026,7 @@ void QWidget::setAttribute(Qt::WidgetAttribute attribute, bool on)
d->createWinId();
if (isEnabled() && focusWidget->isEnabled()
&& focusWidget->testAttribute(Qt::WA_InputMethodEnabled)) {
- qApp->inputPanel()->setInputItem(focusWidget);
+ qApp->inputMethod()->update(Qt::ImEnabled);
}
#endif //QT_NO_IM
break;
@@ -10182,13 +10059,10 @@ void QWidget::setAttribute(Qt::WidgetAttribute attribute, bool on)
break;
case Qt::WA_InputMethodEnabled: {
#ifndef QT_NO_IM
- QWidget *focusWidget = d->effectiveFocusWidget();
- if (on && hasFocus() && isEnabled()
- && focusWidget->testAttribute(Qt::WA_InputMethodEnabled)) {
- qApp->inputPanel()->setInputItem(focusWidget);
- } else if (!on && qApp->inputPanel()->inputItem() == focusWidget) {
- qApp->inputPanel()->reset();
- qApp->inputPanel()->setInputItem(0);
+ if (qApp->focusObject() == this) {
+ if (!on)
+ qApp->inputMethod()->reset();
+ qApp->inputMethod()->update(Qt::ImEnabled);
}
#endif //QT_NO_IM
break;
@@ -10490,7 +10364,7 @@ void QWidget::setAccessibleName(const QString &name)
{
Q_D(QWidget);
d->accessibleName = name;
- QAccessible::updateAccessibility(this, 0, QAccessible::NameChanged);
+ QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::NameChanged, this, 0));
}
QString QWidget::accessibleName() const
@@ -10512,7 +10386,7 @@ void QWidget::setAccessibleDescription(const QString &description)
{
Q_D(QWidget);
d->accessibleDescription = description;
- QAccessible::updateAccessibility(this, 0, QAccessible::DescriptionChanged);
+ QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::DescriptionChanged, this, 0));
}
QString QWidget::accessibleDescription() const
@@ -10614,18 +10488,16 @@ void QWidget::setShortcutAutoRepeat(int id, bool enable)
/*!
Updates the widget's micro focus.
-
- \sa QInputContext
*/
void QWidget::updateMicroFocus()
{
// updating everything since this is currently called for any kind of state change
- qApp->inputPanel()->update(Qt::ImQueryAll);
+ qApp->inputMethod()->update(Qt::ImQueryAll);
#ifndef QT_NO_ACCESSIBILITY
if (isVisible()) {
// ##### is this correct
- QAccessible::updateAccessibility(this, 0, QAccessible::StateChanged);
+ QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::StateChanged, this, 0));
}
#endif
}
diff --git a/src/widgets/kernel/qwidget.h b/src/widgets/kernel/qwidget.h
index 60d4b8b698..0f13d0b7f6 100644
--- a/src/widgets/kernel/qwidget.h
+++ b/src/widgets/kernel/qwidget.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -64,7 +64,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
class QLayout;
class QWSRegionManager;
@@ -91,7 +90,6 @@ class QDragLeaveEvent;
class QDropEvent;
class QShowEvent;
class QHideEvent;
-class QInputContext;
class QIcon;
class QBackingStore;
class QPlatformWindow;
@@ -600,8 +598,6 @@ public:
void ensurePolished() const;
- QInputContext *inputContext();
-
bool isAncestorOf(const QWidget *child) const;
#ifdef QT_KEYPAD_NAVIGATION
@@ -661,19 +657,7 @@ protected:
virtual void showEvent(QShowEvent *);
virtual void hideEvent(QHideEvent *);
-
-#if defined(Q_WS_MAC)
- virtual bool macEvent(EventHandlerCallRef, EventRef);
-#endif
-#if defined(Q_WS_WIN)
- virtual bool winEvent(MSG *message, long *result);
-#endif
-#if defined(Q_WS_X11)
- virtual bool x11Event(XEvent *);
-#endif
-#if defined(Q_WS_QWS)
- virtual bool qwsEvent(QWSEvent *);
-#endif
+ virtual bool nativeEvent(const QByteArray &eventType, void *message, long *result);
// Misc. protected functions
virtual void changeEvent(QEvent *);
diff --git a/src/widgets/kernel/qwidget_p.h b/src/widgets/kernel/qwidget_p.h
index 43c3eaeff0..0da0c65aaa 100644
--- a/src/widgets/kernel/qwidget_p.h
+++ b/src/widgets/kernel/qwidget_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -59,7 +59,7 @@
#include "QtCore/qlocale.h"
#include "QtCore/qset.h"
#include "QtGui/qregion.h"
-#include "QtGui/qinputpanel.h"
+#include "QtGui/qinputmethod.h"
#include "QtWidgets/qsizepolicy.h"
#include "QtWidgets/qstyle.h"
#include "QtWidgets/qapplication.h"
@@ -416,7 +416,7 @@ public:
void syncBackingStore();
void syncBackingStore(const QRegion &region);
- // tells the input panel about the widgets transform
+ // tells the input method about the widgets transform
void updateWidgetTransform();
void reparentFocusWidgets(QWidget *oldtlw);
@@ -573,7 +573,7 @@ public:
QStyle::RequestSoftwareInputPanel behavior = QStyle::RequestSoftwareInputPanel(
q->style()->styleHint(QStyle::SH_RequestSoftwareInputPanel));
if (!clickCausedFocus || behavior == QStyle::RSIP_OnMouseClick) {
- qApp->inputPanel()->show();
+ qApp->inputMethod()->show();
}
}
}
diff --git a/src/widgets/kernel/qwidget_qpa.cpp b/src/widgets/kernel/qwidget_qpa.cpp
index fb4543cd14..289b332a13 100644
--- a/src/widgets/kernel/qwidget_qpa.cpp
+++ b/src/widgets/kernel/qwidget_qpa.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/kernel/qwidgetaction.cpp b/src/widgets/kernel/qwidgetaction.cpp
index caab1c16e6..14369513da 100644
--- a/src/widgets/kernel/qwidgetaction.cpp
+++ b/src/widgets/kernel/qwidgetaction.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/kernel/qwidgetaction.h b/src/widgets/kernel/qwidgetaction.h
index 62ef05596b..0c6a82b8e5 100644
--- a/src/widgets/kernel/qwidgetaction.h
+++ b/src/widgets/kernel/qwidgetaction.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -48,7 +48,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
#ifndef QT_NO_ACTION
diff --git a/src/widgets/kernel/qwidgetaction_p.h b/src/widgets/kernel/qwidgetaction_p.h
index ff8a37425c..f4950dfe73 100644
--- a/src/widgets/kernel/qwidgetaction_p.h
+++ b/src/widgets/kernel/qwidgetaction_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/kernel/qwidgetbackingstore.cpp b/src/widgets/kernel/qwidgetbackingstore.cpp
index 0eb9407925..978e989a00 100644
--- a/src/widgets/kernel/qwidgetbackingstore.cpp
+++ b/src/widgets/kernel/qwidgetbackingstore.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/kernel/qwidgetbackingstore_p.h b/src/widgets/kernel/qwidgetbackingstore_p.h
index 2d28cae88e..7befdbeb78 100644
--- a/src/widgets/kernel/qwidgetbackingstore_p.h
+++ b/src/widgets/kernel/qwidgetbackingstore_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/kernel/qwidgetsvariant.cpp b/src/widgets/kernel/qwidgetsvariant.cpp
index f2ca99d040..72080d9e6b 100644
--- a/src/widgets/kernel/qwidgetsvariant.cpp
+++ b/src/widgets/kernel/qwidgetsvariant.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/kernel/qwidgetwindow_qpa.cpp b/src/widgets/kernel/qwidgetwindow_qpa.cpp
index b89dca7357..e7ba4853a0 100644
--- a/src/widgets/kernel/qwidgetwindow_qpa.cpp
+++ b/src/widgets/kernel/qwidgetwindow_qpa.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -431,4 +431,9 @@ void QWidgetWindow::handleWindowStateChangedEvent(QWindowStateChangeEvent *event
QGuiApplication::sendSpontaneousEvent(m_widget, &widgetEvent);
}
+bool QWidgetWindow::nativeEvent(const QByteArray &eventType, void *message, long *result)
+{
+ return m_widget->nativeEvent(eventType, message, result);
+}
+
QT_END_NAMESPACE
diff --git a/src/widgets/kernel/qwidgetwindow_qpa_p.h b/src/widgets/kernel/qwidgetwindow_qpa_p.h
index 82448ab5fd..1e8813fddc 100644
--- a/src/widgets/kernel/qwidgetwindow_qpa_p.h
+++ b/src/widgets/kernel/qwidgetwindow_qpa_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -51,7 +51,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
class QCloseEvent;
class QMoveEvent;
@@ -80,6 +79,7 @@ protected:
void handleDragEvent(QEvent *);
void handleExposeEvent(QExposeEvent *);
void handleWindowStateChangedEvent(QWindowStateChangeEvent *event);
+ bool nativeEvent(const QByteArray &eventType, void *message, long *result);
private:
void updateGeometry();
diff --git a/src/widgets/platforms/mac/qapplication_mac.mm b/src/widgets/platforms/mac/qapplication_mac.mm
deleted file mode 100644
index 13fb6fd624..0000000000
--- a/src/widgets/platforms/mac/qapplication_mac.mm
+++ /dev/null
@@ -1,1878 +0,0 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
-
-/****************************************************************************
-**
-** Copyright (c) 2007-2008, Apple, Inc.
-**
-** All rights reserved.
-**
-** Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are met:
-**
-** * Redistributions of source code must retain the above copyright notice,
-** this list of conditions and the following disclaimer.
-**
-** * Redistributions in binary form must reproduce the above copyright notice,
-** this list of conditions and the following disclaimer in the documentation
-** and/or other materials provided with the distribution.
-**
-** * Neither the name of Apple, Inc. nor the names of its contributors
-** may be used to endorse or promote products derived from this software
-** without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-** CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-** EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-** PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-** PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-** LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-** NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-** SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-**
-****************************************************************************/
-
-#include <Cocoa/Cocoa.h>
-
-#include "qapplication.h"
-#include "qbitarray.h"
-#include "qclipboard.h"
-#include "qcursor.h"
-#include "qdatastream.h"
-#include "qdatetime.h"
-#include "qdesktopwidget.h"
-#include "qdockwidget.h"
-#include "qevent.h"
-#include "qhash.h"
-#include "qlayout.h"
-#include "qmenubar.h"
-#include "qmessagebox.h"
-#include "qmime.h"
-#include "qpixmapcache.h"
-#include "qpointer.h"
-#include "qsessionmanager.h"
-#include "qsettings.h"
-#include "qsocketnotifier.h"
-#include "qstyle.h"
-#include "qstylefactory.h"
-#include "qtextcodec.h"
-#include "qtoolbar.h"
-#include "qvariant.h"
-#include "qwidget.h"
-#include "qcolormap.h"
-#include "qdir.h"
-#include "qdebug.h"
-#include "qtimer.h"
-#include "qurl.h"
-#include "private/qmacinputcontext_p.h"
-#include "private/qpaintengine_mac_p.h"
-#include "private/qcursor_p.h"
-#include "private/qapplication_p.h"
-#include "private/qcolor_p.h"
-#include "private/qwidget_p.h"
-#include "private/qkeymapper_p.h"
-#include "private/qeventdispatcher_mac_p.h"
-#include "private/qeventdispatcher_unix_p.h"
-#include <private/qcocoamenuloader_mac_p.h>
-#include <private/qcocoaapplication_mac_p.h>
-#include <private/qcocoaapplicationdelegate_mac_p.h>
-#include <private/qt_cocoa_helpers_mac_p.h>
-#include <private/qcocoawindow_mac_p.h>
-#include <private/qpixmap_mac_p.h>
-#include <private/qdesktopwidget_mac_p.h>
-#include <private/qeventdispatcher_mac_p.h>
-#include <qvarlengtharray.h>
-
-#ifndef QT_NO_ACCESSIBILITY
-# include "qaccessible.h"
-#endif
-
-#ifndef QT_NO_THREAD
-# include "qmutex.h"
-#endif
-
-#include <unistd.h>
-#include <string.h>
-#include <sys/time.h>
-#include <sys/select.h>
-
-/*****************************************************************************
- QApplication debug facilities
- *****************************************************************************/
-//#define DEBUG_EVENTS //like EventDebug but more specific to Qt
-//#define DEBUG_DROPPED_EVENTS
-//#define DEBUG_MOUSE_MAPS
-//#define DEBUG_MODAL_EVENTS
-//#define DEBUG_PLATFORM_SETTINGS
-
-#define QMAC_SPEAK_TO_ME
-#ifdef QMAC_SPEAK_TO_ME
-#include "qregexp.h"
-#endif
-
-#ifndef kThemeBrushAlternatePrimaryHighlightColor
-#define kThemeBrushAlternatePrimaryHighlightColor -5
-#endif
-
-#define kCMDeviceUnregisteredNotification CFSTR("CMDeviceUnregisteredNotification")
-#define kCMDefaultDeviceNotification CFSTR("CMDefaultDeviceNotification")
-#define kCMDeviceProfilesNotification CFSTR("CMDeviceProfilesNotification")
-#define kCMDefaultDeviceProfileNotification CFSTR("CMDefaultDeviceProfileNotification")
-
-QT_BEGIN_NAMESPACE
-
-//for qt_mac.h
-QPaintDevice *qt_mac_safe_pdev = 0;
-QList<QMacWindowChangeEvent*> *QMacWindowChangeEvent::change_events = 0;
-QPointer<QWidget> topLevelAt_cache = 0;
-
-/*****************************************************************************
- Internal variables and functions
- *****************************************************************************/
-static struct {
- bool use_qt_time_limit;
- QPointer<QWidget> last_widget;
- int last_x, last_y;
- int last_modifiers, last_button;
- EventTime last_time;
-} qt_mac_dblclick = { false, 0, -1, -1, 0, 0, -2 };
-
-static bool app_do_modal = false; // modal mode
-extern QWidgetList *qt_modal_stack; // stack of modal widgets
-extern bool qt_tab_all_widgets; // from qapplication.cpp
-bool qt_scrollbar_jump_to_pos = false;
-static bool qt_mac_collapse_on_dblclick = true;
-extern int qt_antialiasing_threshold; // from qapplication.cpp
-QWidget * qt_button_down; // widget got last button-down
-QPointer<QWidget> qt_last_mouse_receiver;
-#if defined(QT_DEBUG)
-static bool appNoGrab = false; // mouse/keyboard grabbing
-#endif
-static AEEventHandlerUPP app_proc_ae_handlerUPP = NULL;
-static EventHandlerRef tablet_proximity_handler = 0;
-static EventHandlerUPP tablet_proximity_UPP = 0;
-bool QApplicationPrivate::native_modal_dialog_active;
-
-Q_GUI_EXPORT bool qt_applefontsmoothing_enabled;
-
-/*****************************************************************************
- External functions
- *****************************************************************************/
-extern void qt_mac_beep(); //qsound_mac.mm
-extern Qt::KeyboardModifiers qt_mac_get_modifiers(int keys); //qkeymapper_mac.cpp
-extern bool qt_mac_can_clickThrough(const QWidget *); //qwidget_mac.cpp
-extern bool qt_mac_is_macdrawer(const QWidget *); //qwidget_mac.cpp
-extern OSWindowRef qt_mac_window_for(const QWidget*); //qwidget_mac.cpp
-extern QWidget *qt_mac_find_window(OSWindowRef); //qwidget_mac.cpp
-extern void qt_mac_set_cursor(const QCursor *); //qcursor_mac.cpp
-extern bool qt_mac_is_macsheet(const QWidget *); //qwidget_mac.cpp
-extern QString qt_mac_from_pascal_string(const Str255); //qglobal.cpp
-extern void qt_mac_command_set_enabled(MenuRef, UInt32, bool); //qmenu_mac.cpp
-extern bool qt_sendSpontaneousEvent(QObject *obj, QEvent *event); // qapplication.cpp
-extern void qt_mac_update_cursor(); // qcursor_mac.mm
-
-// Forward Decls
-void onApplicationWindowChangedActivation( QWidget*widget, bool activated );
-void onApplicationChangedActivation( bool activated );
-
-static void qt_mac_read_fontsmoothing_settings()
-{
- qt_applefontsmoothing_enabled = true;
- int w = 10, h = 10;
- QImage image(w, h, QImage::Format_RGB32);
- image.fill(0xffffffff);
- QPainter p(&image);
- p.drawText(0, h, "X\\");
- p.end();
-
- const int *bits = (const int *) ((const QImage &) image).bits();
- int bpl = image.bytesPerLine() / 4;
- for (int y=0; y<w; ++y) {
- for (int x=0; x<h; ++x) {
- int r = qRed(bits[x]);
- int g = qGreen(bits[x]);
- int b = qBlue(bits[x]);
- if (r != g || r != b) {
- qt_applefontsmoothing_enabled = true;
- return;
- }
- }
- bits += bpl;
- }
- qt_applefontsmoothing_enabled = false;
-}
-
-Q_GUI_EXPORT bool qt_mac_execute_apple_script(const char *script, long script_len, AEDesc *ret) {
- OSStatus err;
- AEDesc scriptTextDesc;
- ComponentInstance theComponent = 0;
- OSAID scriptID = kOSANullScript, resultID = kOSANullScript;
-
- // set up locals to a known state
- AECreateDesc(typeNull, 0, 0, &scriptTextDesc);
- scriptID = kOSANullScript;
- resultID = kOSANullScript;
-
- // open the scripting component
- theComponent = OpenDefaultComponent(kOSAComponentType, typeAppleScript);
- if (!theComponent) {
- err = paramErr;
- goto bail;
- }
-
- // put the script text into an aedesc
- err = AECreateDesc(typeUTF8Text, script, script_len, &scriptTextDesc);
- if (err != noErr)
- goto bail;
-
- // compile the script
- err = OSACompile(theComponent, &scriptTextDesc, kOSAModeNull, &scriptID);
- if (err != noErr)
- goto bail;
-
- // run the script
- err = OSAExecute(theComponent, scriptID, kOSANullScript, kOSAModeNull, &resultID);
-
- // collect the results - if any
- if (ret) {
- AECreateDesc(typeNull, 0, 0, ret);
- if (err == errOSAScriptError)
- OSAScriptError(theComponent, kOSAErrorMessage, typeChar, ret);
- else if (err == noErr && resultID != kOSANullScript)
- OSADisplay(theComponent, resultID, typeChar, kOSAModeNull, ret);
- }
-bail:
- AEDisposeDesc(&scriptTextDesc);
- if (scriptID != kOSANullScript)
- OSADispose(theComponent, scriptID);
- if (resultID != kOSANullScript)
- OSADispose(theComponent, resultID);
- if (theComponent)
- CloseComponent(theComponent);
- return err == noErr;
-}
-
-Q_GUI_EXPORT bool qt_mac_execute_apple_script(const char *script, AEDesc *ret)
-{
- return qt_mac_execute_apple_script(script, qstrlen(script), ret);
-}
-
-Q_GUI_EXPORT bool qt_mac_execute_apple_script(const QString &script, AEDesc *ret)
-{
- const QByteArray l = script.toUtf8(); return qt_mac_execute_apple_script(l.constData(), l.size(), ret);
-}
-
-/* Resolution change magic */
-void qt_mac_display_change_callbk(CGDirectDisplayID, CGDisplayChangeSummaryFlags flags, void *)
-{
-#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5)
- const bool resized = flags & kCGDisplayDesktopShapeChangedFlag;
-#else
- Q_UNUSED(flags);
- const bool resized = true;
-#endif
- if (resized && qApp) {
- if (QDesktopWidget *dw = qApp->desktop()) {
- QResizeEvent *re = new QResizeEvent(dw->size(), dw->size());
- QApplication::postEvent(dw, re);
- QCoreGraphicsPaintEngine::cleanUpMacColorSpaces();
- }
- }
-}
-
-#ifdef DEBUG_PLATFORM_SETTINGS
-static void qt_mac_debug_palette(const QPalette &pal, const QPalette &pal2, const QString &where)
-{
- const char *const groups[] = {"Active", "Disabled", "Inactive" };
- const char *const roles[] = { "WindowText", "Button", "Light", "Midlight", "Dark", "Mid",
- "Text", "BrightText", "ButtonText", "Base", "Window", "Shadow",
- "Highlight", "HighlightedText", "Link", "LinkVisited" };
- if (!where.isNull())
- qDebug("qt-internal: %s", where.toLatin1().constData());
- for(int grp = 0; grp < QPalette::NColorGroups; grp++) {
- for(int role = 0; role < QPalette::NColorRoles; role++) {
- QBrush b = pal.brush((QPalette::ColorGroup)grp, (QPalette::ColorRole)role);
- QPixmap pm = b.texture();
- qDebug(" %s::%s %d::%d::%d [%p]%s", groups[grp], roles[role], b.color().red(),
- b.color().green(), b.color().blue(), pm.isNull() ? 0 : &pm,
- pal2.brush((QPalette::ColorGroup)grp, (QPalette::ColorRole)role) != b ? " (*)" : "");
- }
- }
-
-}
-#else
-#define qt_mac_debug_palette(x, y, z)
-#endif
-
-//raise a notification
-void qt_mac_send_notification()
-{
- QMacCocoaAutoReleasePool pool;
- [[NSApplication sharedApplication] requestUserAttention:NSInformationalRequest];
-}
-
-void qt_mac_cancel_notification()
-{
- QMacCocoaAutoReleasePool pool;
- [[NSApplication sharedApplication] cancelUserAttentionRequest:NSInformationalRequest];
-}
-
-void qt_mac_set_app_icon(const QPixmap &pixmap)
-{
- QMacCocoaAutoReleasePool pool;
- NSImage *image = NULL;
- if (pixmap.isNull()) {
- // Get Application icon from bundle
- image = [[NSImage imageNamed:@"NSApplicationIcon"] retain]; // released below
- } else {
- image = static_cast<NSImage *>(qt_mac_create_nsimage(pixmap));
- }
-
- [NSApp setApplicationIconImage:image];
- [image release];
-}
-
-Q_GUI_EXPORT void qt_mac_set_press_and_hold_context(bool b)
-{
- Q_UNUSED(b);
- qWarning("qt_mac_set_press_and_hold_context: This functionality is no longer available");
-}
-
-bool qt_nograb() // application no-grab option
-{
-#if defined(QT_DEBUG)
- return appNoGrab;
-#else
- return false;
-#endif
-}
-
-void qt_mac_update_os_settings()
-{
- if (!qApp)
- return;
- if (!QApplication::startingUp()) {
- static bool needToPolish = true;
- if (needToPolish) {
- QApplication::style()->polish(qApp);
- needToPolish = false;
- }
- }
- //focus mode
- /* First worked as of 10.2.3 */
- QSettings appleSettings(QLatin1String("apple.com"));
- QVariant appleValue = appleSettings.value(QLatin1String("AppleKeyboardUIMode"), 0);
- qt_tab_all_widgets = (appleValue.toInt() & 0x2);
- //paging mode
- /* First worked as of 10.2.3 */
- appleValue = appleSettings.value(QLatin1String("AppleScrollerPagingBehavior"), false);
- qt_scrollbar_jump_to_pos = appleValue.toBool();
- //collapse
- /* First worked as of 10.3.3 */
- appleValue = appleSettings.value(QLatin1String("AppleMiniaturizeOnDoubleClick"), true);
- qt_mac_collapse_on_dblclick = appleValue.toBool();
-
- // Anti-aliasing threshold
- appleValue = appleSettings.value(QLatin1String("AppleAntiAliasingThreshold"));
- if (appleValue.isValid())
- qt_antialiasing_threshold = appleValue.toInt();
-
-#ifdef DEBUG_PLATFORM_SETTINGS
- qDebug("qt_mac_update_os_settings *********************************************************************");
-#endif
- { // setup the global palette
- QColor qc;
- (void) QApplication::style(); // trigger creation of application style and system palettes
- QPalette pal = *QApplicationPrivate::sys_pal;
-
- pal.setBrush( QPalette::Active, QPalette::Highlight, qcolorForTheme(kThemeBrushPrimaryHighlightColor) );
- pal.setBrush( QPalette::Inactive, QPalette::Highlight, qcolorForTheme(kThemeBrushSecondaryHighlightColor) );
-
- pal.setBrush( QPalette::Disabled, QPalette::Highlight, qcolorForTheme(kThemeBrushSecondaryHighlightColor) );
- pal.setBrush( QPalette::Active, QPalette::Shadow, qcolorForTheme(kThemeBrushButtonActiveDarkShadow) );
-
- pal.setBrush( QPalette::Inactive, QPalette::Shadow, qcolorForTheme(kThemeBrushButtonInactiveDarkShadow) );
- pal.setBrush( QPalette::Disabled, QPalette::Shadow, qcolorForTheme(kThemeBrushButtonInactiveDarkShadow) );
-
- qc = qcolorForThemeTextColor(kThemeTextColorDialogActive);
- pal.setColor(QPalette::Active, QPalette::Text, qc);
- pal.setColor(QPalette::Active, QPalette::WindowText, qc);
- pal.setColor(QPalette::Active, QPalette::HighlightedText, qc);
-
- qc = qcolorForThemeTextColor(kThemeTextColorDialogInactive);
- pal.setColor(QPalette::Inactive, QPalette::Text, qc);
- pal.setColor(QPalette::Inactive, QPalette::WindowText, qc);
- pal.setColor(QPalette::Inactive, QPalette::HighlightedText, qc);
- pal.setColor(QPalette::Disabled, QPalette::Text, qc);
- pal.setColor(QPalette::Disabled, QPalette::WindowText, qc);
- pal.setColor(QPalette::Disabled, QPalette::HighlightedText, qc);
- pal.setBrush(QPalette::ToolTipBase, QColor(255, 255, 199));
-
- if (!QApplicationPrivate::sys_pal || *QApplicationPrivate::sys_pal != pal) {
- QApplicationPrivate::setSystemPalette(pal);
- QApplication::setPalette(pal);
- }
-#ifdef DEBUG_PLATFORM_SETTINGS
- qt_mac_debug_palette(pal, QApplication::palette(), "Global Palette");
-#endif
- }
-
- QFont fnt = qfontForThemeFont(kThemeApplicationFont);
-#ifdef DEBUG_PLATFORM_SETTINGS
- qDebug("qt-internal: Font for Application [%s::%d::%d::%d]",
- fnt.family().toLatin1().constData(), fnt.pointSize(), fnt.bold(), fnt.italic());
-#endif
- if (!QApplicationPrivate::sys_font || *QApplicationPrivate::sys_font != fnt)
- QApplicationPrivate::setSystemFont(fnt);
-
- { //setup the fonts
- struct FontMap {
- FontMap(const char *qc, short fk) : qt_class(qc), font_key(fk) { }
- const char *const qt_class;
- short font_key;
- } mac_widget_fonts[] = {
- FontMap("QPushButton", kThemePushButtonFont),
- FontMap("QListView", kThemeViewsFont),
- FontMap("QListBox", kThemeViewsFont),
- FontMap("QTitleBar", kThemeWindowTitleFont),
- FontMap("QMenuBar", kThemeMenuTitleFont),
- FontMap("QMenu", kThemeMenuItemFont),
- FontMap("QComboMenuItem", kThemeSystemFont),
- FontMap("QHeaderView", kThemeSmallSystemFont),
- FontMap("Q3Header", kThemeSmallSystemFont),
- FontMap("QTipLabel", kThemeSmallSystemFont),
- FontMap("QLabel", kThemeSystemFont),
- FontMap("QToolButton", kThemeSmallSystemFont),
- FontMap("QMenuItem", kThemeMenuItemFont), // It doesn't exist, but its unique.
- FontMap("QComboLineEdit", kThemeViewsFont), // It doesn't exist, but its unique.
- FontMap("QSmallFont", kThemeSmallSystemFont), // It doesn't exist, but its unique.
- FontMap("QMiniFont", kThemeMiniSystemFont), // It doesn't exist, but its unique.
- FontMap(0, 0) };
- for(int i = 0; mac_widget_fonts[i].qt_class; i++) {
- QFont fnt = qfontForThemeFont(mac_widget_fonts[i].font_key);
- bool set_font = true;
- FontHash *hash = qt_app_fonts_hash();
- if (!hash->isEmpty()) {
- FontHash::const_iterator it
- = hash->constFind(mac_widget_fonts[i].qt_class);
- if (it != hash->constEnd())
- set_font = (fnt != *it);
- }
- if (set_font) {
- QApplication::setFont(fnt, mac_widget_fonts[i].qt_class);
-#ifdef DEBUG_PLATFORM_SETTINGS
- qDebug("qt-internal: Font for %s [%s::%d::%d::%d]", mac_widget_fonts[i].qt_class,
- fnt.family().toLatin1().constData(), fnt.pointSize(), fnt.bold(), fnt.italic());
-#endif
- }
- }
- }
- QApplicationPrivate::initializeWidgetPaletteHash();
-#ifdef DEBUG_PLATFORM_SETTINGS
- qDebug("qt_mac_update_os_settings END !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
-#endif
-}
-
-void QApplicationPrivate::initializeWidgetPaletteHash()
-{
- { //setup the palette
- struct PaletteMap {
- inline PaletteMap(const char *qc, ThemeBrush a, ThemeBrush i) :
- qt_class(qc), active(a), inactive(i) { }
- const char *const qt_class;
- ThemeBrush active, inactive;
- } mac_widget_colors[] = {
- PaletteMap("QToolButton", kThemeTextColorBevelButtonActive, kThemeTextColorBevelButtonInactive),
- PaletteMap("QAbstractButton", kThemeTextColorPushButtonActive, kThemeTextColorPushButtonInactive),
- PaletteMap("QHeaderView", kThemeTextColorPushButtonActive, kThemeTextColorPushButtonInactive),
- PaletteMap("Q3Header", kThemeTextColorPushButtonActive, kThemeTextColorPushButtonInactive),
- PaletteMap("QComboBox", kThemeTextColorPopupButtonActive, kThemeTextColorPopupButtonInactive),
- PaletteMap("QAbstractItemView", kThemeTextColorListView, kThemeTextColorDialogInactive),
- PaletteMap("QMessageBoxLabel", kThemeTextColorAlertActive, kThemeTextColorAlertInactive),
- PaletteMap("QTabBar", kThemeTextColorTabFrontActive, kThemeTextColorTabFrontInactive),
- PaletteMap("QLabel", kThemeTextColorPlacardActive, kThemeTextColorPlacardInactive),
- PaletteMap("QGroupBox", kThemeTextColorPlacardActive, kThemeTextColorPlacardInactive),
- PaletteMap("QMenu", kThemeTextColorPopupLabelActive, kThemeTextColorPopupLabelInactive),
- PaletteMap("QTextEdit", 0, 0),
- PaletteMap("QTextControl", 0, 0),
- PaletteMap("QLineEdit", 0, 0),
- PaletteMap(0, 0, 0) };
- QColor qc;
- for(int i = 0; mac_widget_colors[i].qt_class; i++) {
- QPalette pal;
- if (mac_widget_colors[i].active != 0) {
- qc = qcolorForThemeTextColor(mac_widget_colors[i].active);
- pal.setColor(QPalette::Active, QPalette::Text, qc);
- pal.setColor(QPalette::Active, QPalette::WindowText, qc);
- pal.setColor(QPalette::Active, QPalette::HighlightedText, qc);
- qc = qcolorForThemeTextColor(mac_widget_colors[i].inactive);
- pal.setColor(QPalette::Inactive, QPalette::Text, qc);
- pal.setColor(QPalette::Disabled, QPalette::Text, qc);
- pal.setColor(QPalette::Inactive, QPalette::WindowText, qc);
- pal.setColor(QPalette::Disabled, QPalette::WindowText, qc);
- pal.setColor(QPalette::Inactive, QPalette::HighlightedText, qc);
- pal.setColor(QPalette::Disabled, QPalette::HighlightedText, qc);
- }
- if (!strcmp(mac_widget_colors[i].qt_class, "QMenu")) {
- qc = qcolorForThemeTextColor(kThemeTextColorMenuItemActive);
- pal.setBrush(QPalette::ButtonText, qc);
- qc = qcolorForThemeTextColor(kThemeTextColorMenuItemSelected);
- pal.setBrush(QPalette::HighlightedText, qc);
- qc = qcolorForThemeTextColor(kThemeTextColorMenuItemDisabled);
- pal.setBrush(QPalette::Disabled, QPalette::Text, qc);
- } else if (!strcmp(mac_widget_colors[i].qt_class, "QAbstractButton")
- || !strcmp(mac_widget_colors[i].qt_class, "QHeaderView")
- || !strcmp(mac_widget_colors[i].qt_class, "Q3Header")) { //special
- pal.setColor(QPalette::Disabled, QPalette::ButtonText,
- pal.color(QPalette::Disabled, QPalette::Text));
- pal.setColor(QPalette::Inactive, QPalette::ButtonText,
- pal.color(QPalette::Inactive, QPalette::Text));
- pal.setColor(QPalette::Active, QPalette::ButtonText,
- pal.color(QPalette::Active, QPalette::Text));
- } else if (!strcmp(mac_widget_colors[i].qt_class, "QAbstractItemView")) {
- pal.setBrush(QPalette::Active, QPalette::Highlight,
- qcolorForTheme(kThemeBrushAlternatePrimaryHighlightColor));
- qc = qcolorForThemeTextColor(kThemeTextColorMenuItemSelected);
- pal.setBrush(QPalette::Active, QPalette::HighlightedText, qc);
-#if 1
- pal.setBrush(QPalette::Inactive, QPalette::Text,
- pal.brush(QPalette::Active, QPalette::Text));
- pal.setBrush(QPalette::Inactive, QPalette::HighlightedText,
- pal.brush(QPalette::Active, QPalette::Text));
-#endif
- } else if (!strcmp(mac_widget_colors[i].qt_class, "QTextEdit")
- || !strcmp(mac_widget_colors[i].qt_class, "QTextControl")) {
- pal.setBrush(QPalette::Inactive, QPalette::Text,
- pal.brush(QPalette::Active, QPalette::Text));
- pal.setBrush(QPalette::Inactive, QPalette::HighlightedText,
- pal.brush(QPalette::Active, QPalette::Text));
- } else if (!strcmp(mac_widget_colors[i].qt_class, "QLineEdit")) {
- pal.setBrush(QPalette::Disabled, QPalette::Base,
- pal.brush(QPalette::Active, QPalette::Base));
- }
-
- bool set_palette = true;
- PaletteHash *phash = qt_app_palettes_hash();
- if (!phash->isEmpty()) {
- PaletteHash::const_iterator it
- = phash->constFind(mac_widget_colors[i].qt_class);
- if (it != phash->constEnd())
- set_palette = (pal != *it);
- }
- if (set_palette) {
- QApplication::setPalette(pal, mac_widget_colors[i].qt_class);
-#ifdef DEBUG_PLATFORM_SETTINGS
- qt_mac_debug_palette(pal, QApplication::palette(), QLatin1String("Palette for ") + QString::fromLatin1(mac_widget_colors[i].qt_class));
-#endif
- }
- }
- }
-}
-
-static void qt_mac_event_release(EventRef &event)
-{
- ReleaseEvent(event);
- event = 0;
-}
-
-/* sheets */
-void qt_event_request_showsheet(QWidget *w)
-{
- Q_ASSERT(qt_mac_is_macsheet(w));
- [NSApp beginSheet:qt_mac_window_for(w) modalForWindow:qt_mac_window_for(w->parentWidget())
- modalDelegate:nil didEndSelector:nil contextInfo:0];
-}
-
-static void qt_post_window_change_event(QWidget *widget)
-{
- qt_widget_private(widget)->needWindowChange = true;
- QEvent *glWindowChangeEvent = new QEvent(QEvent::MacGLWindowChange);
- QApplication::postEvent(widget, glWindowChangeEvent);
-}
-
-/*
- Posts updates to all child and grandchild OpenGL widgets for the given widget.
-*/
-static void qt_mac_update_child_gl_widgets(QWidget *widget)
-{
- // Update all OpenGL child widgets for the given widget.
- QList<QWidgetPrivate::GlWidgetInfo> &glWidgets = qt_widget_private(widget)->glWidgets;
- QList<QWidgetPrivate::GlWidgetInfo>::iterator end = glWidgets.end();
- QList<QWidgetPrivate::GlWidgetInfo>::iterator it = glWidgets.begin();
-
- for (;it != end; ++it) {
- qt_post_window_change_event(it->widget);
- }
-}
-
-/*
- Sends updates to all child and grandchild gl widgets that have updates pending.
-*/
-void qt_mac_send_posted_gl_updates(QWidget *widget)
-{
- QList<QWidgetPrivate::GlWidgetInfo> &glWidgets = qt_widget_private(widget)->glWidgets;
- QList<QWidgetPrivate::GlWidgetInfo>::iterator end = glWidgets.end();
- QList<QWidgetPrivate::GlWidgetInfo>::iterator it = glWidgets.begin();
-
- for (;it != end; ++it) {
- QWidget *glWidget = it->widget;
- if (qt_widget_private(glWidget)->needWindowChange) {
- QEvent glChangeEvent(QEvent::MacGLWindowChange);
- QApplication::sendEvent(glWidget, &glChangeEvent);
- }
- }
-}
-
-/*
- Posts updates to all OpenGL widgets within the window that the given widget intersects.
-*/
-static void qt_mac_update_intersected_gl_widgets(QWidget *widget)
-{
- Q_UNUSED(widget);
-}
-
-/*
- Posts a kEventQtRequestWindowChange event to the main Carbon event queue.
-*/
-static EventRef request_window_change_pending = 0;
-Q_GUI_EXPORT void qt_event_request_window_change()
-{
- if(request_window_change_pending)
- return;
-
- CreateEvent(0, kEventClassQt, kEventQtRequestWindowChange, GetCurrentEventTime(),
- kEventAttributeUserEvent, &request_window_change_pending);
- PostEventToQueue(GetMainEventQueue(), request_window_change_pending, kEventPriorityHigh);
-}
-
-/* window changing. This is a hack around Apple's missing functionality, pending the toolbox
- team fix. --Sam */
-Q_GUI_EXPORT void qt_event_request_window_change(QWidget *widget)
-{
- if (!widget)
- return;
-
- // Post a kEventQtRequestWindowChange event. This event is semi-public,
- // don't remove this line!
- qt_event_request_window_change();
-
- // Post update request on gl widgets unconditionally.
- if (qt_widget_private(widget)->isGLWidget == true) {
- qt_post_window_change_event(widget);
- return;
- }
-
- qt_mac_update_child_gl_widgets(widget);
- qt_mac_update_intersected_gl_widgets(widget);
-}
-
-/* activation */
-static struct {
- QPointer<QWidget> widget;
- EventRef event;
- EventLoopTimerRef timer;
- EventLoopTimerUPP timerUPP;
-} request_activate_pending = { 0, 0, 0, 0 };
-bool qt_event_remove_activate()
-{
- if (request_activate_pending.timer) {
- RemoveEventLoopTimer(request_activate_pending.timer);
- request_activate_pending.timer = 0;
- }
- if (request_activate_pending.event)
- qt_mac_event_release(request_activate_pending.event);
- return true;
-}
-
-void qt_event_activate_timer_callbk(EventLoopTimerRef r, void *)
-{
- EventLoopTimerRef otc = request_activate_pending.timer;
- qt_event_remove_activate();
- if (r == otc && !request_activate_pending.widget.isNull()) {
- const QWidget *tlw = request_activate_pending.widget->window();
- Qt::WindowType wt = tlw->windowType();
- if (tlw->isVisible()
- && ((wt != Qt::Desktop && wt != Qt::Popup && wt != Qt::Tool) || tlw->isModal())) {
- CreateEvent(0, kEventClassQt, kEventQtRequestActivate, GetCurrentEventTime(),
- kEventAttributeUserEvent, &request_activate_pending.event);
- PostEventToQueue(GetMainEventQueue(), request_activate_pending.event, kEventPriorityHigh);
- }
- }
-}
-
-void qt_event_request_activate(QWidget *w)
-{
- if (w == request_activate_pending.widget)
- return;
-
- /* We put these into a timer because due to order of events being sent we need to be sure this
- comes from inside of the event loop */
- qt_event_remove_activate();
- if (!request_activate_pending.timerUPP)
- request_activate_pending.timerUPP = NewEventLoopTimerUPP(qt_event_activate_timer_callbk);
- request_activate_pending.widget = w;
- InstallEventLoopTimer(GetMainEventLoop(), 0, 0, request_activate_pending.timerUPP, 0, &request_activate_pending.timer);
-}
-
-
-/* menubars */
-void qt_event_request_menubarupdate()
-{
- // Just call this. The request has the benefit that we don't call this multiple times, but
- // we can optimize this.
- QMenuBar::macUpdateMenuBar();
-}
-
-
-void QApplicationPrivate::createEventDispatcher()
-{
- Q_Q(QApplication);
- if (q->type() != QApplication::Tty)
- eventDispatcher = new QEventDispatcherMac(q);
- else
- eventDispatcher = new QEventDispatcherUNIX(q);
-}
-
-/* clipboard */
-void qt_event_send_clipboard_changed()
-{
-}
-
-/* app menu */
-static QMenu *qt_mac_dock_menu = 0;
-Q_GUI_EXPORT void qt_mac_set_dock_menu(QMenu *menu)
-{
- qt_mac_dock_menu = menu;
- [NSApp setDockMenu:menu->macMenu()];
-}
-
-/* events that hold pointers to widgets, must be cleaned up like this */
-void qt_mac_event_release(QWidget *w)
-{
- if (w) {
- if (w == qt_mac_dock_menu) {
- qt_mac_dock_menu = 0;
- [NSApp setDockMenu:0];
- }
- }
-}
-
-struct QMacAppleEventTypeSpec {
- AEEventClass mac_class;
- AEEventID mac_id;
-} app_apple_events[] = {
- { kCoreEventClass, kAEQuitApplication },
- { kCoreEventClass, kAEOpenDocuments },
- { kInternetEventClass, kAEGetURL },
-};
-
-static void qt_init_tablet_proximity_handler()
-{
- EventTypeSpec tabletProximityEvent = { kEventClassTablet, kEventTabletProximity };
- InstallEventHandler(GetEventMonitorTarget(), tablet_proximity_UPP,
- 1, &tabletProximityEvent, qApp, &tablet_proximity_handler);
-}
-
-static void qt_release_tablet_proximity_handler()
-{
- RemoveEventHandler(tablet_proximity_handler);
-}
-
-QString QApplicationPrivate::appName() const
-{
- static QString applName;
- if (applName.isEmpty()) {
- applName = QCoreApplicationPrivate::macMenuBarName();
- ProcessSerialNumber psn;
- if (applName.isEmpty() && qt_is_gui_used && GetCurrentProcess(&psn) == noErr) {
- QCFString cfstr;
- CopyProcessName(&psn, &cfstr);
- applName = cfstr;
- }
- }
- return applName;
-}
-
-void qt_release_app_proc_handler()
-{
-}
-
-void qt_color_profile_changed(CFNotificationCenterRef, void *, CFStringRef, const void *,
- CFDictionaryRef)
-{
- QCoreGraphicsPaintEngine::cleanUpMacColorSpaces();
-}
-/* platform specific implementations */
-void qt_init(QApplicationPrivate *priv, int)
-{
- if (qt_is_gui_used) {
- CGDisplayRegisterReconfigurationCallback(qt_mac_display_change_callbk, 0);
- CFNotificationCenterRef center = CFNotificationCenterGetDistributedCenter();
- CFNotificationCenterAddObserver(center, qApp, qt_color_profile_changed,
- kCMDeviceUnregisteredNotification, 0,
- CFNotificationSuspensionBehaviorDeliverImmediately);
- CFNotificationCenterAddObserver(center, qApp, qt_color_profile_changed,
- kCMDefaultDeviceNotification, 0,
- CFNotificationSuspensionBehaviorDeliverImmediately);
- CFNotificationCenterAddObserver(center, qApp, qt_color_profile_changed,
- kCMDeviceProfilesNotification, 0,
- CFNotificationSuspensionBehaviorDeliverImmediately);
- CFNotificationCenterAddObserver(center, qApp, qt_color_profile_changed,
- kCMDefaultDeviceProfileNotification, 0,
- CFNotificationSuspensionBehaviorDeliverImmediately);
- ProcessSerialNumber psn;
- if (GetCurrentProcess(&psn) == noErr) {
- // Jambi needs to transform itself since most people aren't "used"
- // to putting things in bundles, but other people may actually not
- // want to tranform the process (running as a helper or something)
- // so don't do that for them. This means checking both LSUIElement
- // and LSBackgroundOnly. If you set them both... well, you
- // shouldn't do that.
-
- bool forceTransform = true;
- CFTypeRef value = CFBundleGetValueForInfoDictionaryKey(CFBundleGetMainBundle(),
- CFSTR("LSUIElement"));
- if (value) {
- CFTypeID valueType = CFGetTypeID(value);
- // Officially it's supposed to be a string, a boolean makes sense, so we'll check.
- // A number less so, but OK.
- if (valueType == CFStringGetTypeID())
- forceTransform = !(QCFString::toQString(static_cast<CFStringRef>(value)).toInt());
- else if (valueType == CFBooleanGetTypeID())
- forceTransform = !CFBooleanGetValue(static_cast<CFBooleanRef>(value));
- else if (valueType == CFNumberGetTypeID()) {
- int valueAsInt;
- CFNumberGetValue(static_cast<CFNumberRef>(value), kCFNumberIntType, &valueAsInt);
- forceTransform = !valueAsInt;
- }
- }
-
- if (forceTransform) {
- value = CFBundleGetValueForInfoDictionaryKey(CFBundleGetMainBundle(),
- CFSTR("LSBackgroundOnly"));
- if (value) {
- CFTypeID valueType = CFGetTypeID(value);
- if (valueType == CFBooleanGetTypeID())
- forceTransform = !CFBooleanGetValue(static_cast<CFBooleanRef>(value));
- else if (valueType == CFStringGetTypeID())
- forceTransform = !(QCFString::toQString(static_cast<CFStringRef>(value)).toInt());
- else if (valueType == CFNumberGetTypeID()) {
- int valueAsInt;
- CFNumberGetValue(static_cast<CFNumberRef>(value), kCFNumberIntType, &valueAsInt);
- forceTransform = !valueAsInt;
- }
- }
- }
-
-
- if (forceTransform) {
- TransformProcessType(&psn, kProcessTransformToForegroundApplication);
- }
- }
- }
-
- char **argv = priv->argv;
-
- // Get command line params
- if (int argc = priv->argc) {
- int i, j = 1;
- QString passed_psn;
- for(i=1; i < argc; i++) {
- if (argv[i] && *argv[i] != '-') {
- argv[j++] = argv[i];
- continue;
- }
- QByteArray arg(argv[i]);
-#if defined(QT_DEBUG)
- if (arg == "-nograb")
- appNoGrab = !appNoGrab;
- else
-#endif // QT_DEBUG
- if (arg.left(5) == "-psn_") {
- passed_psn = QString::fromLatin1(arg.mid(6));
- } else {
- argv[j++] = argv[i];
- }
- }
- if (j < priv->argc) {
- priv->argv[j] = 0;
- priv->argc = j;
- }
-
- //special hack to change working directory (for an app bundle) when running from finder
- if (!passed_psn.isNull() && QDir::currentPath() == QLatin1String("/")) {
- QCFType<CFURLRef> bundleURL(CFBundleCopyBundleURL(CFBundleGetMainBundle()));
- QString qbundlePath = QCFString(CFURLCopyFileSystemPath(bundleURL,
- kCFURLPOSIXPathStyle));
- if (qbundlePath.endsWith(QLatin1String(".app")))
- QDir::setCurrent(qbundlePath.section(QLatin1Char('/'), 0, -2));
- }
- }
-
- QMacPasteboardMime::initialize();
-
- qApp->setObjectName(priv->appName());
- if (qt_is_gui_used) {
- QColormap::initialize();
- QFont::initialize();
- QCursorData::initialize();
- QCoreGraphicsPaintEngine::initialize();
-#ifndef QT_NO_ACCESSIBILITY
- QAccessible::initialize();
-#endif
- QMacInputContext::initialize();
- QApplicationPrivate::inputContext = new QMacInputContext;
-
- if (QApplication::desktopSettingsAware())
- qt_mac_update_os_settings();
- if (!app_proc_ae_handlerUPP && !QApplication::testAttribute(Qt::AA_MacPluginApplication)) {
- app_proc_ae_handlerUPP = AEEventHandlerUPP(QApplicationPrivate::globalAppleEventProcessor);
- for(uint i = 0; i < sizeof(app_apple_events) / sizeof(QMacAppleEventTypeSpec); ++i) {
- // Install apple event handler, but avoid overwriting an already
- // existing handler (it means a 3rd party application has installed one):
- SRefCon refCon = 0;
- AEEventHandlerUPP current_handler = NULL;
- AEGetEventHandler(app_apple_events[i].mac_class, app_apple_events[i].mac_id, &current_handler, &refCon, false);
- if (!current_handler)
- AEInstallEventHandler(app_apple_events[i].mac_class, app_apple_events[i].mac_id,
- app_proc_ae_handlerUPP, SRefCon(qApp), false);
- }
- }
-
- if (QApplicationPrivate::app_style) {
- QEvent ev(QEvent::Style);
- qt_sendSpontaneousEvent(QApplicationPrivate::app_style, &ev);
- }
- }
- if (QApplication::desktopSettingsAware())
- QApplicationPrivate::qt_mac_apply_settings();
-
- // Cocoa application delegate
- NSApplication *cocoaApp = [QNSApplication sharedApplication];
- qt_redirectNSApplicationSendEvent();
-
- QMacCocoaAutoReleasePool pool;
- id oldDelegate = [cocoaApp delegate];
- QT_MANGLE_NAMESPACE(QCocoaApplicationDelegate) *newDelegate = [QT_MANGLE_NAMESPACE(QCocoaApplicationDelegate) sharedDelegate];
- Q_ASSERT(newDelegate);
- [newDelegate setQtPrivate:priv];
- // Only do things that make sense to do once, otherwise we crash.
- if (oldDelegate != newDelegate && !QApplication::testAttribute(Qt::AA_MacPluginApplication)) {
- [newDelegate setReflectionDelegate:oldDelegate];
- [cocoaApp setDelegate:newDelegate];
-
- QT_MANGLE_NAMESPACE(QCocoaMenuLoader) *qtMenuLoader = [[QT_MANGLE_NAMESPACE(QCocoaMenuLoader) alloc] init];
- if ([NSBundle loadNibNamed:@"qt_menu" owner:qtMenuLoader] == false) {
- qFatal("Qt internal error: qt_menu.nib could not be loaded. The .nib file"
- " should be placed in QtGui.framework/Versions/Current/Resources/ "
- " or in the resources directory of your application bundle.");
- }
-
- [cocoaApp setMenu:[qtMenuLoader menu]];
- [newDelegate setMenuLoader:qtMenuLoader];
- [qtMenuLoader release];
- }
- // Register for Carbon tablet proximity events on the event monitor target.
- // This means that we should receive proximity events even when we aren't the active application.
- if (!tablet_proximity_handler) {
- tablet_proximity_UPP = NewEventHandlerUPP(QApplicationPrivate::tabletProximityCallback);
- qt_init_tablet_proximity_handler();
- }
- priv->native_modal_dialog_active = false;
-
- qt_mac_read_fontsmoothing_settings();
-}
-
-void qt_release_apple_event_handler()
-{
- if(app_proc_ae_handlerUPP) {
- for(uint i = 0; i < sizeof(app_apple_events) / sizeof(QMacAppleEventTypeSpec); ++i)
- AERemoveEventHandler(app_apple_events[i].mac_class, app_apple_events[i].mac_id,
- app_proc_ae_handlerUPP, true);
- DisposeAEEventHandlerUPP(app_proc_ae_handlerUPP);
- app_proc_ae_handlerUPP = 0;
- }
-}
-
-/*****************************************************************************
- qt_cleanup() - cleans up when the application is finished
- *****************************************************************************/
-
-void qt_cleanup()
-{
- CGDisplayRemoveReconfigurationCallback(qt_mac_display_change_callbk, 0);
- CFNotificationCenterRef center = CFNotificationCenterGetDistributedCenter();
- CFNotificationCenterRemoveObserver(center, qApp, kCMDeviceUnregisteredNotification, 0);
- CFNotificationCenterRemoveObserver(center, qApp, kCMDefaultDeviceNotification, 0);
- CFNotificationCenterRemoveObserver(center, qApp, kCMDeviceProfilesNotification, 0);
- CFNotificationCenterRemoveObserver(center, qApp, kCMDefaultDeviceProfileNotification, 0);
-
- qt_release_apple_event_handler();
- qt_release_tablet_proximity_handler();
- if (tablet_proximity_UPP)
- DisposeEventHandlerUPP(tablet_proximity_UPP);
-
- QPixmapCache::clear();
- if (qt_is_gui_used) {
-#ifndef QT_NO_ACCESSIBILITY
- QAccessible::cleanup();
-#endif
- QMacInputContext::cleanup();
- QCursorData::cleanup();
- QFont::cleanup();
- QColormap::cleanup();
- if (qt_mac_safe_pdev) {
- delete qt_mac_safe_pdev;
- qt_mac_safe_pdev = 0;
- }
- extern void qt_mac_unregister_widget(); // qapplication_mac.cpp
- qt_mac_unregister_widget();
- }
-}
-
-/*****************************************************************************
- Platform specific global and internal functions
- *****************************************************************************/
-void qt_updated_rootinfo()
-{
-}
-
-bool qt_wstate_iconified(WId)
-{
- return false;
-}
-
-/*****************************************************************************
- Platform specific QApplication members
- *****************************************************************************/
-extern QWidget * mac_mouse_grabber;
-extern QWidget * mac_keyboard_grabber;
-
-#ifndef QT_NO_CURSOR
-
-/*****************************************************************************
- QApplication cursor stack
- *****************************************************************************/
-
-void QApplication::setOverrideCursor(const QCursor &cursor)
-{
- qApp->d_func()->cursor_list.prepend(cursor);
-
- qt_mac_update_cursor();
-}
-
-void QApplication::restoreOverrideCursor()
-{
- if (qApp->d_func()->cursor_list.isEmpty())
- return;
- qApp->d_func()->cursor_list.removeFirst();
-
- qt_mac_update_cursor();
-}
-#endif // QT_NO_CURSOR
-
-QWidget *QApplication::topLevelAt(const QPoint &p)
-{
- // Use a cache to avoid iterate through the whole list of windows for all
- // calls to to topLevelAt. We e.g. do this for each and every mouse
- // move since we need to find the widget under mouse:
- if (topLevelAt_cache && topLevelAt_cache->frameGeometry().contains(p))
- return topLevelAt_cache;
-
- // INVARIANT: Cache miss. Go through the list if windows instead:
- QMacCocoaAutoReleasePool pool;
- NSPoint cocoaPoint = flipPoint(p);
- NSInteger windowCount;
- NSCountWindows(&windowCount);
- if (windowCount <= 0)
- return 0; // There's no window to find!
-
- QVarLengthArray<NSInteger> windowList(windowCount);
- NSWindowList(windowCount, windowList.data());
- int firstQtWindowFound = -1;
- for (int i = 0; i < windowCount; ++i) {
- NSWindow *window = [NSApp windowWithWindowNumber:windowList[i]];
- if (window) {
- QWidget *candidateWindow = [window QT_MANGLE_NAMESPACE(qt_qwidget)];
- if (candidateWindow && firstQtWindowFound == -1)
- firstQtWindowFound = i;
-
- if (NSPointInRect(cocoaPoint, [window frame])) {
- // Check to see if there's a hole in the window where the mask is.
- // If there is, we should just continue to see if there is a window below.
- if (candidateWindow && !candidateWindow->mask().isEmpty()) {
- QPoint localPoint = candidateWindow->mapFromGlobal(p);
- if (!candidateWindow->mask().contains(localPoint))
- continue;
- else
- return candidateWindow;
- } else {
- if (i == firstQtWindowFound) {
- // The cache will only work when the window under mouse is
- // top most (that is, not partially obscured by other windows.
- // And we only set it if no mask is present to optimize for the common case:
- topLevelAt_cache = candidateWindow;
- }
- return candidateWindow;
- }
- }
- }
- }
-
- topLevelAt_cache = 0;
- return 0;
-}
-
-/*****************************************************************************
- Main event loop
- *****************************************************************************/
-
-bool QApplicationPrivate::modalState()
-{
- return app_do_modal;
-}
-
-
-void QApplicationPrivate::enterModal_sys(QWidget *widget)
-{
-#ifdef DEBUG_MODAL_EVENTS
- Q_ASSERT(widget);
- qDebug("Entering modal state with %s::%s::%p (%d)", widget->metaObject()->className(), widget->objectName().toLocal8Bit().constData(),
- widget, qt_modal_stack ? (int)qt_modal_stack->count() : -1);
-#endif
- if (!qt_modal_stack)
- qt_modal_stack = new QWidgetList;
-
- dispatchEnterLeave(0, qt_last_mouse_receiver);
- qt_last_mouse_receiver = 0;
-
- qt_modal_stack->insert(0, widget);
- if (!app_do_modal)
- qt_event_request_menubarupdate();
- app_do_modal = true;
- qt_button_down = 0;
-
- if (!qt_mac_is_macsheet(widget))
- QEventDispatcherMacPrivate::beginModalSession(widget);
-}
-
-void QApplicationPrivate::leaveModal_sys(QWidget *widget)
-{
- if (qt_modal_stack && qt_modal_stack->removeAll(widget)) {
-#ifdef DEBUG_MODAL_EVENTS
- qDebug("Leaving modal state with %s::%s::%p (%d)", widget->metaObject()->className(), widget->objectName().toLocal8Bit().constData(),
- widget, qt_modal_stack->count());
-#endif
- if (qt_modal_stack->isEmpty()) {
- delete qt_modal_stack;
- qt_modal_stack = 0;
- QPoint p(QCursor::pos());
- app_do_modal = false;
- QWidget* w = 0;
- if (QWidget *grabber = QWidget::mouseGrabber())
- w = grabber;
- else
- w = QApplication::widgetAt(p.x(), p.y());
- dispatchEnterLeave(w, qt_last_mouse_receiver); // send synthetic enter event
- qt_last_mouse_receiver = w;
- }
- if (!qt_mac_is_macsheet(widget))
- QEventDispatcherMacPrivate::endModalSession(widget);
- }
-#ifdef DEBUG_MODAL_EVENTS
- else qDebug("Failure to remove %s::%s::%p -- %p", widget->metaObject()->className(), widget->objectName().toLocal8Bit().constData(), widget, qt_modal_stack);
-#endif
- app_do_modal = (qt_modal_stack != 0);
- if (!app_do_modal)
- qt_event_request_menubarupdate();
-}
-
-QWidget *QApplicationPrivate::tryModalHelper_sys(QWidget *top)
-{
- return top;
-}
-
-
-OSStatus QApplicationPrivate::tabletProximityCallback(EventHandlerCallRef, EventRef carbonEvent,
- void *)
-{
- OSType eventClass = GetEventClass(carbonEvent);
- UInt32 eventKind = GetEventKind(carbonEvent);
- if (eventClass != kEventClassTablet || eventKind != kEventTabletProximity)
- return eventNotHandledErr;
-
- // Get the current point of the device and its unique ID.
- ::TabletProximityRec proxRec;
- GetEventParameter(carbonEvent, kEventParamTabletProximityRec, typeTabletProximityRec, 0,
- sizeof(proxRec), 0, &proxRec);
- qt_dispatchTabletProximityEvent(proxRec);
- return noErr;
-}
-
-OSStatus
-QApplicationPrivate::globalEventProcessor(EventHandlerCallRef er, EventRef event, void *data)
-{
- Q_UNUSED(er);
- Q_UNUSED(event);
- Q_UNUSED(data);
- return eventNotHandledErr;
-}
-
-void QApplicationPrivate::qt_initAfterNSAppStarted()
-{
- setupAppleEvents();
- qt_mac_update_cursor();
-}
-
-void QApplicationPrivate::setupAppleEvents()
-{
- // This function is called from the event dispatcher when NSApplication has
- // finished initialization, which appears to be just after [NSApplication run] has
- // started to execute. By setting up our apple events handlers this late, we override
- // the ones set up by NSApplication.
-
- // If Qt is used as a plugin, we let the 3rd party application handle events
- // like quit and open file events. Otherwise, if we install our own handlers, we
- // easily end up breaking functionallity the 3rd party application depend on:
- if (QApplication::testAttribute(Qt::AA_MacPluginApplication))
- return;
-
- QT_MANGLE_NAMESPACE(QCocoaApplicationDelegate) *newDelegate = [QT_MANGLE_NAMESPACE(QCocoaApplicationDelegate) sharedDelegate];
- NSAppleEventManager *eventManager = [NSAppleEventManager sharedAppleEventManager];
- [eventManager setEventHandler:newDelegate andSelector:@selector(appleEventQuit:withReplyEvent:)
- forEventClass:kCoreEventClass andEventID:kAEQuitApplication];
- [eventManager setEventHandler:newDelegate andSelector:@selector(getUrl:withReplyEvent:)
- forEventClass:kInternetEventClass andEventID:kAEGetURL];
-}
-
-// In Carbon this is your one stop for apple events.
-// In Cocoa, it ISN'T. This is the catch-all Apple Event handler that exists
-// for the time between instantiating the NSApplication, but before the
-// NSApplication has installed it's OWN Apple Event handler. When Cocoa has
-// that set up, we remove this. So, if you are debugging problems, you likely
-// want to check out QCocoaApplicationDelegate instead.
-OSStatus QApplicationPrivate::globalAppleEventProcessor(const AppleEvent *ae, AppleEvent *, long handlerRefcon)
-{
- QApplication *app = (QApplication *)handlerRefcon;
- bool handled_event=false;
- OSType aeID=typeWildCard, aeClass=typeWildCard;
- AEGetAttributePtr(ae, keyEventClassAttr, typeType, 0, &aeClass, sizeof(aeClass), 0);
- AEGetAttributePtr(ae, keyEventIDAttr, typeType, 0, &aeID, sizeof(aeID), 0);
- if(aeClass == kCoreEventClass) {
- switch(aeID) {
- case kAEQuitApplication: {
- extern bool qt_mac_quit_menu_item_enabled; // qmenu_mac.cpp
- if (qt_mac_quit_menu_item_enabled) {
- QCloseEvent ev;
- QApplication::sendSpontaneousEvent(app, &ev);
- if(ev.isAccepted()) {
- handled_event = true;
- app->quit();
- }
- } else {
- QApplication::beep(); // Sorry, you can't quit right now.
- }
- break; }
- case kAEOpenDocuments: {
- AEDescList docs;
- if(AEGetParamDesc(ae, keyDirectObject, typeAEList, &docs) == noErr) {
- long cnt = 0;
- AECountItems(&docs, &cnt);
- UInt8 *str_buffer = NULL;
- for(int i = 0; i < cnt; i++) {
- FSRef ref;
- if(AEGetNthPtr(&docs, i+1, typeFSRef, 0, 0, &ref, sizeof(ref), 0) != noErr)
- continue;
- if(!str_buffer)
- str_buffer = (UInt8 *)malloc(1024);
- FSRefMakePath(&ref, str_buffer, 1024);
- QFileOpenEvent ev(QString::fromUtf8((const char *)str_buffer));
- QApplication::sendSpontaneousEvent(app, &ev);
- }
- if(str_buffer)
- free(str_buffer);
- }
- break; }
- default:
- break;
- }
- } else if (aeClass == kInternetEventClass) {
- switch (aeID) {
- case kAEGetURL: {
- char urlData[1024];
- Size actualSize;
- if (AEGetParamPtr(ae, keyDirectObject, typeChar, 0, urlData,
- sizeof(urlData) - 1, &actualSize) == noErr) {
- urlData[actualSize] = 0;
- QFileOpenEvent ev(QUrl(QString::fromUtf8(urlData)));
- QApplication::sendSpontaneousEvent(app, &ev);
- }
- break;
- }
- default:
- break;
- }
- }
-#ifdef DEBUG_EVENTS
- qDebug("Qt: internal: %shandled Apple event! %c%c%c%c %c%c%c%c", handled_event ? "(*)" : "",
- char(aeID >> 24), char((aeID >> 16) & 255), char((aeID >> 8) & 255),char(aeID & 255),
- char(aeClass >> 24), char((aeClass >> 16) & 255), char((aeClass >> 8) & 255),char(aeClass & 255));
-#else
- if(!handled_event) //let the event go through
- return eventNotHandledErr;
- return noErr; //we eat the event
-#endif
-}
-
-/*!
- \fn bool QApplication::macEventFilter(EventHandlerCallRef caller, EventRef event)
-
- \warning This virtual function is only used under Mac OS X, and behaves different
- depending on if Qt is based on Carbon or Cocoa.
-
- For the Carbon port, If you create an application that inherits QApplication and reimplement
- this function, you get direct access to all Carbon Events that Qt registers
- for from Mac OS X with this function being called with the \a caller and
- the \a event.
-
- For the Cocoa port, If you create an application that inherits QApplication and reimplement
- this function, you get direct access to all Cocoa Events that Qt receives
- from Mac OS X with this function being called with the \a caller being 0 and
- the \a event being an NSEvent pointer:
-
- NSEvent *e = reinterpret_cast<NSEvent *>(event);
-
- Return true if you want to stop the event from being processed.
- Return false for normal event dispatching. The default
- implementation returns false.
-*/
-bool QApplication::macEventFilter(EventHandlerCallRef, EventRef)
-{
- return false;
-}
-
-/*!
- \internal
-*/
-void QApplicationPrivate::openPopup(QWidget *popup)
-{
- if (!QApplicationPrivate::popupWidgets) // create list
- QApplicationPrivate::popupWidgets = new QWidgetList;
- QApplicationPrivate::popupWidgets->append(popup); // add to end of list
-
- // popups are not focus-handled by the window system (the first
- // popup grabbed the keyboard), so we have to do that manually: A
- // new popup gets the focus
- if (popup->focusWidget()) {
- popup->focusWidget()->setFocus(Qt::PopupFocusReason);
- } else if (QApplicationPrivate::popupWidgets->count() == 1) { // this was the first popup
- popup->setFocus(Qt::PopupFocusReason);
- }
-}
-
-/*!
- \internal
-*/
-void QApplicationPrivate::closePopup(QWidget *popup)
-{
- Q_Q(QApplication);
- if (!QApplicationPrivate::popupWidgets)
- return;
-
- QApplicationPrivate::popupWidgets->removeAll(popup);
- if (popup == qt_button_down)
- qt_button_down = 0;
- if (QApplicationPrivate::popupWidgets->isEmpty()) { // this was the last popup
- delete QApplicationPrivate::popupWidgets;
- QApplicationPrivate::popupWidgets = 0;
-
- // Special case for Tool windows: since they are activated and deactived together
- // with a normal window they never become the QApplicationPrivate::active_window.
- QWidget *appFocusWidget = QApplication::focusWidget();
- if (appFocusWidget && appFocusWidget->window()->windowType() == Qt::Tool) {
- appFocusWidget->setFocus(Qt::PopupFocusReason);
- } else if (QApplicationPrivate::active_window) {
- if (QWidget *fw = QApplicationPrivate::active_window->focusWidget()) {
- if (fw != QApplication::focusWidget()) {
- fw->setFocus(Qt::PopupFocusReason);
- } else {
- QFocusEvent e(QEvent::FocusIn, Qt::PopupFocusReason);
- q->sendEvent(fw, &e);
- }
- }
- }
- } else {
- // popups are not focus-handled by the window system (the
- // first popup grabbed the keyboard), so we have to do that
- // manually: A popup was closed, so the previous popup gets
- // the focus.
- QWidget* aw = QApplicationPrivate::popupWidgets->last();
- if (QWidget *fw = aw->focusWidget())
- fw->setFocus(Qt::PopupFocusReason);
- }
-}
-
-void QApplication::beep()
-{
- qt_mac_beep();
-}
-
-void QApplication::alert(QWidget *widget, int duration)
-{
- if (!QApplicationPrivate::checkInstance("alert"))
- return;
-
- QWidgetList windowsToMark;
- if (!widget)
- windowsToMark += topLevelWidgets();
- else
- windowsToMark.append(widget->window());
-
- bool needNotification = false;
- for (int i = 0; i < windowsToMark.size(); ++i) {
- QWidget *window = windowsToMark.at(i);
- if (!window->isActiveWindow() && window->isVisible()) {
- needNotification = true; // yeah, we may set it multiple times, but that's OK.
- if (duration != 0) {
- QTimer *timer = new QTimer(qApp);
- timer->setSingleShot(true);
- connect(timer, SIGNAL(timeout()), qApp, SLOT(_q_alertTimeOut()));
- if (QTimer *oldTimer = qApp->d_func()->alertTimerHash.value(widget)) {
- qApp->d_func()->alertTimerHash.remove(widget);
- delete oldTimer;
- }
- qApp->d_func()->alertTimerHash.insert(widget, timer);
- timer->start(duration);
- }
- }
- }
- if (needNotification)
- qt_mac_send_notification();
-}
-
-void QApplicationPrivate::_q_alertTimeOut()
-{
- if (QTimer *timer = qobject_cast<QTimer *>(q_func()->sender())) {
- QHash<QWidget *, QTimer *>::iterator it = alertTimerHash.begin();
- while (it != alertTimerHash.end()) {
- if (it.value() == timer) {
- alertTimerHash.erase(it);
- timer->deleteLater();
- break;
- }
- ++it;
- }
- if (alertTimerHash.isEmpty()) {
- qt_mac_cancel_notification();
- }
- }
-}
-
-void QApplication::setCursorFlashTime(int msecs)
-{
- QApplicationPrivate::cursor_flash_time = msecs;
-}
-
-int QApplication::cursorFlashTime()
-{
- return QApplicationPrivate::cursor_flash_time;
-}
-
-void QApplication::setDoubleClickInterval(int ms)
-{
- qt_mac_dblclick.use_qt_time_limit = true;
- QApplicationPrivate::mouse_double_click_time = ms;
-}
-
-int QApplication::doubleClickInterval()
-{
- if (!qt_mac_dblclick.use_qt_time_limit) { //get it from the system
- QSettings appleSettings(QLatin1String("apple.com"));
- /* First worked as of 10.3.3 */
- double dci = appleSettings.value(QLatin1String("com/apple/mouse/doubleClickThreshold"), 0.5).toDouble();
- return int(dci * 1000);
- }
- return QApplicationPrivate::mouse_double_click_time;
-}
-
-void QApplication::setKeyboardInputInterval(int ms)
-{
- QApplicationPrivate::keyboard_input_time = ms;
-}
-
-int QApplication::keyboardInputInterval()
-{
- // FIXME: get from the system
- return QApplicationPrivate::keyboard_input_time;
-}
-
-#ifndef QT_NO_WHEELEVENT
-void QApplication::setWheelScrollLines(int n)
-{
- QApplicationPrivate::wheel_scroll_lines = n;
-}
-
-int QApplication::wheelScrollLines()
-{
- return QApplicationPrivate::wheel_scroll_lines;
-}
-#endif
-
-void QApplication::setEffectEnabled(Qt::UIEffect effect, bool enable)
-{
- switch (effect) {
- case Qt::UI_FadeMenu:
- QApplicationPrivate::fade_menu = enable;
- break;
- case Qt::UI_AnimateMenu:
- QApplicationPrivate::animate_menu = enable;
- break;
- case Qt::UI_FadeTooltip:
- QApplicationPrivate::fade_tooltip = enable;
- break;
- case Qt::UI_AnimateTooltip:
- QApplicationPrivate::animate_tooltip = enable;
- break;
- case Qt::UI_AnimateCombo:
- QApplicationPrivate::animate_combo = enable;
- break;
- case Qt::UI_AnimateToolBox:
- QApplicationPrivate::animate_toolbox = enable;
- break;
- case Qt::UI_General:
- QApplicationPrivate::fade_tooltip = true;
- break;
- default:
- QApplicationPrivate::animate_ui = enable;
- break;
- }
-
- if (enable)
- QApplicationPrivate::animate_ui = true;
-}
-
-bool QApplication::isEffectEnabled(Qt::UIEffect effect)
-{
- if (QColormap::instance().depth() < 16 || !QApplicationPrivate::animate_ui)
- return false;
-
- switch(effect) {
- case Qt::UI_AnimateMenu:
- return QApplicationPrivate::animate_menu;
- case Qt::UI_FadeMenu:
- return QApplicationPrivate::fade_menu;
- case Qt::UI_AnimateCombo:
- return QApplicationPrivate::animate_combo;
- case Qt::UI_AnimateTooltip:
- return QApplicationPrivate::animate_tooltip;
- case Qt::UI_FadeTooltip:
- return QApplicationPrivate::fade_tooltip;
- case Qt::UI_AnimateToolBox:
- return QApplicationPrivate::animate_toolbox;
- default:
- break;
- }
- return QApplicationPrivate::animate_ui;
-}
-
-/*!
- \internal
-*/
-bool QApplicationPrivate::qt_mac_apply_settings()
-{
- QSettings settings(QSettings::UserScope, QLatin1String("Trolltech"));
- settings.beginGroup(QLatin1String("Qt"));
-
- /*
- Qt settings. This is how they are written into the datastream.
- Palette/ * - QPalette
- font - QFont
- libraryPath - QStringList
- style - QString
- doubleClickInterval - int
- cursorFlashTime - int
- wheelScrollLines - int
- colorSpec - QString
- defaultCodec - QString
- globalStrut/width - int
- globalStrut/height - int
- GUIEffects - QStringList
- Font Substitutions/ * - QStringList
- Font Substitutions/... - QStringList
- */
-
- // read library (ie. plugin) path list
- QString libpathkey =
- QString::fromLatin1("%1.%2/libraryPath")
- .arg(QT_VERSION >> 16)
- .arg((QT_VERSION & 0xff00) >> 8);
- QStringList pathlist = settings.value(libpathkey).toString().split(QLatin1Char(':'));
- if (!pathlist.isEmpty()) {
- QStringList::ConstIterator it = pathlist.begin();
- while(it != pathlist.end())
- QApplication::addLibraryPath(*it++);
- }
-
- QString defaultcodec = settings.value(QLatin1String("defaultCodec"), QVariant(QLatin1String("none"))).toString();
- if (defaultcodec != QLatin1String("none")) {
- QTextCodec *codec = QTextCodec::codecForName(defaultcodec.toLatin1().constData());
- if (codec)
- QTextCodec::setCodecForTr(codec);
- }
-
- if (qt_is_gui_used) {
- QString str;
- QStringList strlist;
- int num;
-
- // read new palette
- int i;
- QPalette pal(QApplication::palette());
- strlist = settings.value(QLatin1String("Palette/active")).toStringList();
- if (strlist.count() == QPalette::NColorRoles) {
- for (i = 0; i < QPalette::NColorRoles; i++)
- pal.setColor(QPalette::Active, (QPalette::ColorRole) i,
- QColor(strlist[i]));
- }
- strlist = settings.value(QLatin1String("Palette/inactive")).toStringList();
- if (strlist.count() == QPalette::NColorRoles) {
- for (i = 0; i < QPalette::NColorRoles; i++)
- pal.setColor(QPalette::Inactive, (QPalette::ColorRole) i,
- QColor(strlist[i]));
- }
- strlist = settings.value(QLatin1String("Palette/disabled")).toStringList();
- if (strlist.count() == QPalette::NColorRoles) {
- for (i = 0; i < QPalette::NColorRoles; i++)
- pal.setColor(QPalette::Disabled, (QPalette::ColorRole) i,
- QColor(strlist[i]));
- }
-
- if (pal != QApplication::palette())
- QApplication::setPalette(pal);
-
- // read new font
- QFont font(QApplication::font());
- str = settings.value(QLatin1String("font")).toString();
- if (!str.isEmpty()) {
- font.fromString(str);
- if (font != QApplication::font())
- QApplication::setFont(font);
- }
-
- // read new QStyle
- QString stylename = settings.value(QLatin1String("style")).toString();
- if (! stylename.isNull() && ! stylename.isEmpty()) {
- QStyle *style = QStyleFactory::create(stylename);
- if (style)
- QApplication::setStyle(style);
- else
- stylename = QLatin1String("default");
- } else {
- stylename = QLatin1String("default");
- }
-
- num = settings.value(QLatin1String("doubleClickInterval"),
- QApplication::doubleClickInterval()).toInt();
- QApplication::setDoubleClickInterval(num);
-
- num = settings.value(QLatin1String("cursorFlashTime"),
- QApplication::cursorFlashTime()).toInt();
- QApplication::setCursorFlashTime(num);
-
-#ifndef QT_NO_WHEELEVENT
- num = settings.value(QLatin1String("wheelScrollLines"),
- QApplication::wheelScrollLines()).toInt();
- QApplication::setWheelScrollLines(num);
-#endif
-
- QString colorspec = settings.value(QLatin1String("colorSpec"),
- QVariant(QLatin1String("default"))).toString();
- if (colorspec == QLatin1String("normal"))
- QApplication::setColorSpec(QApplication::NormalColor);
- else if (colorspec == QLatin1String("custom"))
- QApplication::setColorSpec(QApplication::CustomColor);
- else if (colorspec == QLatin1String("many"))
- QApplication::setColorSpec(QApplication::ManyColor);
- else if (colorspec != QLatin1String("default"))
- colorspec = QLatin1String("default");
-
- int w = settings.value(QLatin1String("globalStrut/width")).toInt();
- int h = settings.value(QLatin1String("globalStrut/height")).toInt();
- QSize strut(w, h);
- if (strut.isValid())
- QApplication::setGlobalStrut(strut);
-
- QStringList effects = settings.value(QLatin1String("GUIEffects")).toStringList();
- if (!effects.isEmpty()) {
- if (effects.contains(QLatin1String("none")))
- QApplication::setEffectEnabled(Qt::UI_General, false);
- if (effects.contains(QLatin1String("general")))
- QApplication::setEffectEnabled(Qt::UI_General, true);
- if (effects.contains(QLatin1String("animatemenu")))
- QApplication::setEffectEnabled(Qt::UI_AnimateMenu, true);
- if (effects.contains(QLatin1String("fademenu")))
- QApplication::setEffectEnabled(Qt::UI_FadeMenu, true);
- if (effects.contains(QLatin1String("animatecombo")))
- QApplication::setEffectEnabled(Qt::UI_AnimateCombo, true);
- if (effects.contains(QLatin1String("animatetooltip")))
- QApplication::setEffectEnabled(Qt::UI_AnimateTooltip, true);
- if (effects.contains(QLatin1String("fadetooltip")))
- QApplication::setEffectEnabled(Qt::UI_FadeTooltip, true);
- if (effects.contains(QLatin1String("animatetoolbox")))
- QApplication::setEffectEnabled(Qt::UI_AnimateToolBox, true);
- } else {
- QApplication::setEffectEnabled(Qt::UI_General, true);
- }
-
- settings.beginGroup(QLatin1String("Font Substitutions"));
- QStringList fontsubs = settings.childKeys();
- if (!fontsubs.isEmpty()) {
- QStringList::Iterator it = fontsubs.begin();
- for (; it != fontsubs.end(); ++it) {
- QString fam = QString::fromLatin1((*it).toLatin1().constData());
- QStringList subs = settings.value(fam).toStringList();
- QFont::insertSubstitutions(fam, subs);
- }
- }
- settings.endGroup();
- }
-
- settings.endGroup();
- return true;
-}
-
-// DRSWAT
-
-bool QApplicationPrivate::canQuit()
-{
- Q_Q(QApplication);
- [[NSApp mainMenu] cancelTracking];
-
- bool handle_quit = true;
- if (QApplicationPrivate::modalState() && [[[[QT_MANGLE_NAMESPACE(QCocoaApplicationDelegate) sharedDelegate]
- menuLoader] quitMenuItem] isEnabled]) {
- int visible = 0;
- const QWidgetList tlws = QApplication::topLevelWidgets();
- for(int i = 0; i < tlws.size(); ++i) {
- if (tlws.at(i)->isVisible())
- ++visible;
- }
- handle_quit = (visible <= 1);
- }
- if (handle_quit) {
- QCloseEvent ev;
- QApplication::sendSpontaneousEvent(q, &ev);
- if (ev.isAccepted()) {
- return true;
- }
- }
- return false;
-}
-
-void onApplicationWindowChangedActivation(QWidget *widget, bool activated)
-{
- if (!widget)
- return;
-
- if (activated) {
- if (QApplicationPrivate::app_style) {
- QEvent ev(QEvent::Style);
- qt_sendSpontaneousEvent(QApplicationPrivate::app_style, &ev);
- }
- qApp->setActiveWindow(widget);
- } else { // deactivated
- if (QApplicationPrivate::active_window == widget)
- qApp->setActiveWindow(0);
- }
-
- QMenuBar::macUpdateMenuBar();
- qt_mac_update_cursor();
-}
-
-
-void onApplicationChangedActivation( bool activated )
-{
- QApplication *app = qApp;
-
-//NSLog(@"App Changed Activation\n");
-
- if ( activated ) {
- if (QApplication::desktopSettingsAware())
- qt_mac_update_os_settings();
-
- if (qt_clipboard) { //manufacture an event so the clipboard can see if it has changed
- QEvent ev(QEvent::Clipboard);
- qt_sendSpontaneousEvent(qt_clipboard, &ev);
- }
-
- if (app) {
- QEvent ev(QEvent::ApplicationActivate);
- qt_sendSpontaneousEvent(app, &ev);
- }
-
- if (!app->activeWindow()) {
- OSWindowRef wp = [NSApp keyWindow];
- if (QWidget *tmp_w = qt_mac_find_window(wp))
- app->setActiveWindow(tmp_w);
- }
- QMenuBar::macUpdateMenuBar();
- qt_mac_update_cursor();
- } else { // de-activated
- QApplicationPrivate *priv = [[QT_MANGLE_NAMESPACE(QCocoaApplicationDelegate) sharedDelegate] qAppPrivate];
- while (priv->inPopupMode())
- app->activePopupWidget()->close();
- if (app) {
- QEvent ev(QEvent::ApplicationDeactivate);
- qt_sendSpontaneousEvent(app, &ev);
- }
- app->setActiveWindow(0);
- }
-}
-
-void QApplicationPrivate::initializeMultitouch_sys()
-{ }
-void QApplicationPrivate::cleanupMultitouch_sys()
-{ }
-
-QT_END_NAMESPACE
diff --git a/src/widgets/platforms/mac/qclipboard_mac.cpp b/src/widgets/platforms/mac/qclipboard_mac.cpp
deleted file mode 100644
index 3ec4bfb8c1..0000000000
--- a/src/widgets/platforms/mac/qclipboard_mac.cpp
+++ /dev/null
@@ -1,632 +0,0 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
-
-#include "qclipboard.h"
-#include "qapplication.h"
-#include "qbitmap.h"
-#include "qdatetime.h"
-#include "qdebug.h"
-#include "qapplication_p.h"
-#include <private/qt_mac_p.h>
-#include "qevent.h"
-#include "qurl.h"
-#include <stdlib.h>
-#include <string.h>
-#include "qt_cocoa_helpers_mac_p.h"
-
-QT_BEGIN_NAMESPACE
-
-QT_USE_NAMESPACE
-
-/*****************************************************************************
- QClipboard debug facilities
- *****************************************************************************/
-//#define DEBUG_PASTEBOARD
-
-#ifndef QT_NO_CLIPBOARD
-
-/*****************************************************************************
- QClipboard member functions for mac.
- *****************************************************************************/
-
-static QMacPasteboard *qt_mac_pasteboards[2] = {0, 0};
-
-static inline QMacPasteboard *qt_mac_pasteboard(QClipboard::Mode mode)
-{
- Q_ASSERT(mode == QClipboard::Clipboard || mode == QClipboard::FindBuffer);
- if (mode == QClipboard::Clipboard)
- return qt_mac_pasteboards[0];
- else
- return qt_mac_pasteboards[1];
-}
-
-static void qt_mac_cleanupPasteboard() {
- delete qt_mac_pasteboards[0];
- delete qt_mac_pasteboards[1];
- qt_mac_pasteboards[0] = 0;
- qt_mac_pasteboards[1] = 0;
-}
-
-static bool qt_mac_updateScrap(QClipboard::Mode mode)
-{
- if(!qt_mac_pasteboards[0]) {
- qt_mac_pasteboards[0] = new QMacPasteboard(kPasteboardClipboard, QMacPasteboardMime::MIME_CLIP);
- qt_mac_pasteboards[1] = new QMacPasteboard(kPasteboardFind, QMacPasteboardMime::MIME_CLIP);
- qAddPostRoutine(qt_mac_cleanupPasteboard);
- return true;
- }
- return qt_mac_pasteboard(mode)->sync();
-}
-
-void QClipboard::clear(Mode mode)
-{
- if (!supportsMode(mode))
- return;
- qt_mac_updateScrap(mode);
- qt_mac_pasteboard(mode)->clear();
- setMimeData(0, mode);
-}
-
-void QClipboard::ownerDestroyed()
-{
-}
-
-
-void QClipboard::connectNotify(const char *signal)
-{
- Q_UNUSED(signal);
-}
-
-bool QClipboard::event(QEvent *e)
-{
- if(e->type() != QEvent::Clipboard)
- return QObject::event(e);
-
- if (qt_mac_updateScrap(QClipboard::Clipboard)) {
- emitChanged(QClipboard::Clipboard);
- }
-
- if (qt_mac_updateScrap(QClipboard::FindBuffer)) {
- emitChanged(QClipboard::FindBuffer);
- }
-
- return QObject::event(e);
-}
-
-const QMimeData *QClipboard::mimeData(Mode mode) const
-{
- if (!supportsMode(mode))
- return 0;
- qt_mac_updateScrap(mode);
- return qt_mac_pasteboard(mode)->mimeData();
-}
-
-void QClipboard::setMimeData(QMimeData *src, Mode mode)
-{
- if (!supportsMode(mode))
- return;
- qt_mac_updateScrap(mode);
- qt_mac_pasteboard(mode)->setMimeData(src);
- emitChanged(mode);
-}
-
-bool QClipboard::supportsMode(Mode mode) const
-{
- return (mode == Clipboard || mode == FindBuffer);
-}
-
-bool QClipboard::ownsMode(Mode mode) const
-{
- Q_UNUSED(mode);
- return false;
-}
-
-#endif // QT_NO_CLIPBOARD
-
-/*****************************************************************************
- QMacPasteboard code
-*****************************************************************************/
-
-QMacPasteboard::QMacPasteboard(PasteboardRef p, uchar mt)
-{
- mac_mime_source = false;
- mime_type = mt ? mt : uchar(QMacPasteboardMime::MIME_ALL);
- paste = p;
- CFRetain(paste);
-}
-
-QMacPasteboard::QMacPasteboard(uchar mt)
-{
- mac_mime_source = false;
- mime_type = mt ? mt : uchar(QMacPasteboardMime::MIME_ALL);
- paste = 0;
- OSStatus err = PasteboardCreate(0, &paste);
- if(err == noErr) {
- PasteboardSetPromiseKeeper(paste, promiseKeeper, this);
- } else {
- qDebug("PasteBoard: Error creating pasteboard: [%d]", (int)err);
- }
-}
-
-QMacPasteboard::QMacPasteboard(CFStringRef name, uchar mt)
-{
- mac_mime_source = false;
- mime_type = mt ? mt : uchar(QMacPasteboardMime::MIME_ALL);
- paste = 0;
- OSStatus err = PasteboardCreate(name, &paste);
- if(err == noErr) {
- PasteboardSetPromiseKeeper(paste, promiseKeeper, this);
- } else {
- qDebug("PasteBoard: Error creating pasteboard: %s [%d]", QCFString::toQString(name).toLatin1().constData(), (int)err);
- }
-}
-
-QMacPasteboard::~QMacPasteboard()
-{
- // commit all promises for paste after exit close
- for (int i = 0; i < promises.count(); ++i) {
- const Promise &promise = promises.at(i);
- QCFString flavor = QCFString(promise.convertor->flavorFor(promise.mime));
- promiseKeeper(paste, (PasteboardItemID)promise.itemId, flavor, this);
- }
-
- if(paste)
- CFRelease(paste);
-}
-
-PasteboardRef
-QMacPasteboard::pasteBoard() const
-{
- return paste;
-}
-
-OSStatus QMacPasteboard::promiseKeeper(PasteboardRef paste, PasteboardItemID id, CFStringRef flavor, void *_qpaste)
-{
- QMacPasteboard *qpaste = (QMacPasteboard*)_qpaste;
- const long promise_id = (long)id;
-
- // Find the kept promise
- const QString flavorAsQString = QCFString::toQString(flavor);
- QMacPasteboard::Promise promise;
- for (int i = 0; i < qpaste->promises.size(); i++){
- QMacPasteboard::Promise tmp = qpaste->promises[i];
- if (tmp.itemId == promise_id && tmp.convertor->canConvert(tmp.mime, flavorAsQString)){
- promise = tmp;
- break;
- }
- }
-
- if (!promise.itemId && flavorAsQString == QLatin1String("com.trolltech.qt.MimeTypeName")) {
- // we have promised this data, but wont be able to convert, so return null data.
- // This helps in making the application/x-qt-mime-type-name hidden from normal use.
- QByteArray ba;
- QCFType<CFDataRef> data = CFDataCreate(0, (UInt8*)ba.constData(), ba.size());
- PasteboardPutItemFlavor(paste, id, flavor, data, kPasteboardFlavorNoFlags);
- return noErr;
- }
-
- if (!promise.itemId) {
- // There was no promise that could deliver data for the
- // given id and flavor. This should not happend.
- qDebug("Pasteboard: %d: Request for %ld, %s, but no promise found!", __LINE__, promise_id, qPrintable(flavorAsQString));
- return cantGetFlavorErr;
- }
-
-#ifdef DEBUG_PASTEBOARD
- qDebug("PasteBoard: Calling in promise for %s[%ld] [%s] (%s) [%d]", qPrintable(promise.mime), promise_id,
- qPrintable(flavorAsQString), qPrintable(promise.convertor->convertorName()), promise.offset);
-#endif
-
- QList<QByteArray> md = promise.convertor->convertFromMime(promise.mime, promise.data, flavorAsQString);
- if (md.size() <= promise.offset)
- return cantGetFlavorErr;
- const QByteArray &ba = md[promise.offset];
- QCFType<CFDataRef> data = CFDataCreate(0, (UInt8*)ba.constData(), ba.size());
- PasteboardPutItemFlavor(paste, id, flavor, data, kPasteboardFlavorNoFlags);
- return noErr;
-}
-
-bool
-QMacPasteboard::hasOSType(int c_flavor) const
-{
- if (!paste)
- return false;
-
- sync();
-
- ItemCount cnt = 0;
- if(PasteboardGetItemCount(paste, &cnt) || !cnt)
- return false;
-
-#ifdef DEBUG_PASTEBOARD
- qDebug("PasteBoard: hasOSType [%c%c%c%c]", (c_flavor>>24)&0xFF, (c_flavor>>16)&0xFF,
- (c_flavor>>8)&0xFF, (c_flavor>>0)&0xFF);
-#endif
- for(uint index = 1; index <= cnt; ++index) {
-
- PasteboardItemID id;
- if(PasteboardGetItemIdentifier(paste, index, &id) != noErr)
- return false;
-
- QCFType<CFArrayRef> types;
- if(PasteboardCopyItemFlavors(paste, id, &types ) != noErr)
- return false;
-
- const int type_count = CFArrayGetCount(types);
- for(int i = 0; i < type_count; ++i) {
- CFStringRef flavor = (CFStringRef)CFArrayGetValueAtIndex(types, i);
- const int os_flavor = UTGetOSTypeFromString(UTTypeCopyPreferredTagWithClass(flavor, kUTTagClassOSType));
- if(os_flavor == c_flavor) {
-#ifdef DEBUG_PASTEBOARD
- qDebug(" - Found!");
-#endif
- return true;
- }
- }
- }
-#ifdef DEBUG_PASTEBOARD
- qDebug(" - NotFound!");
-#endif
- return false;
-}
-
-bool
-QMacPasteboard::hasFlavor(QString c_flavor) const
-{
- if (!paste)
- return false;
-
- sync();
-
- ItemCount cnt = 0;
- if(PasteboardGetItemCount(paste, &cnt) || !cnt)
- return false;
-
-#ifdef DEBUG_PASTEBOARD
- qDebug("PasteBoard: hasFlavor [%s]", qPrintable(c_flavor));
-#endif
- for(uint index = 1; index <= cnt; ++index) {
-
- PasteboardItemID id;
- if(PasteboardGetItemIdentifier(paste, index, &id) != noErr)
- return false;
-
- PasteboardFlavorFlags flags;
- if(PasteboardGetItemFlavorFlags(paste, id, QCFString(c_flavor), &flags) == noErr) {
-#ifdef DEBUG_PASTEBOARD
- qDebug(" - Found!");
-#endif
- return true;
- }
- }
-#ifdef DEBUG_PASTEBOARD
- qDebug(" - NotFound!");
-#endif
- return false;
-}
-
-class QMacPasteboardMimeSource : public QMimeData {
- const QMacPasteboard *paste;
-public:
- QMacPasteboardMimeSource(const QMacPasteboard *p) : QMimeData(), paste(p) { }
- ~QMacPasteboardMimeSource() { }
- virtual QStringList formats() const { return paste->formats(); }
- virtual QVariant retrieveData(const QString &format, QVariant::Type type) const { return paste->retrieveData(format, type); }
-};
-
-QMimeData
-*QMacPasteboard::mimeData() const
-{
- if(!mime) {
- mac_mime_source = true;
- mime = new QMacPasteboardMimeSource(this);
-
- }
- return mime;
-}
-
-class QMacMimeData : public QMimeData
-{
-public:
- QVariant variantData(const QString &mime) { return retrieveData(mime, QVariant::Invalid); }
-private:
- QMacMimeData();
-};
-
-void
-QMacPasteboard::setMimeData(QMimeData *mime_src)
-{
- if (!paste)
- return;
-
- if (mime == mime_src || (!mime_src && mime && mac_mime_source))
- return;
- mac_mime_source = false;
- delete mime;
- mime = mime_src;
-
- QList<QMacPasteboardMime*> availableConverters = QMacPasteboardMime::all(mime_type);
- if (mime != 0) {
- clear_helper();
- QStringList formats = mime_src->formats();
-
- // QMimeData sub classes reimplementing the formats() might not expose the
- // temporary "application/x-qt-mime-type-name" mimetype. So check the existence
- // of this mime type while doing drag and drop.
- QString dummyMimeType(QLatin1String("application/x-qt-mime-type-name"));
- if (!formats.contains(dummyMimeType)) {
- QByteArray dummyType = mime_src->data(dummyMimeType);
- if (!dummyType.isEmpty()) {
- formats.append(dummyMimeType);
- }
- }
- for(int f = 0; f < formats.size(); ++f) {
- QString mimeType = formats.at(f);
- for (QList<QMacPasteboardMime *>::Iterator it = availableConverters.begin(); it != availableConverters.end(); ++it) {
- QMacPasteboardMime *c = (*it);
- QString flavor(c->flavorFor(mimeType));
- if(!flavor.isEmpty()) {
- QVariant mimeData = static_cast<QMacMimeData*>(mime_src)->variantData(mimeType);
-#if 0
- //### Grrr, why didn't I put in a virtual int QMacPasteboardMime::count()? --Sam
- const int numItems = c->convertFromMime(mimeType, mimeData, flavor).size();
-#else
- int numItems = 1; //this is a hack but it is much faster than allowing conversion above
- if(c->convertorName() == QLatin1String("FileURL"))
- numItems = mime_src->urls().count();
-#endif
- for(int item = 0; item < numItems; ++item) {
- const int itemID = item+1; //id starts at 1
- promises.append(QMacPasteboard::Promise(itemID, c, mimeType, mimeData, item));
- PasteboardPutItemFlavor(paste, (PasteboardItemID)itemID, QCFString(flavor), 0, kPasteboardFlavorNoFlags);
-#ifdef DEBUG_PASTEBOARD
- qDebug(" - adding %d %s [%s] <%s> [%d]",
- itemID, qPrintable(mimeType), qPrintable(flavor), qPrintable(c->convertorName()), item);
-#endif
- }
- }
- }
- }
- }
-}
-
-QStringList
-QMacPasteboard::formats() const
-{
- if (!paste)
- return QStringList();
-
- sync();
-
- QStringList ret;
- ItemCount cnt = 0;
- if(PasteboardGetItemCount(paste, &cnt) || !cnt)
- return ret;
-
-#ifdef DEBUG_PASTEBOARD
- qDebug("PasteBoard: Formats [%d]", (int)cnt);
-#endif
- for(uint index = 1; index <= cnt; ++index) {
-
- PasteboardItemID id;
- if(PasteboardGetItemIdentifier(paste, index, &id) != noErr)
- continue;
-
- QCFType<CFArrayRef> types;
- if(PasteboardCopyItemFlavors(paste, id, &types ) != noErr)
- continue;
-
- const int type_count = CFArrayGetCount(types);
- for(int i = 0; i < type_count; ++i) {
- const QString flavor = QCFString::toQString((CFStringRef)CFArrayGetValueAtIndex(types, i));
-#ifdef DEBUG_PASTEBOARD
- qDebug(" -%s", qPrintable(QString(flavor)));
-#endif
- QString mimeType = QMacPasteboardMime::flavorToMime(mime_type, flavor);
- if(!mimeType.isEmpty() && !ret.contains(mimeType)) {
-#ifdef DEBUG_PASTEBOARD
- qDebug(" -<%d> %s [%s]", ret.size(), qPrintable(mimeType), qPrintable(QString(flavor)));
-#endif
- ret << mimeType;
- }
- }
- }
- return ret;
-}
-
-bool
-QMacPasteboard::hasFormat(const QString &format) const
-{
- if (!paste)
- return false;
-
- sync();
-
- ItemCount cnt = 0;
- if(PasteboardGetItemCount(paste, &cnt) || !cnt)
- return false;
-
-#ifdef DEBUG_PASTEBOARD
- qDebug("PasteBoard: hasFormat [%s]", qPrintable(format));
-#endif
- for(uint index = 1; index <= cnt; ++index) {
-
- PasteboardItemID id;
- if(PasteboardGetItemIdentifier(paste, index, &id) != noErr)
- continue;
-
- QCFType<CFArrayRef> types;
- if(PasteboardCopyItemFlavors(paste, id, &types ) != noErr)
- continue;
-
- const int type_count = CFArrayGetCount(types);
- for(int i = 0; i < type_count; ++i) {
- const QString flavor = QCFString::toQString((CFStringRef)CFArrayGetValueAtIndex(types, i));
-#ifdef DEBUG_PASTEBOARD
- qDebug(" -%s [0x%x]", qPrintable(QString(flavor)), mime_type);
-#endif
- QString mimeType = QMacPasteboardMime::flavorToMime(mime_type, flavor);
-#ifdef DEBUG_PASTEBOARD
- if(!mimeType.isEmpty())
- qDebug(" - %s", qPrintable(mimeType));
-#endif
- if(mimeType == format)
- return true;
- }
- }
- return false;
-}
-
-QVariant
-QMacPasteboard::retrieveData(const QString &format, QVariant::Type) const
-{
- if (!paste)
- return QVariant();
-
- sync();
-
- ItemCount cnt = 0;
- if(PasteboardGetItemCount(paste, &cnt) || !cnt)
- return QByteArray();
-
-#ifdef DEBUG_PASTEBOARD
- qDebug("Pasteboard: retrieveData [%s]", qPrintable(format));
-#endif
- const QList<QMacPasteboardMime *> mimes = QMacPasteboardMime::all(mime_type);
- for(int mime = 0; mime < mimes.size(); ++mime) {
- QMacPasteboardMime *c = mimes.at(mime);
- QString c_flavor = c->flavorFor(format);
- if(!c_flavor.isEmpty()) {
- // Handle text/plain a little differently. Try handling Unicode first.
- bool checkForUtf16 = (c_flavor == QLatin1String("com.apple.traditional-mac-plain-text")
- || c_flavor == QLatin1String("public.utf8-plain-text"));
- if (checkForUtf16 || c_flavor == QLatin1String("public.utf16-plain-text")) {
- // Try to get the NSStringPboardType from NSPasteboard, newlines are mapped
- // correctly (as '\n') in this data. The 'public.utf16-plain-text' type
- // usually maps newlines to '\r' instead.
- QString str = qt_mac_get_pasteboardString(paste);
- if (!str.isEmpty())
- return str;
- }
- if (checkForUtf16 && hasFlavor(QLatin1String("public.utf16-plain-text")))
- c_flavor = QLatin1String("public.utf16-plain-text");
-
- QVariant ret;
- QList<QByteArray> retList;
- for(uint index = 1; index <= cnt; ++index) {
- PasteboardItemID id;
- if(PasteboardGetItemIdentifier(paste, index, &id) != noErr)
- continue;
-
- QCFType<CFArrayRef> types;
- if(PasteboardCopyItemFlavors(paste, id, &types ) != noErr)
- continue;
-
- const int type_count = CFArrayGetCount(types);
- for(int i = 0; i < type_count; ++i) {
- CFStringRef flavor = static_cast<CFStringRef>(CFArrayGetValueAtIndex(types, i));
- if(c_flavor == QCFString::toQString(flavor)) {
- QCFType<CFDataRef> macBuffer;
- if(PasteboardCopyItemFlavorData(paste, id, flavor, &macBuffer) == noErr) {
- QByteArray buffer((const char *)CFDataGetBytePtr(macBuffer), CFDataGetLength(macBuffer));
- if(!buffer.isEmpty()) {
-#ifdef DEBUG_PASTEBOARD
- qDebug(" - %s [%s] (%s)", qPrintable(format), qPrintable(QCFString::toQString(flavor)), qPrintable(c->convertorName()));
-#endif
- buffer.detach(); //detach since we release the macBuffer
- retList.append(buffer);
- break; //skip to next element
- }
- }
- } else {
-#ifdef DEBUG_PASTEBOARD
- qDebug(" - NoMatch %s [%s] (%s)", qPrintable(c_flavor), qPrintable(QCFString::toQString(flavor)), qPrintable(c->convertorName()));
-#endif
- }
- }
- }
-
- if (!retList.isEmpty()) {
- ret = c->convertToMime(format, retList, c_flavor);
- return ret;
- }
- }
- }
- return QVariant();
-}
-
-void QMacPasteboard::clear_helper()
-{
- if (paste)
- PasteboardClear(paste);
- promises.clear();
-}
-
-void
-QMacPasteboard::clear()
-{
-#ifdef DEBUG_PASTEBOARD
- qDebug("PasteBoard: clear!");
-#endif
- clear_helper();
-}
-
-bool
-QMacPasteboard::sync() const
-{
- if (!paste)
- return false;
- const bool fromGlobal = PasteboardSynchronize(paste) & kPasteboardModified;
-
- if (fromGlobal)
- const_cast<QMacPasteboard *>(this)->setMimeData(0);
-
-#ifdef DEBUG_PASTEBOARD
- if(fromGlobal)
- qDebug("Pasteboard: Synchronize!");
-#endif
- return fromGlobal;
-}
-
-
-
-
-QT_END_NAMESPACE
diff --git a/src/widgets/platforms/mac/qcocoaintrospection_mac.mm b/src/widgets/platforms/mac/qcocoaintrospection_mac.mm
deleted file mode 100644
index e68aacb4a0..0000000000
--- a/src/widgets/platforms/mac/qcocoaintrospection_mac.mm
+++ /dev/null
@@ -1,119 +0,0 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
-
-/****************************************************************************
-**
-** Copyright (c) 2007-2008, Apple, Inc.
-**
-** All rights reserved.
-**
-** Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are met:
-**
-** * Redistributions of source code must retain the above copyright notice,
-** this list of conditions and the following disclaimer.
-**
-** * Redistributions in binary form must reproduce the above copyright notice,
-** this list of conditions and the following disclaimer in the documentation
-** and/or other materials provided with the distribution.
-**
-** * Neither the name of Apple, Inc. nor the names of its contributors
-** may be used to endorse or promote products derived from this software
-** without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-** CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-** EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-** PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-** PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-** LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-** NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-** SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-**
-****************************************************************************/
-
-#include <private/qcocoaintrospection_p.h>
-
-QT_BEGIN_NAMESPACE
-
-void qt_cocoa_change_implementation(Class baseClass, SEL originalSel, Class proxyClass, SEL replacementSel, SEL backupSel)
-{
- {
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
- // The following code replaces the _implementation_ for the selector we want to hack
- // (originalSel) with the implementation found in proxyClass. Then it creates
- // a new 'backup' method inside baseClass containing the old, original,
- // implementation (fakeSel). You can let the proxy implementation of originalSel
- // call fakeSel if needed (similar approach to calling a super class implementation).
- // fakeSel must also be implemented in proxyClass, as the signature is used
- // as template for the method one we add into baseClass.
- // NB: You will typically never create any instances of proxyClass; we use it
- // only for stealing its contents and put it into baseClass.
- if (!replacementSel)
- replacementSel = originalSel;
-
- Method originalMethod = class_getInstanceMethod(baseClass, originalSel);
- Method replacementMethod = class_getInstanceMethod(proxyClass, replacementSel);
- IMP originalImp = method_setImplementation(originalMethod, method_getImplementation(replacementMethod));
-
- if (backupSel) {
- Method backupMethod = class_getInstanceMethod(proxyClass, backupSel);
- class_addMethod(baseClass, backupSel, originalImp, method_getTypeEncoding(backupMethod));
- }
-#endif
- }
-}
-
-void qt_cocoa_change_back_implementation(Class baseClass, SEL originalSel, SEL backupSel)
-{
- {
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
- Method originalMethod = class_getInstanceMethod(baseClass, originalSel);
- Method backupMethodInBaseClass = class_getInstanceMethod(baseClass, backupSel);
- method_setImplementation(originalMethod, method_getImplementation(backupMethodInBaseClass));
-#endif
- }
-}
-
-QT_END_NAMESPACE
diff --git a/src/widgets/platforms/mac/qcocoaintrospection_p.h b/src/widgets/platforms/mac/qcocoaintrospection_p.h
deleted file mode 100644
index 9521957382..0000000000
--- a/src/widgets/platforms/mac/qcocoaintrospection_p.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
-
-/****************************************************************************
-**
-** Copyright (c) 2007-2008, Apple, Inc.
-**
-** All rights reserved.
-**
-** Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are met:
-**
-** * Redistributions of source code must retain the above copyright notice,
-** this list of conditions and the following disclaimer.
-**
-** * Redistributions in binary form must reproduce the above copyright notice,
-** this list of conditions and the following disclaimer in the documentation
-** and/or other materials provided with the distribution.
-**
-** * Neither the name of Apple, Inc. nor the names of its contributors
-** may be used to endorse or promote products derived from this software
-** without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-** CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-** EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-** PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-** PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-** LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-** NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-** SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-**
-****************************************************************************/
-
-#include <qglobal.h>
-#import <objc/objc-class.h>
-
-QT_BEGIN_NAMESPACE
-
-void qt_cocoa_change_implementation(Class baseClass, SEL originalSel, Class proxyClass, SEL replacementSel = 0, SEL backupSel = 0);
-void qt_cocoa_change_back_implementation(Class baseClass, SEL originalSel, SEL backupSel);
-
-QT_END_NAMESPACE
diff --git a/src/widgets/platforms/mac/qcocoapanel_mac.mm b/src/widgets/platforms/mac/qcocoapanel_mac.mm
deleted file mode 100644
index 115f78b153..0000000000
--- a/src/widgets/platforms/mac/qcocoapanel_mac.mm
+++ /dev/null
@@ -1,68 +0,0 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
-
-#import <private/qcocoapanel_mac_p.h>
-#import <private/qt_cocoa_helpers_mac_p.h>
-#import <private/qcocoawindow_mac_p.h>
-#import <private/qcocoawindowdelegate_mac_p.h>
-#import <private/qcocoaview_mac_p.h>
-#import <private/qcocoawindowcustomthemeframe_mac_p.h>
-#import <private/qcocoaapplication_mac_p.h>
-#import <private/qmultitouch_mac_p.h>
-#import <private/qapplication_p.h>
-#import <private/qbackingstore_p.h>
-#import <private/qdnd_p.h>
-
-#include <QtGui/QWidget>
-
-QT_FORWARD_DECLARE_CLASS(QWidget);
-QT_USE_NAMESPACE
-
-@implementation QT_MANGLE_NAMESPACE(QCocoaPanel)
-
-/***********************************************************************
- Copy and Paste between QCocoaWindow and QCocoaPanel
- This is a bit unfortunate, but thanks to the dynamic dispatch we
- have to duplicate this code or resort to really silly forwarding methods
-**************************************************************************/
-#include "qcocoasharedwindowmethods_mac_p.h"
-
-@end
diff --git a/src/widgets/platforms/mac/qcocoapanel_mac_p.h b/src/widgets/platforms/mac/qcocoapanel_mac_p.h
deleted file mode 100644
index 19eab92dbf..0000000000
--- a/src/widgets/platforms/mac/qcocoapanel_mac_p.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
-
-//
-// 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.
-//
-
-#ifndef QCOCOAPANEL_MAC_P
-#define QCOCOAPANEL_MAC_P
-
-#include "qmacdefines_mac.h"
-#import <Cocoa/Cocoa.h>
-
-QT_FORWARD_DECLARE_CLASS(QStringList);
-QT_FORWARD_DECLARE_CLASS(QCocoaDropData);
-
-@interface NSPanel (QtIntegration)
-- (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender;
-- (NSDragOperation)draggingUpdated:(id <NSDraggingInfo>)sender;
-- (void)draggingExited:(id <NSDraggingInfo>)sender;
-- (BOOL)performDragOperation:(id <NSDraggingInfo>)sender;
-@end
-
-@interface QT_MANGLE_NAMESPACE(QCocoaPanel) : NSPanel {
- QStringList *currentCustomDragTypes;
- QCocoaDropData *dropData;
- NSInteger dragEnterSequence;
-}
-
-+ (Class)frameViewClassForStyleMask:(NSUInteger)styleMask;
-- (void)registerDragTypes;
-- (void)drawRectOriginal:(NSRect)rect;
-
-@end
-
-#endif
diff --git a/src/widgets/platforms/mac/qcocoasharedwindowmethods_mac_p.h b/src/widgets/platforms/mac/qcocoasharedwindowmethods_mac_p.h
deleted file mode 100644
index edafcfccdf..0000000000
--- a/src/widgets/platforms/mac/qcocoasharedwindowmethods_mac_p.h
+++ /dev/null
@@ -1,610 +0,0 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
-
-/****************************************************************************
- NB: This is not a header file, dispite the file name suffix. This file is
- included directly into the source code of qcocoawindow_mac.mm and
- qcocoapanel_mac.mm to avoid manually doing copy and paste of the exact
- same code needed at both places. This solution makes it more difficult
- to e.g fix a bug in qcocoawindow_mac.mm, but forget to do the same in
- qcocoapanel_mac.mm.
- The reason we need to do copy and paste in the first place, rather than
- resolve to method overriding, is that QCocoaPanel needs to inherit from
- NSPanel, while QCocoaWindow needs to inherit NSWindow rather than NSPanel).
-****************************************************************************/
-
-// WARNING: Don't include any header files from within this file. Put them
-// directly into qcocoawindow_mac_p.h and qcocoapanel_mac_p.h
-
-QT_BEGIN_NAMESPACE
-extern Qt::MouseButton cocoaButton2QtButton(NSInteger buttonNum); // qcocoaview.mm
-extern QPointer<QWidget> qt_button_down; //qapplication_mac.cpp
-extern const QStringList& qEnabledDraggedTypes(); // qmime_mac.cpp
-extern void qt_event_request_window_change(QWidget *); // qapplication_mac.mm
-extern void qt_mac_send_posted_gl_updates(QWidget *widget); // qapplication_mac.mm
-
-Q_GLOBAL_STATIC(QPointer<QWidget>, currentDragTarget);
-QT_END_NAMESPACE
-
-- (id)initWithContentRect:(NSRect)contentRect
- styleMask:(NSUInteger)windowStyle
- backing:(NSBackingStoreType)bufferingType
- defer:(BOOL)deferCreation
-{
- self = [super initWithContentRect:contentRect styleMask:windowStyle
- backing:bufferingType defer:deferCreation];
- if (self) {
- currentCustomDragTypes = 0;
- }
- return self;
-}
-
-- (void)dealloc
-{
- delete currentCustomDragTypes;
- [super dealloc];
-}
-
-- (BOOL)canBecomeKeyWindow
-{
- QWidget *widget = [self QT_MANGLE_NAMESPACE(qt_qwidget)];
- if (!widget)
- return NO; // This should happen only for qt_root_win
- if (QApplicationPrivate::isBlockedByModal(widget))
- return NO;
-
- bool isToolTip = (widget->windowType() == Qt::ToolTip);
- bool isPopup = (widget->windowType() == Qt::Popup);
- return !(isPopup || isToolTip);
-}
-
-- (BOOL)canBecomeMainWindow
-{
- QWidget *widget = [self QT_MANGLE_NAMESPACE(qt_qwidget)];
- if (!widget)
- return NO; // This should happen only for qt_root_win
- if ([self isSheet])
- return NO;
-
- bool isToolTip = (widget->windowType() == Qt::ToolTip);
- bool isPopup = (widget->windowType() == Qt::Popup);
- bool isTool = (widget->windowType() == Qt::Tool);
- return !(isPopup || isToolTip || isTool);
-}
-
-- (void)becomeMainWindow
-{
- [super becomeMainWindow];
- // Cocoa sometimes tell a hidden window to become the
- // main window (and as such, show it). This can e.g
- // happend when the application gets activated. If
- // this is the case, we tell it to hide again:
- if (![self isVisible])
- [self orderOut:self];
-}
-
-- (void)toggleToolbarShown:(id)sender
-{
- macSendToolbarChangeEvent([self QT_MANGLE_NAMESPACE(qt_qwidget)]);
- [super toggleToolbarShown:sender];
-}
-
-- (void)flagsChanged:(NSEvent *)theEvent
-{
- qt_dispatchModifiersChanged(theEvent, [self QT_MANGLE_NAMESPACE(qt_qwidget)]);
- [super flagsChanged:theEvent];
-}
-
-
-- (void)tabletProximity:(NSEvent *)tabletEvent
-{
- qt_dispatchTabletProximityEvent(tabletEvent);
-}
-
-- (void)terminate:(id)sender
-{
- // This function is called from the quit item in the menubar when this window
- // is in the first responder chain (see also qtDispatcherToQAction above)
- [NSApp terminate:sender];
-}
-
-- (void)setLevel:(NSInteger)windowLevel
-{
- // Cocoa will upon activating/deactivating applications level modal
- // windows up and down, regardsless of any explicit set window level.
- // To ensure that modal stays-on-top dialogs actually stays on top after
- // the application is activated (and therefore stacks in front of
- // other stays-on-top windows), we need to add this little special-case override:
- QWidget *widget = [[QT_MANGLE_NAMESPACE(QCocoaWindowDelegate) sharedDelegate] qt_qwidgetForWindow:self];
- if (widget && widget->isModal() && (widget->windowFlags() & Qt::WindowStaysOnTopHint))
- [super setLevel:NSPopUpMenuWindowLevel];
- else
- [super setLevel:windowLevel];
-}
-
-- (void)sendEvent:(NSEvent *)event
-{
- [self retain];
-
- bool handled = false;
- switch([event type]) {
- case NSMouseMoved:
- // Cocoa sends move events to a parent and all its children under the mouse, much
- // like Qt handles hover events. But we only want to handle the move event once, so
- // to optimize a bit (since we subscribe for move event for all views), we handle it
- // here before this logic happends. Note: it might be tempting to do this shortcut for
- // all mouse events. The problem is that Cocoa does more than just find the correct view
- // when sending the event, like raising windows etc. So avoid it as much as possible:
- handled = qt_mac_handleMouseEvent(event, QEvent::MouseMove, Qt::NoButton, 0);
- break;
- default:
- break;
- }
-
- if (!handled) {
- [super sendEvent:event];
- qt_mac_handleNonClientAreaMouseEvent(self, event);
- }
- [self release];
-}
-
-- (void)setInitialFirstResponder:(NSView *)view
-{
- // This method is called the first time the window is placed on screen and
- // is the earliest point in time we can connect OpenGL contexts to NSViews.
- QWidget *qwidget = [[QT_MANGLE_NAMESPACE(QCocoaWindowDelegate) sharedDelegate] qt_qwidgetForWindow:self];
- if (qwidget) {
- qt_event_request_window_change(qwidget);
- qt_mac_send_posted_gl_updates(qwidget);
- }
-
- [super setInitialFirstResponder:view];
-}
-
-- (BOOL)makeFirstResponder:(NSResponder *)responder
-{
- // For some reason Cocoa wants to flip the first responder
- // when Qt doesn't want to, sorry, but "No" :-)
- if (responder == nil && qApp->focusWidget())
- return NO;
- return [super makeFirstResponder:responder];
-}
-
-+ (Class)frameViewClassForStyleMask:(NSUInteger)styleMask
-{
- if (styleMask & QtMacCustomizeWindow)
- return [QT_MANGLE_NAMESPACE(QCocoaWindowCustomThemeFrame) class];
- return [super frameViewClassForStyleMask:styleMask];
-}
-
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
-- (void)touchesBeganWithEvent:(NSEvent *)event;
-{
- QPoint qlocal, qglobal;
- QWidget *widgetToGetTouch = 0;
- qt_mac_getTargetForMouseEvent(event, QEvent::Gesture, qlocal, qglobal, 0, &widgetToGetTouch);
- if (!widgetToGetTouch)
- return;
-
- bool all = widgetToGetTouch->testAttribute(Qt::WA_TouchPadAcceptSingleTouchEvents);
- qt_translateRawTouchEvent(widgetToGetTouch, QTouchEvent::TouchPad, QCocoaTouch::getCurrentTouchPointList(event, all));
-}
-
-- (void)touchesMovedWithEvent:(NSEvent *)event;
-{
- QPoint qlocal, qglobal;
- QWidget *widgetToGetTouch = 0;
- qt_mac_getTargetForMouseEvent(event, QEvent::Gesture, qlocal, qglobal, 0, &widgetToGetTouch);
- if (!widgetToGetTouch)
- return;
-
- bool all = widgetToGetTouch->testAttribute(Qt::WA_TouchPadAcceptSingleTouchEvents);
- qt_translateRawTouchEvent(widgetToGetTouch, QTouchEvent::TouchPad, QCocoaTouch::getCurrentTouchPointList(event, all));
-}
-
-- (void)touchesEndedWithEvent:(NSEvent *)event;
-{
- QPoint qlocal, qglobal;
- QWidget *widgetToGetTouch = 0;
- qt_mac_getTargetForMouseEvent(event, QEvent::Gesture, qlocal, qglobal, 0, &widgetToGetTouch);
- if (!widgetToGetTouch)
- return;
-
- bool all = widgetToGetTouch->testAttribute(Qt::WA_TouchPadAcceptSingleTouchEvents);
- qt_translateRawTouchEvent(widgetToGetTouch, QTouchEvent::TouchPad, QCocoaTouch::getCurrentTouchPointList(event, all));
-}
-
-- (void)touchesCancelledWithEvent:(NSEvent *)event;
-{
- QPoint qlocal, qglobal;
- QWidget *widgetToGetTouch = 0;
- qt_mac_getTargetForMouseEvent(event, QEvent::Gesture, qlocal, qglobal, 0, &widgetToGetTouch);
- if (!widgetToGetTouch)
- return;
-
- bool all = widgetToGetTouch->testAttribute(Qt::WA_TouchPadAcceptSingleTouchEvents);
- qt_translateRawTouchEvent(widgetToGetTouch, QTouchEvent::TouchPad, QCocoaTouch::getCurrentTouchPointList(event, all));
-}
-#endif // MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
-
--(void)registerDragTypes
-{
- // Calling registerForDraggedTypes below is slow, so only do
- // it once for each window, or when the custom types change.
- QMacCocoaAutoReleasePool pool;
- const QStringList& customTypes = qEnabledDraggedTypes();
- if (currentCustomDragTypes == 0 || *currentCustomDragTypes != customTypes) {
- if (currentCustomDragTypes == 0)
- currentCustomDragTypes = new QStringList();
- *currentCustomDragTypes = customTypes;
- const NSString* mimeTypeGeneric = @"com.trolltech.qt.MimeTypeName";
- NSMutableArray *supportedTypes = [NSMutableArray arrayWithObjects:NSColorPboardType,
- NSFilenamesPboardType, NSStringPboardType,
- NSFilenamesPboardType, NSPostScriptPboardType, NSTIFFPboardType,
- NSRTFPboardType, NSTabularTextPboardType, NSFontPboardType,
- NSRulerPboardType, NSFileContentsPboardType, NSColorPboardType,
- NSRTFDPboardType, NSHTMLPboardType, NSPICTPboardType,
- NSURLPboardType, NSPDFPboardType, NSVCardPboardType,
- NSFilesPromisePboardType, NSInkTextPboardType,
- NSMultipleTextSelectionPboardType, mimeTypeGeneric, nil];
- // Add custom types supported by the application.
- for (int i = 0; i < customTypes.size(); i++) {
- [supportedTypes addObject:qt_mac_QStringToNSString(customTypes[i])];
- }
- [self registerForDraggedTypes:supportedTypes];
- }
-}
-
-- (void)removeDropData
-{
- if (dropData) {
- delete dropData;
- dropData = 0;
- }
-}
-
-- (void)addDropData:(id <NSDraggingInfo>)sender
-{
- [self removeDropData];
- CFStringRef dropPasteboard = (CFStringRef) [[sender draggingPasteboard] name];
- dropData = new QCocoaDropData(dropPasteboard);
-}
-
-- (void)changeDraggingCursor:(NSDragOperation)newOperation
-{
- static SEL action = nil;
- static bool operationSupported = false;
- if (action == nil) {
- action = NSSelectorFromString(@"operationNotAllowedCursor");
- if ([NSCursor respondsToSelector:action]) {
- operationSupported = true;
- }
- }
- if (operationSupported) {
- NSCursor *notAllowedCursor = [NSCursor performSelector:action];
- bool isNotAllowedCursor = ([NSCursor currentCursor] == notAllowedCursor);
- if (newOperation == NSDragOperationNone && !isNotAllowedCursor) {
- [notAllowedCursor push];
- } else if (newOperation != NSDragOperationNone && isNotAllowedCursor) {
- [notAllowedCursor pop];
- }
-
- }
-}
-
-- (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender
-{
- // The user dragged something into the window. Send a draggingEntered message
- // to the QWidget under the mouse. As the drag moves over the window, and over
- // different widgets, we will handle enter and leave events from within
- // draggingUpdated below. The reason why we handle this ourselves rather than
- // subscribing for drag events directly in QCocoaView is that calling
- // registerForDraggedTypes on the views will severly degrade initialization time
- // for an application that uses a lot of drag subscribing widgets.
-
- NSPoint nswindowPoint = [sender draggingLocation];
- NSPoint nsglobalPoint = [[sender draggingDestinationWindow] convertBaseToScreen:nswindowPoint];
- QPoint globalPoint = flipPoint(nsglobalPoint).toPoint();
-
- QWidget *qwidget = QApplication::widgetAt(globalPoint);
- *currentDragTarget() = qwidget;
- if (!qwidget)
- return [super draggingEntered:sender];
- if (qwidget->testAttribute(Qt::WA_DropSiteRegistered) == false)
- return NSDragOperationNone;
-
- [self addDropData:sender];
-
- QMimeData *mimeData = dropData;
- if (QDragManager::self()->source())
- mimeData = QDragManager::self()->dragPrivate()->data;
-
- NSDragOperation nsActions = [sender draggingSourceOperationMask];
- Qt::DropActions qtAllowed = qt_mac_mapNSDragOperations(nsActions);
- QT_PREPEND_NAMESPACE(qt_mac_dnd_answer_rec.lastOperation) = nsActions;
- Qt::KeyboardModifiers modifiers = Qt::NoModifier;
-
- if ([sender draggingSource] != nil) {
- // modifier flags might have changed, update it here since we don't send any input events.
- QApplicationPrivate::modifier_buttons = qt_cocoaModifiers2QtModifiers([[NSApp currentEvent] modifierFlags]);
- modifiers = QApplication::keyboardModifiers();
- } else {
- // when the source is from another application the above technique will not work.
- modifiers = qt_cocoaDragOperation2QtModifiers(nsActions);
- }
-
- // send the drag enter event to the widget.
- QPoint localPoint(qwidget->mapFromGlobal(globalPoint));
- QDragEnterEvent qDEEvent(localPoint, qtAllowed, mimeData, QApplication::mouseButtons(), modifiers);
- QApplication::sendEvent(qwidget, &qDEEvent);
-
- if (!qDEEvent.isAccepted()) {
- // The enter event was not accepted. We mark this by removing
- // the drop data so we don't send subsequent drag move events:
- [self removeDropData];
- [self changeDraggingCursor:NSDragOperationNone];
- return NSDragOperationNone;
- } else {
- // Send a drag move event immediately after a drag enter event (as per documentation).
- QDragMoveEvent qDMEvent(localPoint, qtAllowed, mimeData, QApplication::mouseButtons(), modifiers);
- qDMEvent.setDropAction(qDEEvent.dropAction());
- qDMEvent.accept(); // accept by default, since enter event was accepted.
- QApplication::sendEvent(qwidget, &qDMEvent);
-
- if (!qDMEvent.isAccepted() || qDMEvent.dropAction() == Qt::IgnoreAction) {
- // Since we accepted the drag enter event, the widget expects
- // future drage move events.
- nsActions = NSDragOperationNone;
- // Save as ignored in the answer rect.
- qDMEvent.setDropAction(Qt::IgnoreAction);
- } else {
- nsActions = QT_PREPEND_NAMESPACE(qt_mac_mapDropAction)(qDMEvent.dropAction());
- }
-
- QT_PREPEND_NAMESPACE(qt_mac_copy_answer_rect)(qDMEvent);
- [self changeDraggingCursor:nsActions];
- return nsActions;
- }
- }
-
-- (NSDragOperation)draggingUpdated:(id <NSDraggingInfo>)sender
-{
- NSPoint nswindowPoint = [sender draggingLocation];
- NSPoint nsglobalPoint = [[sender draggingDestinationWindow] convertBaseToScreen:nswindowPoint];
- QPoint globalPoint = flipPoint(nsglobalPoint).toPoint();
-
- QWidget *qwidget = QApplication::widgetAt(globalPoint);
- if (!qwidget)
- return [super draggingEntered:sender];
-
- // First, check if the widget under the mouse has changed since the
- // last drag move events. If so, we need to change target, and dispatch
- // syntetic drag enter/leave events:
- if (qwidget != *currentDragTarget()) {
- if (*currentDragTarget() && dropData) {
- QDragLeaveEvent de;
- QApplication::sendEvent(*currentDragTarget(), &de);
- [self removeDropData];
- }
- return [self draggingEntered:sender];
- }
-
- if (qwidget->testAttribute(Qt::WA_DropSiteRegistered) == false)
- return NSDragOperationNone;
-
- // If we have no drop data (which will be assigned inside draggingEntered), it means
- // that the current drag target did not accept the enter event. If so, we ignore
- // subsequent move events as well:
- if (dropData == 0) {
- [self changeDraggingCursor:NSDragOperationNone];
- return NSDragOperationNone;
- }
-
- // If the mouse is still within the accepted rect (provided by
- // the application on a previous event), we follow the optimization
- // and just return the answer given at that point:
- NSDragOperation nsActions = [sender draggingSourceOperationMask];
- QPoint localPoint(qwidget->mapFromGlobal(globalPoint));
- if (qt_mac_mouse_inside_answer_rect(localPoint)
- && QT_PREPEND_NAMESPACE(qt_mac_dnd_answer_rec.lastOperation) == nsActions) {
- NSDragOperation operation = QT_PREPEND_NAMESPACE(qt_mac_mapDropActions)(QT_PREPEND_NAMESPACE(qt_mac_dnd_answer_rec.lastAction));
- [self changeDraggingCursor:operation];
- return operation;
- }
-
- QT_PREPEND_NAMESPACE(qt_mac_dnd_answer_rec.lastOperation) = nsActions;
- Qt::DropActions qtAllowed = QT_PREPEND_NAMESPACE(qt_mac_mapNSDragOperations)(nsActions);
- Qt::KeyboardModifiers modifiers = Qt::NoModifier;
-
- // Update modifiers:
- if ([sender draggingSource] != nil) {
- QApplicationPrivate::modifier_buttons = qt_cocoaModifiers2QtModifiers([[NSApp currentEvent] modifierFlags]);
- modifiers = QApplication::keyboardModifiers();
- } else {
- modifiers = qt_cocoaDragOperation2QtModifiers(nsActions);
- }
-
- QMimeData *mimeData = dropData;
- if (QDragManager::self()->source())
- mimeData = QDragManager::self()->dragPrivate()->data;
-
- // Insert the same drop action on the event according to
- // what the application told us it should be on the previous event:
- QDragMoveEvent qDMEvent(localPoint, qtAllowed, mimeData, QApplication::mouseButtons(), modifiers);
- if (QT_PREPEND_NAMESPACE(qt_mac_dnd_answer_rec).lastAction != Qt::IgnoreAction
- && QT_PREPEND_NAMESPACE(qt_mac_dnd_answer_rec).buttons == qDMEvent.mouseButtons()
- && QT_PREPEND_NAMESPACE(qt_mac_dnd_answer_rec).modifiers == qDMEvent.keyboardModifiers())
- qDMEvent.setDropAction(QT_PREPEND_NAMESPACE(qt_mac_dnd_answer_rec).lastAction);
-
- // Now, end the drag move event to the widget:
- qDMEvent.accept();
- QApplication::sendEvent(qwidget, &qDMEvent);
-
- NSDragOperation operation = qt_mac_mapDropAction(qDMEvent.dropAction());
- if (!qDMEvent.isAccepted() || qDMEvent.dropAction() == Qt::IgnoreAction) {
- // Ignore this event (we will still receive further
- // notifications), save as ignored in the answer rect:
- operation = NSDragOperationNone;
- qDMEvent.setDropAction(Qt::IgnoreAction);
- }
-
- qt_mac_copy_answer_rect(qDMEvent);
- [self changeDraggingCursor:operation];
-
- return operation;
-}
-
-- (void)draggingExited:(id <NSDraggingInfo>)sender
-{
- NSPoint nswindowPoint = [sender draggingLocation];
- NSPoint nsglobalPoint = [[sender draggingDestinationWindow] convertBaseToScreen:nswindowPoint];
- QPoint globalPoint = flipPoint(nsglobalPoint).toPoint();
-
- QWidget *qwidget = *currentDragTarget();
- if (!qwidget)
- return [super draggingExited:sender];
-
- if (dropData) {
- QDragLeaveEvent de;
- QApplication::sendEvent(qwidget, &de);
- [self removeDropData];
- }
-
- // Clean-up:
- [self removeDropData];
- *currentDragTarget() = 0;
- [self changeDraggingCursor:NSDragOperationEvery];
-}
-
-- (BOOL)performDragOperation:(id <NSDraggingInfo>)sender
-{
- QWidget *qwidget = *currentDragTarget();
- if (!qwidget)
- return NO;
-
- *currentDragTarget() = 0;
- NSPoint nswindowPoint = [sender draggingLocation];
- NSPoint nsglobalPoint = [[sender draggingDestinationWindow] convertBaseToScreen:nswindowPoint];
- QPoint globalPoint = flipPoint(nsglobalPoint).toPoint();
-
- [self addDropData:sender];
-
- NSDragOperation nsActions = [sender draggingSourceOperationMask];
- Qt::DropActions qtAllowed = qt_mac_mapNSDragOperations(nsActions);
- QMimeData *mimeData = dropData;
-
- if (QDragManager::self()->source())
- mimeData = QDragManager::self()->dragPrivate()->data;
- if (QDragManager::self()->object)
- QDragManager::self()->dragPrivate()->target = qwidget;
-
- QPoint localPoint(qwidget->mapFromGlobal(globalPoint));
- QDropEvent de(localPoint, qtAllowed, mimeData,
- QApplication::mouseButtons(), QApplication::keyboardModifiers());
- QApplication::sendEvent(qwidget, &de);
-
- if (QDragManager::self()->object)
- QDragManager::self()->dragPrivate()->executed_action = de.dropAction();
-
- return de.isAccepted();
-}
-
-// This is a hack and it should be removed once we find the real cause for
-// the painting problems.
-// We have a static variable that signals if we have been called before or not.
-static bool firstDrawingInvocation = true;
-
-// The method below exists only as a workaround to draw/not draw the baseline
-// in the title bar. This is to support unifiedToolbar look.
-
-// This method is very special. To begin with, it is a
-// method that will get called only if we enable documentMode.
-// Furthermore, it won't get called as a normal method, we swap
-// this method with the normal implementation of drawRect in
-// _NSThemeFrame. When this method is active, its mission is to
-// first call the original drawRect implementation so the widget
-// gets proper painting. After that, it needs to detect if there
-// is a toolbar or not, in order to decide how to handle the unified
-// look. The distinction is important since the presence and
-// visibility of a toolbar change the way we enter into unified mode.
-// When there is a toolbar and that toolbar is visible, the problem
-// is as simple as to tell the toolbar not to draw its baseline.
-// However when there is not toolbar or the toolbar is not visible,
-// we need to draw a line on top of the baseline, because the baseline
-// in that case will belong to the title. For this case we need to draw
-// a line on top of the baseline.
-// As usual, there is a special case. When we first are called, we might
-// need to repaint ourselves one more time. We only need that if we
-// didn't get the activation, i.e. when we are launched via the command
-// line. And this only if the toolbar is visible from the beginning,
-// so we have a special flag that signals if we need to repaint or not.
-- (void)drawRectSpecial:(NSRect)rect
-{
- // Call the original drawing method.
- [id(self) drawRectOriginal:rect];
- NSWindow *window = [id(self) window];
- NSToolbar *toolbar = [window toolbar];
- if(!toolbar) {
- // There is no toolbar, we have to draw a line on top of the line drawn by Cocoa.
- macDrawRectOnTop((void *)window);
- } else {
- if([toolbar isVisible]) {
- // We tell Cocoa to avoid drawing the line at the end.
- if(firstDrawingInvocation) {
- firstDrawingInvocation = false;
- macSyncDrawingOnFirstInvocation((void *)window);
- } else
- [toolbar setShowsBaselineSeparator:NO];
- } else {
- // There is a toolbar but it is not visible so
- // we have to draw a line on top of the line drawn by Cocoa.
- macDrawRectOnTop((void *)window);
- }
- }
-}
-
-- (void)drawRectOriginal:(NSRect)rect
-{
- Q_UNUSED(rect)
- // This method implementation is here to silenct the compiler.
- // See drawRectSpecial for information.
-}
-
diff --git a/src/widgets/platforms/mac/qcocoaview_mac.mm b/src/widgets/platforms/mac/qcocoaview_mac.mm
deleted file mode 100644
index f4b2b8d707..0000000000
--- a/src/widgets/platforms/mac/qcocoaview_mac.mm
+++ /dev/null
@@ -1,1386 +0,0 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
-
-#import <private/qcocoaview_mac_p.h>
-
-#include <private/qwidget_p.h>
-#include <private/qt_mac_p.h>
-#include <private/qapplication_p.h>
-#include <private/qabstractscrollarea_p.h>
-#include <private/qt_cocoa_helpers_mac_p.h>
-#include <private/qdnd_p.h>
-#include <private/qmacinputcontext_p.h>
-#include <private/qevent_p.h>
-#include <private/qbackingstore_p.h>
-#include <private/qwindowsurface_raster_p.h>
-#include <private/qunifiedtoolbarsurface_mac_p.h>
-
-#include <qscrollarea.h>
-#include <qhash.h>
-#include <qtextformat.h>
-#include <qpaintengine.h>
-#include <QUrl>
-#include <QAccessible>
-#include <QFileInfo>
-#include <QFile>
-
-#include <qdebug.h>
-
-@interface NSEvent (Qt_Compile_Leopard_DeviceDelta)
- - (CGFloat)deviceDeltaX;
- - (CGFloat)deviceDeltaY;
- - (CGFloat)deviceDeltaZ;
-@end
-
-@interface NSEvent (Qt_Compile_Leopard_Gestures)
- - (CGFloat)magnification;
-@end
-
-QT_BEGIN_NAMESPACE
-
-extern void qt_mac_update_cursor(); // qcursor_mac.mm
-extern bool qt_sendSpontaneousEvent(QObject *, QEvent *); // qapplication.cpp
-extern QPointer<QWidget> qt_last_mouse_receiver; // qapplication_mac.cpp
-extern QPointer<QWidget> qt_last_native_mouse_receiver; // qt_cocoa_helpers_mac.mm
-extern OSViewRef qt_mac_nativeview_for(const QWidget *w); // qwidget_mac.mm
-extern OSViewRef qt_mac_effectiveview_for(const QWidget *w); // qwidget_mac.mm
-extern QPointer<QWidget> qt_button_down; //qapplication_mac.cpp
-extern Qt::MouseButton cocoaButton2QtButton(NSInteger buttonNum);
-extern QWidget *mac_mouse_grabber;
-extern bool qt_mac_clearDirtyOnWidgetInsideDrawWidget; // qwidget.cpp
-
-static QColor colorFrom(NSColor *color)
-{
- QColor qtColor;
- NSString *colorSpace = [color colorSpaceName];
- if (colorSpace == NSDeviceCMYKColorSpace) {
- CGFloat cyan, magenta, yellow, black, alpha;
- [color getCyan:&cyan magenta:&magenta yellow:&yellow black:&black alpha:&alpha];
- qtColor.setCmykF(cyan, magenta, yellow, black, alpha);
- } else {
- NSColor *tmpColor;
- tmpColor = [color colorUsingColorSpaceName:NSDeviceRGBColorSpace];
- CGFloat red, green, blue, alpha;
- [tmpColor getRed:&red green:&green blue:&blue alpha:&alpha];
- qtColor.setRgbF(red, green, blue, alpha);
- }
- return qtColor;
-}
-
-QT_END_NAMESPACE
-
-QT_FORWARD_DECLARE_CLASS(QMacCocoaAutoReleasePool)
-QT_FORWARD_DECLARE_CLASS(QCFString)
-QT_FORWARD_DECLARE_CLASS(QDragManager)
-QT_FORWARD_DECLARE_CLASS(QMimeData)
-QT_FORWARD_DECLARE_CLASS(QPoint)
-QT_FORWARD_DECLARE_CLASS(QApplication)
-QT_FORWARD_DECLARE_CLASS(QApplicationPrivate)
-QT_FORWARD_DECLARE_CLASS(QDragEnterEvent)
-QT_FORWARD_DECLARE_CLASS(QDragMoveEvent)
-QT_FORWARD_DECLARE_CLASS(QStringList)
-QT_FORWARD_DECLARE_CLASS(QString)
-QT_FORWARD_DECLARE_CLASS(QRect)
-QT_FORWARD_DECLARE_CLASS(QRegion)
-QT_FORWARD_DECLARE_CLASS(QAbstractScrollArea)
-QT_FORWARD_DECLARE_CLASS(QAbstractScrollAreaPrivate)
-QT_FORWARD_DECLARE_CLASS(QPaintEvent)
-QT_FORWARD_DECLARE_CLASS(QPainter)
-QT_FORWARD_DECLARE_CLASS(QHoverEvent)
-QT_FORWARD_DECLARE_CLASS(QCursor)
-QT_USE_NAMESPACE
-extern "C" {
- extern NSString *NSTextInputReplacementRangeAttributeName;
-}
-
-//#define ALIEN_DEBUG 1
-#ifdef ALIEN_DEBUG
-static int qCocoaViewCount = 0;
-#endif
-
-@implementation QT_MANGLE_NAMESPACE(QCocoaView)
-
-- (id)initWithQWidget:(QWidget *)widget widgetPrivate:(QWidgetPrivate *)widgetprivate
-{
- self = [super init];
- if (self) {
- [self finishInitWithQWidget:widget widgetPrivate:widgetprivate];
- }
- [self setFocusRingType:NSFocusRingTypeNone];
- composingText = new QString();
-
-#ifdef ALIEN_DEBUG
- ++qCocoaViewCount;
- qDebug() << "Alien: create native view for" << widget << ". qCocoaViewCount is:" << qCocoaViewCount;
-#endif
-
- composing = false;
- sendKeyEvents = true;
- fromKeyDownEvent = false;
- alienTouchCount = 0;
-
- [self setHidden:YES];
- return self;
-}
-
-- (void) finishInitWithQWidget:(QWidget *)widget widgetPrivate:(QWidgetPrivate *)widgetprivate
-{
- qwidget = widget;
- qwidgetprivate = widgetprivate;
- [[NSNotificationCenter defaultCenter] addObserver:self
- selector:@selector(frameDidChange:)
- name:@"NSViewFrameDidChangeNotification"
- object:self];
-}
-
-- (void)dealloc
-{
- QMacCocoaAutoReleasePool pool;
- delete composingText;
- [[NSNotificationCenter defaultCenter] removeObserver:self];
-
-#ifdef ALIEN_DEBUG
- --qCocoaViewCount;
- qDebug() << "Alien: widget deallocated. qCocoaViewCount is:" << qCocoaViewCount;
-#endif
-
- [super dealloc];
-}
-
-- (BOOL)isOpaque
-{
- if (!qwidgetprivate)
- return [super isOpaque];
- return qwidgetprivate->isOpaque;
-}
-
-- (BOOL)isFlipped
-{
- return YES;
-}
-
-// We preserve the content of the view if WA_StaticContents is defined.
-//
-// More info in the Cocoa documentation:
-// http://developer.apple.com/mac/library/documentation/cocoa/conceptual/CocoaViewsGuide/Optimizing/Optimizing.html
-- (BOOL) preservesContentDuringLiveResize
-{
- return qwidget->testAttribute(Qt::WA_StaticContents);
-}
-
-- (void) setFrameSize:(NSSize)newSize
-{
- [super setFrameSize:newSize];
-
- // A change in size has required the view to be invalidated.
- if ([self inLiveResize]) {
- NSRect rects[4];
- NSInteger count;
- [self getRectsExposedDuringLiveResize:rects count:&count];
- while (count-- > 0)
- {
- [self setNeedsDisplayInRect:rects[count]];
- }
- } else {
- [self setNeedsDisplay:YES];
- }
-
- // Make sure the opengl context is updated on resize.
- if (qwidgetprivate && qwidgetprivate->isGLWidget && [self window]) {
- qwidgetprivate->needWindowChange = true;
- QEvent event(QEvent::MacGLWindowChange);
- qApp->sendEvent(qwidget, &event);
- }
-}
-
-// We catch the 'setNeedsDisplay:' message in order to avoid a useless full repaint.
-// During the resize, the top of the widget is repainted, probably because of the
-// change of coordinate space (Quartz vs Qt). This is then followed by this message:
-// -[NSView _setNeedsDisplayIfTopLeftChanged]
-// which force a full repaint by sending the message 'setNeedsDisplay:'.
-// That is what we are preventing here.
-- (void)setNeedsDisplay:(BOOL)flag {
- if (![self inLiveResize] || !(qwidget->testAttribute(Qt::WA_StaticContents))) {
- [super setNeedsDisplay:flag];
- }
-}
-
-- (void)drawRect:(NSRect)aRect
-{
- if (!qwidget)
- return;
-
- // Getting context.
- CGContextRef context = (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort];
- qt_mac_retain_graphics_context(context);
-
- // We use a different graphics system.
- //
- // Widgets that are set to paint on screen, specifically QGLWidget,
- // requires the native engine to execute in order to be drawn.
- if (QApplicationPrivate::graphicsSystem() != 0 && !qwidget->testAttribute(Qt::WA_PaintOnScreen)) {
-
- // Raster engine.
- if (QApplicationPrivate::graphics_system_name == QLatin1String("raster")) {
-
- if (!qwidgetprivate->isInUnifiedToolbar) {
-
- // Qt handles the painting occuring inside the window.
- // Cocoa also keeps track of all widgets as NSView and therefore might
- // ask for a repainting of a widget even if Qt is already taking care of it.
- //
- // The only valid reason for Cocoa to call drawRect: is for window manipulation
- // (ie. resize, ...).
- //
- // Qt will then forward the update to the children.
- if (!qwidget->isWindow()) {
- qt_mac_release_graphics_context(context);
- return;
- }
-
- QRasterWindowSurface *winSurface = dynamic_cast<QRasterWindowSurface *>(qwidget->windowSurface());
- if (!winSurface || !winSurface->needsFlush) {
- qt_mac_release_graphics_context(context);
- return;
- }
-
- // Clip to region.
- const QVector<QRect> &rects = winSurface->regionToFlush.rects();
- for (int i = 0; i < rects.size(); ++i) {
- const QRect &rect = rects.at(i);
- CGContextAddRect(context, CGRectMake(rect.x(), rect.y(), rect.width(), rect.height()));
- }
- CGContextClip(context);
-
- QRect r = winSurface->regionToFlush.boundingRect();
- const CGRect area = CGRectMake(r.x(), r.y(), r.width(), r.height());
-
- qt_mac_draw_image(context, winSurface->imageContext(), area, area);
-
- winSurface->needsFlush = false;
- winSurface->regionToFlush = QRegion();
-
- } else {
-
- QUnifiedToolbarSurface *unifiedSurface = qwidgetprivate->unifiedSurface;
- if (!unifiedSurface) {
- qt_mac_release_graphics_context(context);
- return;
- }
-
- int areaX = qwidgetprivate->toolbar_offset.x();
- int areaY = qwidgetprivate->toolbar_offset.y();
- int areaWidth = qwidget->geometry().width();
- int areaHeight = qwidget->geometry().height();
- const CGRect area = CGRectMake(areaX, areaY, areaWidth, areaHeight);
- const CGRect drawingArea = CGRectMake(0, 0, areaWidth, areaHeight);
-
- qt_mac_draw_image(context, unifiedSurface->imageContext(), area, drawingArea);
-
- qwidgetprivate->flushRequested = false;
-
- }
-
- CGContextFlush(context);
- qt_mac_release_graphics_context(context);
- return;
- }
-
- // Qt handles the painting occuring inside the window.
- // Cocoa also keeps track of all widgets as NSView and therefore might
- // ask for a repainting of a widget even if Qt is already taking care of it.
- //
- // The only valid reason for Cocoa to call drawRect: is for window manipulation
- // (ie. resize, ...).
- //
- // Qt will then forward the update to the children.
- if (qwidget->isWindow()) {
- qwidgetprivate->syncBackingStore(qwidget->rect());
- }
- }
-
- // Native engine.
- qwidgetprivate->hd = context;
-
- if (qwidget->isVisible() && qwidget->updatesEnabled()) { //process the actual paint event.
- if (qwidget->testAttribute(Qt::WA_WState_InPaintEvent))
- qWarning("QWidget::repaint: Recursive repaint detected");
-
- const QRect qrect = QRect(aRect.origin.x, aRect.origin.y, aRect.size.width, aRect.size.height);
- QRegion qrgn;
-
- const NSRect *rects;
- NSInteger count;
- [self getRectsBeingDrawn:&rects count:&count];
- for (int i = 0; i < count; ++i) {
- QRect tmpRect = QRect(rects[i].origin.x, rects[i].origin.y, rects[i].size.width, rects[i].size.height);
- qrgn += tmpRect;
- }
-
- if (!qwidget->isWindow() && !qobject_cast<QAbstractScrollArea *>(qwidget->parent())) {
- const QRegion &parentMask = qwidget->window()->mask();
- if (!parentMask.isEmpty()) {
- const QPoint mappedPoint = qwidget->mapTo(qwidget->window(), qrect.topLeft());
- qrgn.translate(mappedPoint);
- qrgn &= parentMask;
- qrgn.translate(-mappedPoint.x(), -mappedPoint.y());
- }
- }
-
- QPoint redirectionOffset(0, 0);
- //setup the context
- qwidget->setAttribute(Qt::WA_WState_InPaintEvent);
- QPaintEngine *engine = qwidget->paintEngine();
- if (engine)
- engine->setSystemClip(qrgn);
- if (qwidgetprivate->extra && qwidgetprivate->extra->hasMask) {
- CGRect widgetRect = CGRectMake(0, 0, qwidget->width(), qwidget->height());
- CGContextTranslateCTM (context, 0, widgetRect.size.height);
- CGContextScaleCTM(context, 1, -1);
- if (qwidget->isWindow())
- CGContextClearRect(context, widgetRect);
- CGContextClipToMask(context, widgetRect, qwidgetprivate->extra->imageMask);
- CGContextScaleCTM(context, 1, -1);
- CGContextTranslateCTM (context, 0, -widgetRect.size.height);
- }
-
- if (qwidget->isWindow() && !qwidgetprivate->isOpaque
- && !qwidget->testAttribute(Qt::WA_MacBrushedMetal)) {
- CGContextClearRect(context, NSRectToCGRect(aRect));
- }
-
- qwidget->setAttribute(Qt::WA_WState_InPaintEvent, false);
- QWidgetPrivate *qwidgetPrivate = qt_widget_private(qwidget);
-
- // We specify that we want to draw the widget itself, and
- // all its children recursive. But we skip native children, because
- // they will receive drawRect calls by themselves as needed:
- int flags = QWidgetPrivate::DrawPaintOnScreen
- | QWidgetPrivate::DrawRecursive
- | QWidgetPrivate::DontDrawNativeChildren;
-
- if (qwidget->isWindow())
- flags |= QWidgetPrivate::DrawAsRoot;
-
- // Start to draw:
- qt_mac_clearDirtyOnWidgetInsideDrawWidget = true;
- qwidgetPrivate->drawWidget(qwidget, qrgn, QPoint(), flags, 0);
- qt_mac_clearDirtyOnWidgetInsideDrawWidget = false;
-
- if (!redirectionOffset.isNull())
- QPainter::restoreRedirected(qwidget);
- if (engine)
- engine->setSystemClip(QRegion());
- qwidget->setAttribute(Qt::WA_WState_InPaintEvent, false);
- if(!qwidget->testAttribute(Qt::WA_PaintOutsidePaintEvent) && qwidget->paintingActive())
- qWarning("QWidget: It is dangerous to leave painters active on a"
- " widget outside of the PaintEvent");
- }
- qwidgetprivate->hd = 0;
- qt_mac_release_graphics_context(context);
-}
-
-- (BOOL)acceptsFirstMouse:(NSEvent *)theEvent
-{
- // Find the widget that should receive the event:
- QPoint qlocal, qglobal;
- QWidget *widgetToGetMouse = qt_mac_getTargetForMouseEvent(theEvent, QEvent::MouseButtonPress, qlocal, qglobal, qwidget, 0);
- if (!widgetToGetMouse)
- return NO;
-
- return !widgetToGetMouse->testAttribute(Qt::WA_MacNoClickThrough);
-}
-
-- (NSView *)hitTest:(NSPoint)aPoint
-{
- if (!qwidget)
- return [super hitTest:aPoint];
-
- if (qwidget->testAttribute(Qt::WA_TransparentForMouseEvents))
- return nil; // You cannot hit a transparent for mouse event widget.
- return [super hitTest:aPoint];
-}
-
-- (void)updateTrackingAreas
-{
- if (!qwidget)
- return;
-
- // [NSView addTrackingArea] is slow, so bail out early if we can:
- if (NSIsEmptyRect([self visibleRect]))
- return;
-
- QMacCocoaAutoReleasePool pool;
- if (NSArray *trackingArray = [self trackingAreas]) {
- NSUInteger size = [trackingArray count];
- for (NSUInteger i = 0; i < size; ++i) {
- NSTrackingArea *t = [trackingArray objectAtIndex:i];
- [self removeTrackingArea:t];
- }
- }
-
- // Ideally, we shouldn't have NSTrackingMouseMoved events included below, it should
- // only be turned on if mouseTracking, hover is on or a tool tip is set.
- // Unfortunately, Qt will send "tooltip" events on mouse moves, so we need to
- // turn it on in ALL case. That means EVERY QCocoaView gets to pay the cost of
- // mouse moves delivered to it (Apple recommends keeping it OFF because there
- // is a performance hit). So it goes.
- NSUInteger trackingOptions = NSTrackingMouseEnteredAndExited | NSTrackingActiveInActiveApp
- | NSTrackingInVisibleRect | NSTrackingMouseMoved;
- NSTrackingArea *ta = [[NSTrackingArea alloc] initWithRect:NSMakeRect(0, 0,
- qwidget->width(),
- qwidget->height())
- options:trackingOptions
- owner:self
- userInfo:nil];
- [self addTrackingArea:ta];
- [ta release];
-}
-
-- (void)mouseEntered:(NSEvent *)event
-{
- // Cocoa will not send a move event on mouseEnter. But since
- // Qt expect this, we fake one now. See also mouseExited below
- // for info about enter/leave event handling
- NSEvent *nsmoveEvent = [NSEvent
- mouseEventWithType:NSMouseMoved
- location:[[self window] mouseLocationOutsideOfEventStream]
- modifierFlags: [event modifierFlags]
- timestamp: [event timestamp]
- windowNumber: [event windowNumber]
- context: [event context]
- eventNumber: [event eventNumber]
- clickCount: 0
- pressure: 0];
-
- // Important: Cocoa sends us mouseEnter on all views under the mouse
- // and not just the one on top. Therefore, to we cannot use qwidget
- // as native widget for this case. Instead, we let qt_mac_handleMouseEvent
- // resolve it (last argument set to 0):
- qt_mac_handleMouseEvent(nsmoveEvent, QEvent::MouseMove, Qt::NoButton, 0);
-}
-
-- (void)mouseExited:(NSEvent *)event
-{
- // Note: normal enter/leave handling is done from within mouseMove. This handler
- // catches the case when the mouse moves out of the window (which mouseMove do not).
- // Updating the mouse cursor follows the same logic as enter/leave. And we update
- // neither if a grab exists (even if the grab points to this widget, it seems, ref X11)
- Q_UNUSED(event);
- if (self == [[self window] contentView] && !qt_button_down && !QWidget::mouseGrabber()) {
- qt_mac_update_cursor();
- // If the mouse exits the content view, but qt_mac_getTargetForMouseEvent still
- // reports a target, it means that either there is a grab involved, or the mouse
- // hovered over another window in the application. In both cases, move events will
- // cause qt_mac_handleMouseEvent to be called, which will handle enter/leave.
- QPoint qlocal, qglobal;
- QWidget *widgetUnderMouse = 0;
- qt_mac_getTargetForMouseEvent(event, QEvent::Leave, qlocal, qglobal, qwidget, &widgetUnderMouse);
-
- if (widgetUnderMouse == 0) {
- QApplicationPrivate::dispatchEnterLeave(0, qt_last_mouse_receiver);
- qt_last_mouse_receiver = 0;
- qt_last_native_mouse_receiver = 0;
- }
- }
-}
-
-- (void)flagsChanged:(NSEvent *)theEvent
-{
- QWidget *widgetToGetKey = qt_mac_getTargetForKeyEvent(qwidget);
- if (!widgetToGetKey)
- return;
-
- qt_dispatchModifiersChanged(theEvent, widgetToGetKey);
- [super flagsChanged:theEvent];
-}
-
-- (void)mouseMoved:(NSEvent *)theEvent
-{
- // Important: this method will only be called when the view's window is _not_ inside
- // QCocoaWindow/QCocoaPanel. Otherwise, [QCocoaWindow sendEvent] will handle the event
- // before it ends up here. So, this method is added for supporting QMacNativeWidget.
- // TODO: Cocoa send move events to all views under the mouse. So make sure we only
- // handle the event for the widget on top when using QMacNativeWidget.
- qt_mac_handleMouseEvent(theEvent, QEvent::MouseMove, Qt::NoButton, qwidget);
-}
-
-- (void)mouseDown:(NSEvent *)theEvent
-{
- qt_mac_handleMouseEvent(theEvent, QEvent::MouseButtonPress, Qt::LeftButton, qwidget);
- // Don't call super here. This prevents us from getting the mouseUp event,
- // which we need to send even if the mouseDown event was not accepted.
- // (this is standard Qt behavior.)
-}
-
-- (void)mouseUp:(NSEvent *)theEvent
-{
- qt_mac_handleMouseEvent(theEvent, QEvent::MouseButtonRelease, Qt::LeftButton, qwidget);
-}
-
-- (void)rightMouseDown:(NSEvent *)theEvent
-{
- qt_mac_handleMouseEvent(theEvent, QEvent::MouseButtonPress, Qt::RightButton, qwidget);
-}
-
-- (void)rightMouseUp:(NSEvent *)theEvent
-{
- qt_mac_handleMouseEvent(theEvent, QEvent::MouseButtonRelease, Qt::RightButton, qwidget);
-}
-
-- (void)otherMouseDown:(NSEvent *)theEvent
-{
- Qt::MouseButton mouseButton = cocoaButton2QtButton([theEvent buttonNumber]);
- qt_mac_handleMouseEvent(theEvent, QEvent::MouseButtonPress, mouseButton, qwidget);
-}
-
-- (void)otherMouseUp:(NSEvent *)theEvent
-{
- Qt::MouseButton mouseButton = cocoaButton2QtButton([theEvent buttonNumber]);
- qt_mac_handleMouseEvent(theEvent, QEvent::MouseButtonRelease, mouseButton, qwidget);
-}
-
-- (void)mouseDragged:(NSEvent *)theEvent
-{
- qt_mac_handleMouseEvent(theEvent, QEvent::MouseMove, Qt::NoButton, qwidget);
-}
-
-- (void)rightMouseDragged:(NSEvent *)theEvent
-{
- qt_mac_handleMouseEvent(theEvent, QEvent::MouseMove, Qt::NoButton, qwidget);
-}
-
-- (void)otherMouseDragged:(NSEvent *)theEvent
-{
- qt_mac_handleMouseEvent(theEvent, QEvent::MouseMove, Qt::NoButton, qwidget);
-}
-
-- (void)scrollWheel:(NSEvent *)theEvent
-{
- // Give the Input Manager a chance to process the wheel event.
- NSInputManager *currentIManager = [NSInputManager currentInputManager];
- if (currentIManager && [currentIManager wantsToHandleMouseEvents]) {
- [currentIManager handleMouseEvent:theEvent];
- }
-
- Qt::MouseButtons buttons = QApplication::mouseButtons();
- Qt::KeyboardModifiers keyMods = qt_cocoaModifiers2QtModifiers([theEvent modifierFlags]);
-
- // Find the widget that should receive the event:
- QPoint qlocal, qglobal;
- QWidget *widgetToGetMouse = qt_mac_getTargetForMouseEvent(theEvent, QEvent::Wheel, qlocal, qglobal, qwidget, 0);
- if (!widgetToGetMouse)
- return;
-
- int deltaX = 0;
- int deltaY = 0;
- int deltaZ = 0;
-
- const EventRef carbonEvent = (EventRef)[theEvent eventRef];
- const UInt32 carbonEventKind = carbonEvent ? ::GetEventKind(carbonEvent) : 0;
- const bool scrollEvent = carbonEventKind == kEventMouseScroll;
-
- if (scrollEvent) {
- // The mouse device containts pixel scroll wheel support (Mighty Mouse, Trackpad).
- // Since deviceDelta is delivered as pixels rather than degrees, we need to
- // convert from pixels to degrees in a sensible manner.
- // It looks like 1/4 degrees per pixel behaves most native.
- // (NB: Qt expects the unit for delta to be 8 per degree):
- const int pixelsToDegrees = 2; // 8 * 1/4
- deltaX = [theEvent deviceDeltaX] * pixelsToDegrees;
- deltaY = [theEvent deviceDeltaY] * pixelsToDegrees;
- deltaZ = [theEvent deviceDeltaZ] * pixelsToDegrees;
- } else {
- // carbonEventKind == kEventMouseWheelMoved
- // Remove acceleration, and use either -120 or 120 as delta:
- deltaX = qBound(-120, int([theEvent deltaX] * 10000), 120);
- deltaY = qBound(-120, int([theEvent deltaY] * 10000), 120);
- deltaZ = qBound(-120, int([theEvent deltaZ] * 10000), 120);
- }
-
-#ifndef QT_NO_WHEELEVENT
- // ### Qt 5: Send one QWheelEvent with dx, dy and dz
-
- if (deltaX != 0 && deltaY != 0)
- QMacScrollOptimization::initDelayedScroll();
-
- if (deltaX != 0) {
- QWheelEvent qwe(qlocal, qglobal, deltaX, buttons, keyMods, Qt::Horizontal);
- qt_sendSpontaneousEvent(widgetToGetMouse, &qwe);
- }
-
- if (deltaY != 0) {
- QWheelEvent qwe(qlocal, qglobal, deltaY, buttons, keyMods, Qt::Vertical);
- qt_sendSpontaneousEvent(widgetToGetMouse, &qwe);
- }
-
- if (deltaZ != 0) {
- // Qt doesn't explicitly support wheels with a Z component. In a misguided attempt to
- // try to be ahead of the pack, I'm adding this extra value.
- QWheelEvent qwe(qlocal, qglobal, deltaZ, buttons, keyMods, (Qt::Orientation)3);
- qt_sendSpontaneousEvent(widgetToGetMouse, &qwe);
- }
-
- if (deltaX != 0 && deltaY != 0)
- QMacScrollOptimization::performDelayedScroll();
-#endif //QT_NO_WHEELEVENT
-}
-
-- (void)tabletProximity:(NSEvent *)tabletEvent
-{
- qt_dispatchTabletProximityEvent(tabletEvent);
-}
-
-- (void)tabletPoint:(NSEvent *)tabletEvent
-{
- if (!qt_mac_handleTabletEvent(self, tabletEvent))
- [super tabletPoint:tabletEvent];
-}
-
-- (void)magnifyWithEvent:(NSEvent *)event
-{
- QPoint qlocal, qglobal;
- QWidget *widgetToGetGesture = 0;
- qt_mac_getTargetForMouseEvent(event, QEvent::Gesture, qlocal, qglobal, qwidget, &widgetToGetGesture);
- if (!widgetToGetGesture)
- return;
- if (!QApplicationPrivate::tryModalHelper(widgetToGetGesture, 0))
- return;
-
-#ifndef QT_NO_GESTURES
- QNativeGestureEvent qNGEvent;
- qNGEvent.gestureType = QNativeGestureEvent::Zoom;
- NSPoint p = [[event window] convertBaseToScreen:[event locationInWindow]];
- qNGEvent.position = flipPoint(p).toPoint();
- qNGEvent.percentage = [event magnification];
- qt_sendSpontaneousEvent(widgetToGetGesture, &qNGEvent);
-#endif // QT_NO_GESTURES
-}
-
-- (void)rotateWithEvent:(NSEvent *)event
-{
- QPoint qlocal, qglobal;
- QWidget *widgetToGetGesture = 0;
- qt_mac_getTargetForMouseEvent(event, QEvent::Gesture, qlocal, qglobal, qwidget, &widgetToGetGesture);
- if (!widgetToGetGesture)
- return;
- if (!QApplicationPrivate::tryModalHelper(widgetToGetGesture, 0))
- return;
-
-#ifndef QT_NO_GESTURES
- QNativeGestureEvent qNGEvent;
- qNGEvent.gestureType = QNativeGestureEvent::Rotate;
- NSPoint p = [[event window] convertBaseToScreen:[event locationInWindow]];
- qNGEvent.position = flipPoint(p).toPoint();
- qNGEvent.percentage = -[event rotation];
- qt_sendSpontaneousEvent(widgetToGetGesture, &qNGEvent);
-#endif // QT_NO_GESTURES
-}
-
-- (void)swipeWithEvent:(NSEvent *)event
-{
- QPoint qlocal, qglobal;
- QWidget *widgetToGetGesture = 0;
- qt_mac_getTargetForMouseEvent(event, QEvent::Gesture, qlocal, qglobal, qwidget, &widgetToGetGesture);
- if (!widgetToGetGesture)
- return;
- if (!QApplicationPrivate::tryModalHelper(widgetToGetGesture, 0))
- return;
-
-#ifndef QT_NO_GESTURES
- QNativeGestureEvent qNGEvent;
- qNGEvent.gestureType = QNativeGestureEvent::Swipe;
- NSPoint p = [[event window] convertBaseToScreen:[event locationInWindow]];
- qNGEvent.position = flipPoint(p).toPoint();
- if ([event deltaX] == 1)
- qNGEvent.angle = 180.0f;
- else if ([event deltaX] == -1)
- qNGEvent.angle = 0.0f;
- else if ([event deltaY] == 1)
- qNGEvent.angle = 90.0f;
- else if ([event deltaY] == -1)
- qNGEvent.angle = 270.0f;
- qt_sendSpontaneousEvent(widgetToGetGesture, &qNGEvent);
-#endif // QT_NO_GESTURES
-}
-
-- (void)beginGestureWithEvent:(NSEvent *)event
-{
- QPoint qlocal, qglobal;
- QWidget *widgetToGetGesture = 0;
- qt_mac_getTargetForMouseEvent(event, QEvent::Gesture, qlocal, qglobal, qwidget, &widgetToGetGesture);
- if (!widgetToGetGesture)
- return;
- if (!QApplicationPrivate::tryModalHelper(widgetToGetGesture, 0))
- return;
-
-#ifndef QT_NO_GESTURES
- QNativeGestureEvent qNGEvent;
- qNGEvent.gestureType = QNativeGestureEvent::GestureBegin;
- NSPoint p = [[event window] convertBaseToScreen:[event locationInWindow]];
- qNGEvent.position = flipPoint(p).toPoint();
- qt_sendSpontaneousEvent(widgetToGetGesture, &qNGEvent);
-#endif // QT_NO_GESTURES
-}
-
-- (void)endGestureWithEvent:(NSEvent *)event
-{
- QPoint qlocal, qglobal;
- QWidget *widgetToGetGesture = 0;
- qt_mac_getTargetForMouseEvent(event, QEvent::Gesture, qlocal, qglobal, qwidget, &widgetToGetGesture);
- if (!widgetToGetGesture)
- return;
- if (!QApplicationPrivate::tryModalHelper(widgetToGetGesture, 0))
- return;
-
-#ifndef QT_NO_GESTURES
- QNativeGestureEvent qNGEvent;
- qNGEvent.gestureType = QNativeGestureEvent::GestureEnd;
- NSPoint p = [[event window] convertBaseToScreen:[event locationInWindow]];
- qNGEvent.position = flipPoint(p).toPoint();
- qt_sendSpontaneousEvent(widgetToGetGesture, &qNGEvent);
-}
-#endif // QT_NO_GESTURES
-
-- (void)frameDidChange:(NSNotification *)note
-{
- Q_UNUSED(note);
- if (!qwidget)
- return;
- if (qwidget->isWindow())
- return;
- NSRect newFrame = [self frame];
- QRect newGeo(newFrame.origin.x, newFrame.origin.y, newFrame.size.width, newFrame.size.height);
- bool moved = qwidget->testAttribute(Qt::WA_Moved);
- bool resized = qwidget->testAttribute(Qt::WA_Resized);
- qwidget->setGeometry(newGeo);
- qwidget->setAttribute(Qt::WA_Moved, moved);
- qwidget->setAttribute(Qt::WA_Resized, resized);
- qwidgetprivate->syncCocoaMask();
-}
-
-- (BOOL)isEnabled
-{
- if (!qwidget)
- return [super isEnabled];
- return [super isEnabled] && qwidget->isEnabled();
-}
-
-- (void)setEnabled:(BOOL)flag
-{
- QMacCocoaAutoReleasePool pool;
- [super setEnabled:flag];
- if (qwidget && qwidget->isEnabled() != flag)
- qwidget->setEnabled(flag);
-}
-
-+ (Class)cellClass
-{
- return [NSActionCell class];
-}
-
-- (BOOL)acceptsFirstResponder
-{
- if (!qwidget)
- return NO;
-
- // Disabled widget shouldn't get focus even if it's a window.
- // hence disabled windows will not get any key or mouse events.
- if (!qwidget->isEnabled())
- return NO;
-
- if (qwidget->isWindow() && !qt_widget_private(qwidget)->topData()->embedded) {
- QWidget *focusWidget = qApp->focusWidget();
- if (!focusWidget) {
- // There is no focus widget, but we still want to receive key events
- // for shortcut handling etc. So we accept first responer for the
- // content view as a last resort:
- return YES;
- }
- if (!focusWidget->internalWinId() && focusWidget->nativeParentWidget() == qwidget) {
- // The current focus widget is alien, and hence, cannot get acceptsFirstResponder
- // calls. Since the focus widget is a child of qwidget, we let this view say YES:
- return YES;
- }
- if (focusWidget->window() != qwidget) {
- // The current focus widget is in another window. Since cocoa
- // suggest that this window should be key now, we accept:
- return YES;
- }
- }
-
- return qwidget->focusPolicy() != Qt::NoFocus;
-}
-
-- (BOOL)resignFirstResponder
-{
- if (!qwidget)
- return YES;
-
- // Seems like the following test only triggers if this
- // view is inside a QMacNativeWidget:
-// if (QWidget *fw = QApplication::focusWidget()) {
-// if (qwidget == fw || qwidget == fw->nativeParentWidget())
-// fw->clearFocus();
-// }
- return YES;
-}
-
-- (BOOL)becomeFirstResponder
-{
- // see the comment in the acceptsFirstResponder - if the window "stole" focus
- // let it become the responder, but don't tell Qt
- if (qwidget && qt_widget_private(qwidget->window())->topData()->embedded
- && !QApplication::focusWidget() && qwidget->focusPolicy() != Qt::NoFocus)
- qwidget->setFocus(Qt::OtherFocusReason);
- return YES;
-}
-
-- (NSDragOperation)draggingSourceOperationMaskForLocal:(BOOL)isLocal
-{
- Q_UNUSED(isLocal);
- return supportedActions;
-}
-
-- (void)setSupportedActions:(NSDragOperation)actions
-{
- supportedActions = actions;
-}
-
-- (void)draggedImage:(NSImage *)anImage endedAt:(NSPoint)aPoint operation:(NSDragOperation)operation
-{
- Q_UNUSED(anImage);
- Q_UNUSED(aPoint);
- macCurrentDnDParameters()->performedAction = operation;
- if (QDragManager::self()->object
- && QDragManager::self()->dragPrivate()->executed_action != Qt::ActionMask) {
- macCurrentDnDParameters()->performedAction =
- qt_mac_mapDropAction(QDragManager::self()->dragPrivate()->executed_action);
- }
-}
-
-- (QWidget *)qt_qwidget
-{
- return qwidget;
-}
-
-- (void) qt_clearQWidget
-{
- qwidget = 0;
- qwidgetprivate = 0;
-}
-
-- (void)keyDown:(NSEvent *)theEvent
-{
- if (!qwidget)
- return;
- QWidget *widgetToGetKey = qt_mac_getTargetForKeyEvent(qwidget);
- if (!widgetToGetKey)
- return;
-
- sendKeyEvents = true;
-
- if (widgetToGetKey->testAttribute(Qt::WA_InputMethodEnabled)
- && !(widgetToGetKey->inputMethodHints() & Qt::ImhDigitsOnly
- || widgetToGetKey->inputMethodHints() & Qt::ImhFormattedNumbersOnly
- || widgetToGetKey->inputMethodHints() & Qt::ImhHiddenText)) {
- fromKeyDownEvent = true;
- [qt_mac_nativeview_for(qwidget) interpretKeyEvents:[NSArray arrayWithObject: theEvent]];
- fromKeyDownEvent = false;
- }
-
- if (sendKeyEvents && !composing) {
- bool keyEventEaten = qt_dispatchKeyEvent(theEvent, widgetToGetKey);
- if (!keyEventEaten && qwidget) {
- // The event is not yet eaten, and if Qt is embedded inside a native
- // cocoa application, send it to first responder not owned by Qt.
- // The exception is if widgetToGetKey was redirected to a popup.
- QWidget *toplevel = qwidget->window();
- if (toplevel == widgetToGetKey->window()) {
- if (qt_widget_private(toplevel)->topData()->embedded) {
- if (NSResponder *w = [qt_mac_nativeview_for(toplevel) superview])
- [w keyDown:theEvent];
- }
- }
- }
- }
-}
-
-
-- (void)keyUp:(NSEvent *)theEvent
-{
- if (sendKeyEvents) {
- QWidget *widgetToGetKey = qt_mac_getTargetForKeyEvent(qwidget);
- if (!widgetToGetKey)
- return;
-
- bool keyEventEaten = qt_dispatchKeyEvent(theEvent, widgetToGetKey);
- if (!keyEventEaten && qwidget) {
- // The event is not yet eaten, and if Qt is embedded inside a native
- // cocoa application, send it to first responder not owned by Qt.
- // The exception is if widgetToGetKey was redirected to a popup.
- QWidget *toplevel = qwidget->window();
- if (toplevel == widgetToGetKey->window()) {
- if (qt_widget_private(toplevel)->topData()->embedded) {
- if (NSResponder *w = [qt_mac_nativeview_for(toplevel) superview])
- [w keyUp:theEvent];
- }
- }
- }
- }
-}
-
-- (void)viewWillMoveToWindow:(NSWindow *)window
-{
- if (qwidget == 0)
- return;
-
- if (qwidget->windowFlags() & Qt::MSWindowsOwnDC
- && (window != [self window])) { // OpenGL Widget
- QEvent event(QEvent::MacGLClearDrawable);
- qApp->sendEvent(qwidget, &event);
- }
-}
-
-- (void)viewDidMoveToWindow
-{
- if (qwidget == 0)
- return;
-
- if (qwidget->windowFlags() & Qt::MSWindowsOwnDC && [self window]) {
- // call update paint event
- qwidgetprivate->needWindowChange = true;
- QEvent event(QEvent::MacGLWindowChange);
- qApp->sendEvent(qwidget, &event);
- }
-}
-
-
-// NSTextInput Protocol implementation
-
-- (void) insertText:(id)aString
-{
- QString commitText;
- if ([aString length]) {
- if ([aString isKindOfClass:[NSAttributedString class]]) {
- commitText = QCFString::toQString(reinterpret_cast<CFStringRef>([aString string]));
- } else {
- commitText = QCFString::toQString(reinterpret_cast<CFStringRef>(aString));
- };
- }
-
- // When entering characters through Character Viewer or Keyboard Viewer, the text is passed
- // through this insertText method. Since we dont receive a keyDown Event in such cases, the
- // composing flag will be false.
- if (([aString length] && composing) || !fromKeyDownEvent) {
- // Send the commit string to the widget.
- composing = false;
- sendKeyEvents = false;
- QInputMethodEvent e;
- e.setCommitString(commitText);
- if (QWidget *widgetToGetKey = qt_mac_getTargetForKeyEvent(qwidget))
- qt_sendSpontaneousEvent(widgetToGetKey, &e);
- } else {
- // The key sequence "`q" on a French Keyboard will generate two calls to insertText before
- // it returns from interpretKeyEvents. The first call will turn off 'composing' and accept
- // the "`" key. The last keyDown event needs to be processed by the widget to get the
- // character "q". The string parameter is ignored for the second call.
- sendKeyEvents = true;
- }
-
- composingText->clear();
-}
-
-- (void) setMarkedText:(id)aString selectedRange:(NSRange)selRange
-{
- // Generate the QInputMethodEvent with preedit string and the attributes
- // for rendering it. The attributes handled here are 'underline',
- // 'underline color' and 'cursor position'.
- sendKeyEvents = false;
- composing = true;
- QString qtText;
- // Cursor position is retrived from the range.
- QList<QInputMethodEvent::Attribute> attrs;
- attrs<<QInputMethodEvent::Attribute(QInputMethodEvent::Cursor, selRange.location + selRange.length, 1, QVariant());
- if ([aString isKindOfClass:[NSAttributedString class]]) {
- qtText = QCFString::toQString(reinterpret_cast<CFStringRef>([aString string]));
- composingLength = qtText.length();
- int index = 0;
- // Create attributes for individual sections of preedit text
- while (index < composingLength) {
- NSRange effectiveRange;
- NSRange range = NSMakeRange(index, composingLength-index);
- NSDictionary *attributes = [aString attributesAtIndex:index
- longestEffectiveRange:&effectiveRange
- inRange:range];
- NSNumber *underlineStyle = [attributes objectForKey:NSUnderlineStyleAttributeName];
- if (underlineStyle) {
- QColor clr (Qt::black);
- NSColor *color = [attributes objectForKey:NSUnderlineColorAttributeName];
- if (color) {
- clr = colorFrom(color);
- }
- QTextCharFormat format;
- format.setFontUnderline(true);
- format.setUnderlineColor(clr);
- attrs<<QInputMethodEvent::Attribute(QInputMethodEvent::TextFormat,
- effectiveRange.location,
- effectiveRange.length,
- format);
- }
- index = effectiveRange.location + effectiveRange.length;
- }
- } else {
- // No attributes specified, take only the preedit text.
- qtText = QCFString::toQString(reinterpret_cast<CFStringRef>(aString));
- composingLength = qtText.length();
- }
- // Make sure that we have at least one text format.
- if (attrs.size() <= 1) {
- QTextCharFormat format;
- format.setFontUnderline(true);
- attrs<<QInputMethodEvent::Attribute(QInputMethodEvent::TextFormat,
- 0, composingLength, format);
- }
- *composingText = qtText;
-
- QInputMethodEvent e(qtText, attrs);
- if (QWidget *widgetToGetKey = qt_mac_getTargetForKeyEvent(qwidget))
- qt_sendSpontaneousEvent(widgetToGetKey, &e);
-
- if (!composingLength)
- composing = false;
-}
-
-- (void) unmarkText
-{
- if (composing) {
- QInputMethodEvent e;
- e.setCommitString(*composingText);
- if (QWidget *widgetToGetKey = qt_mac_getTargetForKeyEvent(qwidget))
- qt_sendSpontaneousEvent(widgetToGetKey, &e);
- }
- composingText->clear();
- composing = false;
-}
-
-- (BOOL) hasMarkedText
-{
- return (composing ? YES: NO);
-}
-
-- (void) doCommandBySelector:(SEL)aSelector
-{
- Q_UNUSED(aSelector);
-}
-
-- (BOOL)isComposing
-{
- return composing;
-}
-
-- (NSInteger) conversationIdentifier
-{
- // Return a unique identifier fot this ime conversation
- return (NSInteger)self;
-}
-
-- (NSAttributedString *) attributedSubstringFromRange:(NSRange)theRange
-{
- QString selectedText(qwidget->inputMethodQuery(Qt::ImCurrentSelection).toString());
- if (!selectedText.isEmpty()) {
- QCFString string(selectedText.mid(theRange.location, theRange.length));
- const NSString *tmpString = reinterpret_cast<const NSString *>((CFStringRef)string);
- return [[[NSAttributedString alloc] initWithString:const_cast<NSString *>(tmpString)] autorelease];
- } else {
- return nil;
- }
-}
-
-- (NSRange) markedRange
-{
- NSRange range;
- if (composing) {
- range.location = 0;
- range.length = composingLength;
- } else {
- range.location = NSNotFound;
- range.length = 0;
- }
- return range;
-}
-
-- (NSRange) selectedRange
-{
- NSRange selRange;
- QString selectedText(qwidget->inputMethodQuery(Qt::ImCurrentSelection).toString());
- if (!selectedText.isEmpty()) {
- // Consider only the selected text.
- selRange.location = 0;
- selRange.length = selectedText.length();
- } else {
- // No selected text.
- selRange.location = NSNotFound;
- selRange.length = 0;
- }
- return selRange;
-
-}
-
-- (NSRect) firstRectForCharacterRange:(NSRange)theRange
-{
- Q_UNUSED(theRange);
- // The returned rect is always based on the internal cursor.
- QWidget *widgetToGetKey = qt_mac_getTargetForKeyEvent(qwidget);
- if (!widgetToGetKey)
- return NSZeroRect;
-
- QRect mr(widgetToGetKey->inputMethodQuery(Qt::ImMicroFocus).toRect());
- QPoint mp(widgetToGetKey->mapToGlobal(QPoint(mr.bottomLeft())));
- NSRect rect ;
- rect.origin.x = mp.x();
- rect.origin.y = flipYCoordinate(mp.y());
- rect.size.width = mr.width();
- rect.size.height = mr.height();
- return rect;
-}
-
-- (NSUInteger)characterIndexForPoint:(NSPoint)thePoint
-{
- // We dont support cursor movements using mouse while composing.
- Q_UNUSED(thePoint);
- return NSNotFound;
-}
-
-- (NSArray*) validAttributesForMarkedText
-{
- QWidget *widgetToGetKey = qt_mac_getTargetForKeyEvent(qwidget);
- if (!widgetToGetKey)
- return nil;
-
- if (!widgetToGetKey->testAttribute(Qt::WA_InputMethodEnabled))
- return nil; // Not sure if that's correct, but it's saves a malloc.
-
- // Support only underline color/style.
- return [NSArray arrayWithObjects:NSUnderlineColorAttributeName,
- NSUnderlineStyleAttributeName, nil];
-}
-@end
-
-QT_BEGIN_NAMESPACE
-void QMacInputContext::reset()
-{
- QWidget *w = QInputContext::focusWidget();
- if (w) {
- NSView *view = qt_mac_effectiveview_for(w);
- if ([view isKindOfClass:[QT_MANGLE_NAMESPACE(QCocoaView) class]]) {
- QMacCocoaAutoReleasePool pool;
- QT_MANGLE_NAMESPACE(QCocoaView) *qc = static_cast<QT_MANGLE_NAMESPACE(QCocoaView) *>(view);
- NSInputManager *currentIManager = [NSInputManager currentInputManager];
- if (currentIManager) {
- [currentIManager markedTextAbandoned:view];
- [qc unmarkText];
- }
- }
- }
-}
-
-bool QMacInputContext::isComposing() const
-{
- QWidget *w = QInputContext::focusWidget();
- if (w) {
- NSView *view = qt_mac_effectiveview_for(w);
- if ([view isKindOfClass:[QT_MANGLE_NAMESPACE(QCocoaView) class]]) {
- return [static_cast<QT_MANGLE_NAMESPACE(QCocoaView) *>(view) isComposing];
- }
- }
- return false;
-}
-
-extern bool qt_mac_in_drag;
-void * /*NSImage */qt_mac_create_nsimage(const QPixmap &pm);
-static const int default_pm_hotx = -2;
-static const int default_pm_hoty = -16;
-static const char* default_pm[] = {
- "13 9 3 1",
- ". c None",
- " c #000000",
- "X c #FFFFFF",
- "X X X X X X X",
- " X X X X X X ",
- "X ......... X",
- " X.........X ",
- "X ......... X",
- " X.........X ",
- "X ......... X",
- " X X X X X X ",
- "X X X X X X X",
-};
-
-Qt::DropAction QDragManager::drag(QDrag *o)
-{
- if(qt_mac_in_drag) { //just make sure..
- qWarning("Qt: Internal error: WH0A, unexpected condition reached");
- return Qt::IgnoreAction;
- }
- if(object == o)
- return Qt::IgnoreAction;
- /* At the moment it seems clear that Mac OS X does not want to drag with a non-left button
- so we just bail early to prevent it */
- if(!(GetCurrentEventButtonState() & kEventMouseButtonPrimary))
- return Qt::IgnoreAction;
-
- if(object) {
- dragPrivate()->source->removeEventFilter(this);
- cancel();
- beingCancelled = false;
- }
-
- object = o;
- dragPrivate()->target = 0;
-
-#ifndef QT_NO_ACCESSIBILITY
- QAccessible::updateAccessibility(this, 0, QAccessible::DragDropStart);
-#endif
-
- // setup the data
- QMacPasteboard dragBoard((CFStringRef) NSDragPboard, QMacPasteboardMime::MIME_DND);
- dragPrivate()->data->setData(QLatin1String("application/x-qt-mime-type-name"), QByteArray("dummy"));
- dragBoard.setMimeData(dragPrivate()->data);
-
- // create the image
- QPoint hotspot;
- QPixmap pix = dragPrivate()->pixmap;
- if(pix.isNull()) {
- if(dragPrivate()->data->hasText() || dragPrivate()->data->hasUrls()) {
- // get the string
- QString s = dragPrivate()->data->hasText() ? dragPrivate()->data->text()
- : dragPrivate()->data->urls().first().toString();
- if(s.length() > 26)
- s = s.left(23) + QChar(0x2026);
- if(!s.isEmpty()) {
- // draw it
- QFont f(qApp->font());
- f.setPointSize(12);
- QFontMetrics fm(f);
- QPixmap tmp(fm.width(s), fm.height());
- if(!tmp.isNull()) {
- QPainter p(&tmp);
- p.fillRect(0, 0, tmp.width(), tmp.height(), Qt::color0);
- p.setPen(Qt::color1);
- p.setFont(f);
- p.drawText(0, fm.ascent(), s);
- // save it
- pix = tmp;
- hotspot = QPoint(tmp.width() / 2, tmp.height() / 2);
- }
- }
- } else {
- pix = QPixmap(default_pm);
- hotspot = QPoint(default_pm_hotx, default_pm_hoty);
- }
- } else {
- hotspot = dragPrivate()->hotspot;
- }
-
- // Convert the image to NSImage:
- NSImage *image = (NSImage *)qt_mac_create_nsimage(pix);
- [image retain];
-
- DnDParams *dndParams = macCurrentDnDParameters();
- QT_MANGLE_NAMESPACE(QCocoaView) *theView = static_cast<QT_MANGLE_NAMESPACE(QCocoaView) *>(dndParams->view);
-
- // Save supported actions:
- [theView setSupportedActions: qt_mac_mapDropActions(dragPrivate()->possible_actions)];
- QPoint pointInView = [theView qt_qwidget]->mapFromGlobal(dndParams->globalPoint);
- NSPoint imageLoc = {pointInView.x() - hotspot.x(), pointInView.y() + pix.height() - hotspot.y()};
- NSSize mouseOffset = {0.0, 0.0};
- NSPasteboard *pboard = [NSPasteboard pasteboardWithName:NSDragPboard];
- dragPrivate()->executed_action = Qt::ActionMask;
-
- // Execute the drag:
- [theView retain];
- [theView dragImage:image
- at:imageLoc
- offset:mouseOffset
- event:dndParams->theEvent
- pasteboard:pboard
- source:theView
- slideBack:YES];
-
- // Reset the implicit grab widget when drag ends because we will not
- // receive the mouse release event when DND is active:
- qt_button_down = 0;
- [theView release];
- [image release];
- if (dragPrivate())
- dragPrivate()->executed_action = Qt::IgnoreAction;
- object = 0;
- Qt::DropAction performedAction(qt_mac_mapNSDragOperation(dndParams->performedAction));
-
- // Do post drag processing, if required.
- if (performedAction != Qt::IgnoreAction) {
- // Check if the receiver points us to a file location.
- // if so, we need to do the file copy/move ourselves.
- QCFType<CFURLRef> pasteLocation = 0;
- PasteboardCopyPasteLocation(dragBoard.pasteBoard(), &pasteLocation);
- if (pasteLocation) {
- QList<QUrl> urls = o->mimeData()->urls();
- for (int i = 0; i < urls.size(); ++i) {
- QUrl fromUrl = urls.at(i);
- QString filename = QFileInfo(fromUrl.path()).fileName();
- QUrl toUrl(QCFString::toQString(CFURLGetString(pasteLocation)) + filename);
- if (performedAction == Qt::MoveAction)
- QFile::rename(fromUrl.path(), toUrl.path());
- else if (performedAction == Qt::CopyAction)
- QFile::copy(fromUrl.path(), toUrl.path());
- }
- }
- }
-
- // Clean-up:
- o->setMimeData(0);
- o->deleteLater();
- return performedAction;
-}
-
-QT_END_NAMESPACE
-
diff --git a/src/widgets/platforms/mac/qcocoaview_mac_p.h b/src/widgets/platforms/mac/qcocoaview_mac_p.h
deleted file mode 100644
index e534e7ab47..0000000000
--- a/src/widgets/platforms/mac/qcocoaview_mac_p.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
-
-//
-// 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 <qevent.h>
-#import <Cocoa/Cocoa.h>
-
-@class QT_MANGLE_NAMESPACE(QCocoaView);
-QT_FORWARD_DECLARE_CLASS(QWidgetPrivate);
-QT_FORWARD_DECLARE_CLASS(QWidget);
-QT_FORWARD_DECLARE_CLASS(QEvent);
-QT_FORWARD_DECLARE_CLASS(QString);
-QT_FORWARD_DECLARE_CLASS(QStringList);
-
-Q_WIDGETS_EXPORT
-@interface QT_MANGLE_NAMESPACE(QCocoaView) : NSControl <NSTextInput> {
- QWidget *qwidget;
- QWidgetPrivate *qwidgetprivate;
- NSDragOperation supportedActions;
- bool composing;
- int composingLength;
- bool sendKeyEvents;
- bool fromKeyDownEvent;
- QString *composingText;
- @public int alienTouchCount;
-}
-- (id)initWithQWidget:(QWidget *)widget widgetPrivate:(QWidgetPrivate *)widgetprivate;
-- (void) finishInitWithQWidget:(QWidget *)widget widgetPrivate:(QWidgetPrivate *)widgetprivate;
-- (void)frameDidChange:(NSNotification *)note;
-- (void)setSupportedActions:(NSDragOperation)actions;
-- (NSDragOperation)draggingSourceOperationMaskForLocal:(BOOL)isLocal;
-- (void)draggedImage:(NSImage *)anImage endedAt:(NSPoint)aPoint operation:(NSDragOperation)operation;
-- (BOOL)isComposing;
-- (QWidget *)qt_qwidget;
-- (void) qt_clearQWidget;
-
-@end
diff --git a/src/widgets/platforms/mac/qcocoawindow_mac.mm b/src/widgets/platforms/mac/qcocoawindow_mac.mm
deleted file mode 100644
index 918e5a0a13..0000000000
--- a/src/widgets/platforms/mac/qcocoawindow_mac.mm
+++ /dev/null
@@ -1,88 +0,0 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
-
-#include "qmacdefines_mac.h"
-#import <private/qcocoawindow_mac_p.h>
-#import <private/qcocoawindowdelegate_mac_p.h>
-#import <private/qcocoaview_mac_p.h>
-#import <private/qt_cocoa_helpers_mac_p.h>
-#import <private/qcocoawindowcustomthemeframe_mac_p.h>
-#import <private/qcocoaapplication_mac_p.h>
-#import <private/qdnd_p.h>
-#import <private/qmultitouch_mac_p.h>
-
-#include <QtGui/QWidget>
-
-QT_FORWARD_DECLARE_CLASS(QWidget);
-QT_USE_NAMESPACE
-
-@implementation NSWindow (QT_MANGLE_NAMESPACE(QWidgetIntegration))
-
-- (id)QT_MANGLE_NAMESPACE(qt_initWithQWidget):(QWidget*)widget contentRect:(NSRect)rect styleMask:(NSUInteger)mask
-{
- self = [self initWithContentRect:rect styleMask:mask backing:NSBackingStoreBuffered defer:YES];
- if (self) {
- [[QT_MANGLE_NAMESPACE(QCocoaWindowDelegate) sharedDelegate] becomeDelegteForWindow:self widget:widget];
- [self setReleasedWhenClosed:NO];
- }
- return self;
-}
-
-- (QWidget *)QT_MANGLE_NAMESPACE(qt_qwidget)
-{
- QWidget *widget = 0;
- if ([self delegate] == [QT_MANGLE_NAMESPACE(QCocoaWindowDelegate) sharedDelegate])
- widget = [[QT_MANGLE_NAMESPACE(QCocoaWindowDelegate) sharedDelegate] qt_qwidgetForWindow:self];
- return widget;
-}
-
-@end
-
-@implementation QT_MANGLE_NAMESPACE(QCocoaWindow)
-
-/***********************************************************************
- Copy and Paste between QCocoaWindow and QCocoaPanel
- This is a bit unfortunate, but thanks to the dynamic dispatch we
- have to duplicate this code or resort to really silly forwarding methods
-**************************************************************************/
-#include "qcocoasharedwindowmethods_mac_p.h"
-
-@end
diff --git a/src/widgets/platforms/mac/qcocoawindow_mac_p.h b/src/widgets/platforms/mac/qcocoawindow_mac_p.h
deleted file mode 100644
index 83ecb7c13e..0000000000
--- a/src/widgets/platforms/mac/qcocoawindow_mac_p.h
+++ /dev/null
@@ -1,95 +0,0 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
-
-//
-// 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.
-//
-
-#ifndef QCOCOAWINDOW_MAC_P
-#define QCOCOAWINDOW_MAC_P
-
-#include "qmacdefines_mac.h"
-#import <Cocoa/Cocoa.h>
-#include <private/qapplication_p.h>
-#include <private/qbackingstore_p.h>
-
-enum { QtMacCustomizeWindow = 1 << 21 }; // This will one day be run over by
-
-QT_FORWARD_DECLARE_CLASS(QWidget);
-QT_FORWARD_DECLARE_CLASS(QStringList);
-QT_FORWARD_DECLARE_CLASS(QCocoaDropData);
-
-@interface NSWindow (QtCoverForHackWithCategory)
-+ (Class)frameViewClassForStyleMask:(NSUInteger)styleMask;
-@end
-
-@interface NSWindow (QT_MANGLE_NAMESPACE(QWidgetIntegration))
-- (id)QT_MANGLE_NAMESPACE(qt_initWithQWidget):(QWidget *)widget contentRect:(NSRect)rect styleMask:(NSUInteger)mask;
-- (QWidget *)QT_MANGLE_NAMESPACE(qt_qwidget);
-@end
-
-@interface NSWindow (QtIntegration)
-- (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender;
-- (NSDragOperation)draggingUpdated:(id <NSDraggingInfo>)sender;
-- (void)draggingExited:(id <NSDraggingInfo>)sender;
-- (BOOL)performDragOperation:(id <NSDraggingInfo>)sender;
-@end
-
-@interface QT_MANGLE_NAMESPACE(QCocoaWindow) : NSWindow {
- QStringList *currentCustomDragTypes;
- QCocoaDropData *dropData;
- NSInteger dragEnterSequence;
-}
-
-+ (Class)frameViewClassForStyleMask:(NSUInteger)styleMask;
-- (void)registerDragTypes;
-- (void)drawRectOriginal:(NSRect)rect;
-
-@end
-
-#endif
diff --git a/src/widgets/platforms/mac/qcocoawindowcustomthemeframe_mac.mm b/src/widgets/platforms/mac/qcocoawindowcustomthemeframe_mac.mm
deleted file mode 100644
index f1b38148be..0000000000
--- a/src/widgets/platforms/mac/qcocoawindowcustomthemeframe_mac.mm
+++ /dev/null
@@ -1,60 +0,0 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
-
-#include "qmacdefines_mac.h"
-
-
-#import "private/qcocoawindowcustomthemeframe_mac_p.h"
-#import "private/qcocoawindow_mac_p.h"
-#include "private/qt_cocoa_helpers_mac_p.h"
-#include "qwidget.h"
-
-@implementation QT_MANGLE_NAMESPACE(QCocoaWindowCustomThemeFrame)
-
-- (void)_updateButtons
-{
- [super _updateButtons];
- NSWindow *window = [self window];
- qt_syncCocoaTitleBarButtons(window, [window QT_MANGLE_NAMESPACE(qt_qwidget)]);
-}
-
-@end
-
diff --git a/src/widgets/platforms/mac/qcocoawindowcustomthemeframe_mac_p.h b/src/widgets/platforms/mac/qcocoawindowcustomthemeframe_mac_p.h
deleted file mode 100644
index cd497849a7..0000000000
--- a/src/widgets/platforms/mac/qcocoawindowcustomthemeframe_mac_p.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of qapplication_*.cpp, qwidget*.cpp, qcolor_x11.cpp, qfiledialog.cpp
-// and many other. This header file may change from version to version
-// without notice, or even be removed.
-//
-// We mean it.
-//
-#import <Cocoa/Cocoa.h>
-#include "qmacdefines_mac.h"
-#import "qnsthemeframe_mac_p.h"
-
-@interface QT_MANGLE_NAMESPACE(QCocoaWindowCustomThemeFrame) : NSThemeFrame
-{
-}
-
-@end
diff --git a/src/widgets/platforms/mac/qcocoawindowdelegate_mac.mm b/src/widgets/platforms/mac/qcocoawindowdelegate_mac.mm
deleted file mode 100644
index fc89821f41..0000000000
--- a/src/widgets/platforms/mac/qcocoawindowdelegate_mac.mm
+++ /dev/null
@@ -1,437 +0,0 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
-
-#import "private/qcocoawindowdelegate_mac_p.h"
-#include <private/qwidget_p.h>
-#include <private/qapplication_p.h>
-#include <private/qt_cocoa_helpers_mac_p.h>
-#include <qevent.h>
-#include <qlayout.h>
-#include <qcoreapplication.h>
-#include <qmenubar.h>
-#include <QMainWindow>
-#include <QToolBar>
-#include <private/qmainwindowlayout_p.h>
-
-QT_BEGIN_NAMESPACE
-extern QWidgetData *qt_qwidget_data(QWidget *); // qwidget.cpp
-extern void onApplicationWindowChangedActivation(QWidget *, bool); //qapplication_mac.mm
-extern bool qt_sendSpontaneousEvent(QObject *, QEvent *); // qapplication.cpp
-QT_END_NAMESPACE
-
-QT_USE_NAMESPACE
-
-static QT_MANGLE_NAMESPACE(QCocoaWindowDelegate) *sharedCocoaWindowDelegate = nil;
-
-// This is a singleton, but unlike most Cocoa singletons, it lives in a library and could be
-// pontentially loaded and unloaded. This means we should at least attempt to do the
-// memory management correctly.
-
-static void cleanupCocoaWindowDelegate()
-{
- [sharedCocoaWindowDelegate release];
-}
-
-@implementation QT_MANGLE_NAMESPACE(QCocoaWindowDelegate)
-
-- (id)init
-{
- self = [super init];
- if (self != nil) {
- m_windowHash = new QHash<NSWindow *, QWidget *>();
- m_drawerHash = new QHash<NSDrawer *, QWidget *>();
- }
- return self;
-}
-
-- (void)dealloc
-{
- sharedCocoaWindowDelegate = nil;
- QHash<NSWindow *, QWidget *>::const_iterator windowIt = m_windowHash->constBegin();
- while (windowIt != m_windowHash->constEnd()) {
- [windowIt.key() setDelegate:nil];
- ++windowIt;
- }
- delete m_windowHash;
- QHash<NSDrawer *, QWidget *>::const_iterator drawerIt = m_drawerHash->constBegin();
- while (drawerIt != m_drawerHash->constEnd()) {
- [drawerIt.key() setDelegate:nil];
- ++drawerIt;
- }
- delete m_drawerHash;
- [super dealloc];
-}
-
-+ (id)allocWithZone:(NSZone *)zone
-{
- @synchronized(self) {
- if (sharedCocoaWindowDelegate == nil) {
- sharedCocoaWindowDelegate = [super allocWithZone:zone];
- return sharedCocoaWindowDelegate;
- qAddPostRoutine(cleanupCocoaWindowDelegate);
- }
- }
- return nil;
-}
-
-+ (QT_MANGLE_NAMESPACE(QCocoaWindowDelegate)*)sharedDelegate
-{
- @synchronized(self) {
- if (sharedCocoaWindowDelegate == nil)
- [[self alloc] init];
- }
- return [[sharedCocoaWindowDelegate retain] autorelease];
-}
-
--(void)syncSizeForWidget:(QWidget *)qwidget toSize:(const QSize &)newSize fromSize:(const QSize &)oldSize
-{
- qt_qwidget_data(qwidget)->crect.setSize(newSize);
- // ### static contents optimization needs to go here
- const OSViewRef view = qt_mac_nativeview_for(qwidget);
- [view setFrameSize:NSMakeSize(newSize.width(), newSize.height())];
- if (!qwidget->isVisible()) {
- qwidget->setAttribute(Qt::WA_PendingResizeEvent, true);
- } else {
- QResizeEvent qre(newSize, oldSize);
- if (qwidget->testAttribute(Qt::WA_PendingResizeEvent)) {
- qwidget->setAttribute(Qt::WA_PendingResizeEvent, false);
- QApplication::sendEvent(qwidget, &qre);
- } else {
- qt_sendSpontaneousEvent(qwidget, &qre);
- }
- }
-}
-
-- (void)dumpMaximizedStateforWidget:(QWidget*)qwidget window:(NSWindow *)window
-{
- if (!window)
- return; // Nothing to do.
- QWidgetData *widgetData = qt_qwidget_data(qwidget);
- if ((widgetData->window_state & Qt::WindowMaximized) && ![window isZoomed]) {
- widgetData->window_state &= ~Qt::WindowMaximized;
- QWindowStateChangeEvent e(Qt::WindowState(widgetData->window_state | Qt::WindowMaximized));
- qt_sendSpontaneousEvent(qwidget, &e);
- }
-}
-
-- (NSSize)closestAcceptableSizeForWidget:(QWidget *)qwidget window:(NSWindow *)window
- withNewSize:(NSSize)proposedSize
-{
- [self dumpMaximizedStateforWidget:qwidget window:window];
- QSize newSize = QLayout::closestAcceptableSize(qwidget,
- QSize(proposedSize.width, proposedSize.height));
- return [NSWindow frameRectForContentRect:
- NSMakeRect(0., 0., newSize.width(), newSize.height())
- styleMask:[window styleMask]].size;
-}
-
-- (NSSize)windowWillResize:(NSWindow *)windowToResize toSize:(NSSize)proposedFrameSize
-{
- QWidget *qwidget = m_windowHash->value(windowToResize);
- return [self closestAcceptableSizeForWidget:qwidget window:windowToResize
- withNewSize:[NSWindow contentRectForFrameRect:
- NSMakeRect(0, 0,
- proposedFrameSize.width,
- proposedFrameSize.height)
- styleMask:[windowToResize styleMask]].size];
-}
-
-- (NSSize)drawerWillResizeContents:(NSDrawer *)sender toSize:(NSSize)contentSize
-{
- QWidget *qwidget = m_drawerHash->value(sender);
- return [self closestAcceptableSizeForWidget:qwidget window:nil withNewSize:contentSize];
-}
-
--(void)windowDidMiniaturize:(NSNotification*)notification
-{
- QWidget *qwidget = m_windowHash->value([notification object]);
- if (!qwidget->isMinimized()) {
- QWidgetData *widgetData = qt_qwidget_data(qwidget);
- widgetData->window_state = widgetData->window_state | Qt::WindowMinimized;
- QWindowStateChangeEvent e(Qt::WindowStates(widgetData->window_state & ~Qt::WindowMinimized));
- qt_sendSpontaneousEvent(qwidget, &e);
- }
- // Send hide to match Qt on X11 and Windows
- QEvent e(QEvent::Hide);
- qt_sendSpontaneousEvent(qwidget, &e);
-}
-
-- (void)windowDidResize:(NSNotification *)notification
-{
- NSWindow *window = [notification object];
- QWidget *qwidget = m_windowHash->value(window);
- QWidgetData *widgetData = qt_qwidget_data(qwidget);
- if (!(qwidget->windowState() & (Qt::WindowMaximized | Qt::WindowFullScreen)) && [window isZoomed]) {
- widgetData->window_state = widgetData->window_state | Qt::WindowMaximized;
- QWindowStateChangeEvent e(Qt::WindowStates(widgetData->window_state
- & ~Qt::WindowMaximized));
- qt_sendSpontaneousEvent(qwidget, &e);
- } else {
- widgetData->window_state = widgetData->window_state & ~Qt::WindowMaximized;
- QWindowStateChangeEvent e(Qt::WindowStates(widgetData->window_state
- | Qt::WindowMaximized));
- qt_sendSpontaneousEvent(qwidget, &e);
- }
- NSRect rect = [[window contentView] frame];
- const QSize newSize(rect.size.width, rect.size.height);
- const QSize &oldSize = widgetData->crect.size();
- if (newSize != oldSize) {
- QWidgetPrivate::qt_mac_update_sizer(qwidget);
- [self syncSizeForWidget:qwidget toSize:newSize fromSize:oldSize];
- }
-
- // We force the repaint to be synchronized with the resize of the window.
- // Otherwise, the resize looks sluggish because we paint one event loop later.
- if ([[window contentView] inLiveResize]) {
- qwidget->repaint();
-
- // We need to repaint the toolbar as well.
- QMainWindow* mWindow = qobject_cast<QMainWindow*>(qwidget->window());
- if (mWindow) {
- QMainWindowLayout *mLayout = qobject_cast<QMainWindowLayout*>(mWindow->layout());
- QList<QToolBar *> toolbarList = mLayout->qtoolbarsInUnifiedToolbarList;
-
- for (int i = 0; i < toolbarList.size(); ++i) {
- QToolBar* toolbar = toolbarList.at(i);
- toolbar->repaint();
- }
- }
- }
-}
-
-- (void)windowDidMove:(NSNotification *)notification
-{
- // The code underneath needs to translate the window location
- // from bottom left (which is the origin used by Cocoa) to
- // upper left (which is the origin used by Qt):
- NSWindow *window = [notification object];
- NSRect newRect = [window frame];
- QWidget *qwidget = m_windowHash->value(window);
- QPoint qtPoint = flipPoint(NSMakePoint(newRect.origin.x,
- newRect.origin.y + newRect.size.height)).toPoint();
- const QRect &oldRect = qwidget->frameGeometry();
-
- if (qtPoint.x() != oldRect.x() || qtPoint.y() != oldRect.y()) {
- QWidgetData *widgetData = qt_qwidget_data(qwidget);
- QRect oldCRect = widgetData->crect;
- QWidgetPrivate *widgetPrivate = qt_widget_private(qwidget);
- const QRect &fStrut = widgetPrivate->frameStrut();
- widgetData->crect.moveTo(qtPoint.x() + fStrut.left(), qtPoint.y() + fStrut.top());
- if (!qwidget->isVisible()) {
- qwidget->setAttribute(Qt::WA_PendingMoveEvent, true);
- } else {
- QMoveEvent qme(qtPoint, oldRect.topLeft());
- qt_sendSpontaneousEvent(qwidget, &qme);
- }
- }
-}
-
--(BOOL)windowShouldClose:(id)windowThatWantsToClose
-{
- QWidget *qwidget = m_windowHash->value(windowThatWantsToClose);
- QScopedLoopLevelCounter counter(qt_widget_private(qwidget)->threadData);
- return qt_widget_private(qwidget)->close_helper(QWidgetPrivate::CloseWithSpontaneousEvent);
-}
-
--(void)windowDidDeminiaturize:(NSNotification *)notification
-{
- QWidget *qwidget = m_windowHash->value([notification object]);
- QWidgetData *widgetData = qt_qwidget_data(qwidget);
- Qt::WindowStates currState = Qt::WindowStates(widgetData->window_state);
- Qt::WindowStates newState = currState;
- if (currState & Qt::WindowMinimized)
- newState &= ~Qt::WindowMinimized;
- if (!(currState & Qt::WindowActive))
- newState |= Qt::WindowActive;
- if (newState != currState) {
- widgetData->window_state = newState;
- QWindowStateChangeEvent e(currState);
- qt_sendSpontaneousEvent(qwidget, &e);
- }
- QShowEvent qse;
- qt_sendSpontaneousEvent(qwidget, &qse);
-}
-
--(void)windowDidBecomeMain:(NSNotification*)notification
-{
- QWidget *qwidget = m_windowHash->value([notification object]);
- Q_ASSERT(qwidget);
- onApplicationWindowChangedActivation(qwidget, true);
-}
-
--(void)windowDidResignMain:(NSNotification*)notification
-{
- QWidget *qwidget = m_windowHash->value([notification object]);
- Q_ASSERT(qwidget);
- onApplicationWindowChangedActivation(qwidget, false);
-}
-
-// These are the same as main, but they are probably better to keep separate since there is a
-// tiny difference between main and key windows.
--(void)windowDidBecomeKey:(NSNotification*)notification
-{
- QWidget *qwidget = m_windowHash->value([notification object]);
- Q_ASSERT(qwidget);
- onApplicationWindowChangedActivation(qwidget, true);
-}
-
--(void)windowDidResignKey:(NSNotification*)notification
-{
- QWidget *qwidget = m_windowHash->value([notification object]);
- Q_ASSERT(qwidget);
- onApplicationWindowChangedActivation(qwidget, false);
-}
-
--(QWidget *)qt_qwidgetForWindow:(NSWindow *)window
-{
- return m_windowHash->value(window);
-}
-
-- (BOOL)windowShouldZoom:(NSWindow *)window toFrame:(NSRect)newFrame
-{
- Q_UNUSED(newFrame);
- // saving the current window geometry before the window is maximized
- QWidget *qwidget = m_windowHash->value(window);
- QWidgetPrivate *widgetPrivate = qt_widget_private(qwidget);
- if (qwidget->isWindow()) {
- if(qwidget->windowState() & Qt::WindowMaximized) {
- // Restoring
- widgetPrivate->topData()->wasMaximized = false;
- } else {
- // Maximizing
- widgetPrivate->topData()->normalGeometry = qwidget->geometry();
- // If the window was maximized we need to update the coordinates since now it will start at 0,0.
- // We do this in a special field that is only used when not restoring but manually resizing the window.
- // Since the coordinates are fixed we just set a boolean flag.
- widgetPrivate->topData()->wasMaximized = true;
- }
- }
- return YES;
-}
-
-- (NSRect)windowWillUseStandardFrame:(NSWindow *)window defaultFrame:(NSRect)defaultFrame
-{
- NSRect frameToReturn = defaultFrame;
- QWidget *qwidget = m_windowHash->value(window);
- QSizeF size = qwidget->maximumSize();
- NSRect windowFrameRect = [window frame];
- NSRect viewFrameRect = [[window contentView] frame];
- // consider additional size required for titlebar & frame
- frameToReturn.size.width = qMin<CGFloat>(frameToReturn.size.width,
- size.width()+(windowFrameRect.size.width - viewFrameRect.size.width));
- frameToReturn.size.height = qMin<CGFloat>(frameToReturn.size.height,
- size.height()+(windowFrameRect.size.height - viewFrameRect.size.height));
- return frameToReturn;
-}
-
-- (void)becomeDelegteForWindow:(NSWindow *)window widget:(QWidget *)widget
-{
- m_windowHash->insert(window, widget);
- [window setDelegate:self];
-}
-
-- (void)resignDelegateForWindow:(NSWindow *)window
-{
- [window setDelegate:nil];
- m_windowHash->remove(window);
-}
-
-- (void)becomeDelegateForDrawer:(NSDrawer *)drawer widget:(QWidget *)widget
-{
- m_drawerHash->insert(drawer, widget);
- [drawer setDelegate:self];
- NSWindow *window = [[drawer contentView] window];
- [self becomeDelegteForWindow:window widget:widget];
-}
-
-- (void)resignDelegateForDrawer:(NSDrawer *)drawer
-{
- QWidget *widget = m_drawerHash->value(drawer);
- [drawer setDelegate:nil];
- if (widget)
- [self resignDelegateForWindow:[[drawer contentView] window]];
- m_drawerHash->remove(drawer);
-}
-
-- (BOOL)window:(NSWindow *)window shouldPopUpDocumentPathMenu:(NSMenu *)menu
-{
- Q_UNUSED(menu);
- QWidget *qwidget = m_windowHash->value(window);
- if (qwidget && !qwidget->windowFilePath().isEmpty()) {
- return YES;
- }
- return NO;
-}
-
-- (BOOL)window:(NSWindow *)window shouldDragDocumentWithEvent:(NSEvent *)event
- from:(NSPoint)dragImageLocation
- withPasteboard:(NSPasteboard *)pasteboard
-{
- Q_UNUSED(event);
- Q_UNUSED(dragImageLocation);
- Q_UNUSED(pasteboard);
- QWidget *qwidget = m_windowHash->value(window);
- if (qwidget && !qwidget->windowFilePath().isEmpty()) {
- return YES;
- }
- return NO;
-}
-
-- (void)syncContentViewFrame: (NSNotification *)notification
-{
- NSView *cView = [notification object];
- if (cView) {
- NSWindow *window = [cView window];
- QWidget *qwidget = m_windowHash->value(window);
- if (qwidget) {
- QWidgetData *widgetData = qt_qwidget_data(qwidget);
- NSRect rect = [cView frame];
- const QSize newSize(rect.size.width, rect.size.height);
- const QSize &oldSize = widgetData->crect.size();
- if (newSize != oldSize) {
- [self syncSizeForWidget:qwidget toSize:newSize fromSize:oldSize];
- }
- }
-
- }
-}
-
-@end
diff --git a/src/widgets/platforms/mac/qcocoawindowdelegate_mac_p.h b/src/widgets/platforms/mac/qcocoawindowdelegate_mac_p.h
deleted file mode 100644
index 27906e116c..0000000000
--- a/src/widgets/platforms/mac/qcocoawindowdelegate_mac_p.h
+++ /dev/null
@@ -1,108 +0,0 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
-
-//
-// 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 "qmacdefines_mac.h"
-
-#import <Cocoa/Cocoa.h>
-
-QT_BEGIN_NAMESPACE
-template <class Key, class T> class QHash;
-QT_END_NAMESPACE
-using QT_PREPEND_NAMESPACE(QHash);
-QT_FORWARD_DECLARE_CLASS(QWidget)
-QT_FORWARD_DECLARE_CLASS(QSize)
-QT_FORWARD_DECLARE_CLASS(QWidgetData)
-
-#if MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_5
-@protocol NSWindowDelegate <NSObject>
-- (NSSize)windowWillResize:(NSWindow *)window toSize:(NSSize)proposedFrameSize;
-- (void)windowDidMiniaturize:(NSNotification*)notification;
-- (void)windowDidResize:(NSNotification *)notification;
-- (NSRect)windowWillUseStandardFrame:(NSWindow *)window defaultFrame:(NSRect)defaultFrame;
-- (void)windowDidMove:(NSNotification *)notification;
-- (BOOL)windowShouldClose:(id)window;
-- (void)windowDidDeminiaturize:(NSNotification *)notification;
-- (void)windowDidBecomeMain:(NSNotification*)notification;
-- (void)windowDidResignMain:(NSNotification*)notification;
-- (void)windowDidBecomeKey:(NSNotification*)notification;
-- (void)windowDidResignKey:(NSNotification*)notification;
-- (BOOL)window:(NSWindow *)window shouldPopUpDocumentPathMenu:(NSMenu *)menu;
-- (BOOL)window:(NSWindow *)window shouldDragDocumentWithEvent:(NSEvent *)event from:(NSPoint)dragImageLocation withPasteboard:(NSPasteboard *)pasteboard;
-- (BOOL)windowShouldZoom:(NSWindow *)window toFrame:(NSRect)newFrame;
-@end
-
-@protocol NSDrawerDelegate <NSObject>
-- (NSSize)drawerWillResizeContents:(NSDrawer *)sender toSize:(NSSize)contentSize;
-@end
-
-#endif
-
-
-
-@interface QT_MANGLE_NAMESPACE(QCocoaWindowDelegate) : NSObject<NSWindowDelegate, NSDrawerDelegate> {
- QHash<NSWindow *, QWidget *> *m_windowHash;
- QHash<NSDrawer *, QWidget *> *m_drawerHash;
-}
-+ (QT_MANGLE_NAMESPACE(QCocoaWindowDelegate)*)sharedDelegate;
-- (void)becomeDelegteForWindow:(NSWindow *)window widget:(QWidget *)widget;
-- (void)resignDelegateForWindow:(NSWindow *)window;
-- (void)becomeDelegateForDrawer:(NSDrawer *)drawer widget:(QWidget *)widget;
-- (void)resignDelegateForDrawer:(NSDrawer *)drawer;
-- (void)dumpMaximizedStateforWidget:(QWidget*)qwidget window:(NSWindow *)window;
-- (void)syncSizeForWidget:(QWidget *)qwidget
- toSize:(const QSize &)newSize
- fromSize:(const QSize &)oldSize;
-- (NSSize)closestAcceptableSizeForWidget:(QWidget *)qwidget
- window:(NSWindow *)window withNewSize:(NSSize)proposedSize;
-- (QWidget *)qt_qwidgetForWindow:(NSWindow *)window;
-- (void)syncContentViewFrame: (NSNotification *)notification;
-@end
diff --git a/src/widgets/platforms/mac/qcolormap_mac.cpp b/src/widgets/platforms/mac/qcolormap_mac.cpp
deleted file mode 100644
index de920d7144..0000000000
--- a/src/widgets/platforms/mac/qcolormap_mac.cpp
+++ /dev/null
@@ -1,111 +0,0 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
-
-#include "qcolormap.h"
-#include "qcolor.h"
-
-QT_BEGIN_NAMESPACE
-
-class QColormapPrivate
-{
-public:
- inline QColormapPrivate()
- : ref(1)
- { }
-
- QAtomicInt ref;
-};
-static QColormap *qt_mac_global_map = 0;
-
-void QColormap::initialize()
-{
- qt_mac_global_map = new QColormap;
-}
-
-void QColormap::cleanup()
-{
- delete qt_mac_global_map;
- qt_mac_global_map = 0;
-}
-
-QColormap QColormap::instance(int)
-{
- return *qt_mac_global_map;
-}
-
-QColormap::QColormap() : d(new QColormapPrivate)
-{}
-
-QColormap::QColormap(const QColormap &colormap) :d (colormap.d)
-{ d->ref.ref(); }
-
-QColormap::~QColormap()
-{
- if (!d->ref.deref())
- delete d;
-}
-
-QColormap::Mode QColormap::mode() const
-{ return QColormap::Direct; }
-
-int QColormap::depth() const
-{
- return 32;
-}
-
-int QColormap::size() const
-{
- return -1;
-}
-
-uint QColormap::pixel(const QColor &color) const
-{ return color.rgba(); }
-
-const QColor QColormap::colorAt(uint pixel) const
-{ return QColor(pixel); }
-
-const QVector<QColor> QColormap::colormap() const
-{ return QVector<QColor>(); }
-
-QColormap &QColormap::operator=(const QColormap &colormap)
-{ qAtomicAssign(d, colormap.d); return *this; }
-
-QT_END_NAMESPACE
diff --git a/src/widgets/platforms/mac/qdesktopwidget_mac.mm b/src/widgets/platforms/mac/qdesktopwidget_mac.mm
deleted file mode 100644
index 9869eeeab2..0000000000
--- a/src/widgets/platforms/mac/qdesktopwidget_mac.mm
+++ /dev/null
@@ -1,257 +0,0 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
-
-/****************************************************************************
-**
-** Copyright (c) 2007-2008, Apple, Inc.
-**
-** All rights reserved.
-**
-** Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are met:
-**
-** * Redistributions of source code must retain the above copyright notice,
-** this list of conditions and the following disclaimer.
-**
-** * Redistributions in binary form must reproduce the above copyright notice,
-** this list of conditions and the following disclaimer in the documentation
-** and/or other materials provided with the distribution.
-**
-** * Neither the name of Apple, Inc. nor the names of its contributors
-** may be used to endorse or promote products derived from this software
-** without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-** CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-** EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-** PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-** PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-** LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-** NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-** SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-**
-****************************************************************************/
-
-#import <Cocoa/Cocoa.h>
-
-#include "qapplication.h"
-#include "qdesktopwidget.h"
-#include <private/qt_mac_p.h>
-#include "qwidget_p.h"
-#include <private/qt_cocoa_helpers_mac_p.h>
-#include <private/qdesktopwidget_mac_p.h>
-
-QT_BEGIN_NAMESPACE
-
-QT_USE_NAMESPACE
-
-/*****************************************************************************
- Externals
- *****************************************************************************/
-
-/*****************************************************************************
- QDesktopWidget member functions
- *****************************************************************************/
-
-Q_GLOBAL_STATIC(QDesktopWidgetImplementation, qdesktopWidgetImplementation)
-
-QDesktopWidgetImplementation::QDesktopWidgetImplementation()
- : appScreen(0)
-{
- onResize();
-}
-
-QDesktopWidgetImplementation::~QDesktopWidgetImplementation()
-{
-}
-
-QDesktopWidgetImplementation *QDesktopWidgetImplementation::instance()
-{
- return qdesktopWidgetImplementation();
-}
-
-QRect QDesktopWidgetImplementation::availableRect(int screenIndex) const
-{
- if (screenIndex < 0 || screenIndex >= screenCount)
- screenIndex = appScreen;
-
- return availableRects[screenIndex].toRect();
-}
-
-QRect QDesktopWidgetImplementation::screenRect(int screenIndex) const
-{
- if (screenIndex < 0 || screenIndex >= screenCount)
- screenIndex = appScreen;
-
- return screenRects[screenIndex].toRect();
-}
-
-void QDesktopWidgetImplementation::onResize()
-{
- QMacCocoaAutoReleasePool pool;
- NSArray *displays = [NSScreen screens];
- screenCount = [displays count];
-
- screenRects.clear();
- availableRects.clear();
- NSRect primaryRect = [[displays objectAtIndex:0] frame];
- for (int i = 0; i<screenCount; i++) {
- NSRect r = [[displays objectAtIndex:i] frame];
- int flippedY = - r.origin.y + // account for position offset and
- primaryRect.size.height - r.size.height; // height difference.
- screenRects.append(QRectF(r.origin.x, flippedY,
- r.size.width, r.size.height));
-
- r = [[displays objectAtIndex:i] visibleFrame];
- flippedY = - r.origin.y + // account for position offset and
- primaryRect.size.height - r.size.height; // height difference.
- availableRects.append(QRectF(r.origin.x, flippedY,
- r.size.width, r.size.height));
- }
-}
-
-
-
-QDesktopWidget::QDesktopWidget()
- : QWidget(0, Qt::Desktop)
-{
- setObjectName(QLatin1String("desktop"));
- setAttribute(Qt::WA_WState_Visible);
-}
-
-QDesktopWidget::~QDesktopWidget()
-{
-}
-
-bool QDesktopWidget::isVirtualDesktop() const
-{
- return true;
-}
-
-int QDesktopWidget::primaryScreen() const
-{
- return qdesktopWidgetImplementation()->appScreen;
-}
-
-int QDesktopWidget::numScreens() const
-{
- return qdesktopWidgetImplementation()->screenCount;
-}
-
-QWidget *QDesktopWidget::screen(int)
-{
- return this;
-}
-
-const QRect QDesktopWidget::availableGeometry(int screen) const
-{
- return qdesktopWidgetImplementation()->availableRect(screen);
-}
-
-const QRect QDesktopWidget::screenGeometry(int screen) const
-{
- return qdesktopWidgetImplementation()->screenRect(screen);
-}
-
-int QDesktopWidget::screenNumber(const QWidget *widget) const
-{
- QDesktopWidgetImplementation *d = qdesktopWidgetImplementation();
- if (!widget)
- return d->appScreen;
- QRect frame = widget->frameGeometry();
- if (!widget->isWindow())
- frame.moveTopLeft(widget->mapToGlobal(QPoint(0,0)));
- int maxSize = -1, maxScreen = -1;
- for (int i = 0; i < d->screenCount; ++i) {
- QRect rr = d->screenRect(i);
- QRect sect = rr.intersected(frame);
- int size = sect.width() * sect.height();
- if (size > maxSize && sect.width() > 0 && sect.height() > 0) {
- maxSize = size;
- maxScreen = i;
- }
- }
- return maxScreen;
-}
-
-int QDesktopWidget::screenNumber(const QPoint &point) const
-{
- QDesktopWidgetImplementation *d = qdesktopWidgetImplementation();
- int closestScreen = -1;
- int shortestDistance = INT_MAX;
- for (int i = 0; i < d->screenCount; ++i) {
- QRect rr = d->screenRect(i);
- int thisDistance = QWidgetPrivate::pointToRect(point, rr);
- if (thisDistance < shortestDistance) {
- shortestDistance = thisDistance;
- closestScreen = i;
- }
- }
- return closestScreen;
-}
-
-void QDesktopWidget::resizeEvent(QResizeEvent *)
-{
- QDesktopWidgetImplementation *d = qdesktopWidgetImplementation();
-
- const int oldScreenCount = d->screenCount;
- const QVector<QRectF> oldRects(d->screenRects);
- const QVector<QRectF> oldWorks(d->availableRects);
-
- d->onResize();
-
- for (int i = 0; i < qMin(oldScreenCount, d->screenCount); ++i) {
- if (oldRects.at(i) != d->screenRects.at(i))
- emit resized(i);
- }
- for (int i = 0; i < qMin(oldScreenCount, d->screenCount); ++i) {
- if (oldWorks.at(i) != d->availableRects.at(i))
- emit workAreaResized(i);
- }
-
- if (oldScreenCount != d->screenCount)
- emit screenCountChanged(d->screenCount);
-}
-
-QT_END_NAMESPACE
diff --git a/src/widgets/platforms/mac/qdesktopwidget_mac_p.h b/src/widgets/platforms/mac/qdesktopwidget_mac_p.h
deleted file mode 100644
index a2d7552120..0000000000
--- a/src/widgets/platforms/mac/qdesktopwidget_mac_p.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
-
-//
-// 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 <qrect.h>
-
-QT_BEGIN_NAMESPACE
-
-class QDesktopWidgetImplementation
-{
-public:
- QDesktopWidgetImplementation();
- ~QDesktopWidgetImplementation();
- static QDesktopWidgetImplementation *instance();
-
- int appScreen;
- int screenCount;
-
- QVector<QRectF> availableRects;
- QVector<QRectF> screenRects;
-
- QRect availableRect(int screenIndex) const;
- QRect screenRect(int screenIndex) const;
- void onResize();
-};
-
-QT_END_NAMESPACE
diff --git a/src/widgets/platforms/mac/qdnd_mac.mm b/src/widgets/platforms/mac/qdnd_mac.mm
deleted file mode 100644
index b5543024c0..0000000000
--- a/src/widgets/platforms/mac/qdnd_mac.mm
+++ /dev/null
@@ -1,261 +0,0 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
-
-#include "qapplication.h"
-#ifndef QT_NO_DRAGANDDROP
-#include "qbitmap.h"
-#include "qcursor.h"
-#include "qevent.h"
-#include "qpainter.h"
-#include "qurl.h"
-#include "qwidget.h"
-#include "qfile.h"
-#include "qfileinfo.h"
-#include <stdlib.h>
-#include <string.h>
-#ifndef QT_NO_ACCESSIBILITY
-# include "qaccessible.h"
-#endif
-
-#include <private/qapplication_p.h>
-#include <private/qwidget_p.h>
-#include <private/qdnd_p.h>
-#include <private/qt_mac_p.h>
-
-QT_BEGIN_NAMESPACE
-
-QT_USE_NAMESPACE
-
-QMacDndAnswerRecord qt_mac_dnd_answer_rec;
-
-/*****************************************************************************
- QDnD debug facilities
- *****************************************************************************/
-//#define DEBUG_DRAG_EVENTS
-//#define DEBUG_DRAG_PROMISES
-
-/*****************************************************************************
- QDnD globals
- *****************************************************************************/
-bool qt_mac_in_drag = false;
-
-/*****************************************************************************
- Externals
- *****************************************************************************/
-extern void qt_mac_send_modifiers_changed(quint32, QObject *); //qapplication_mac.cpp
-extern uint qGlobalPostedEventsCount(); //qapplication.cpp
-extern RgnHandle qt_mac_get_rgn(); // qregion_mac.cpp
-extern void qt_mac_dispose_rgn(RgnHandle); // qregion_mac.cpp
-/*****************************************************************************
- QDnD utility functions
- *****************************************************************************/
-
-//action management
-#ifdef DEBUG_DRAG_EVENTS
-# define MAP_MAC_ENUM(x) x, #x
-#else
-# define MAP_MAC_ENUM(x) x
-#endif
-struct mac_enum_mapper
-{
- int mac_code;
- int qt_code;
-#ifdef DEBUG_DRAG_EVENTS
- char *qt_desc;
-#endif
-};
-
-/*****************************************************************************
- DnD functions
- *****************************************************************************/
-bool QDropData::hasFormat_sys(const QString &mime) const
-{
- Q_UNUSED(mime);
- return false;
-}
-
-QVariant QDropData::retrieveData_sys(const QString &mime, QVariant::Type type) const
-{
- Q_UNUSED(mime);
- Q_UNUSED(type);
- return QVariant();
-}
-
-QStringList QDropData::formats_sys() const
-{
- return QStringList();
-}
-
-void QDragManager::timerEvent(QTimerEvent*)
-{
-}
-
-bool QDragManager::eventFilter(QObject *, QEvent *)
-{
- return false;
-}
-
-void QDragManager::updateCursor()
-{
-}
-
-void QDragManager::cancel(bool)
-{
- if(object) {
- beingCancelled = true;
- object = 0;
- }
-#ifndef QT_NO_ACCESSIBILITY
- QAccessible::updateAccessibility(this, 0, QAccessible::DragDropEnd);
-#endif
-}
-
-void QDragManager::move(const QPoint &)
-{
-}
-
-void QDragManager::drop()
-{
-}
-
-/**
- If a drop action is already set on the carbon event
- (from e.g. an earlier enter event), we insert the same
- action on the new Qt event that has yet to be sendt.
-*/
-static inline bool qt_mac_set_existing_drop_action(const DragRef &dragRef, QDropEvent &event)
-{
- Q_UNUSED(dragRef);
- Q_UNUSED(event);
- return false;
-}
-
-/**
- If an answer rect has been set on the event (after being sent
- to the global event processor), we store that rect so we can
- check if the mouse is in the same area upon next drag move event.
-*/
-void qt_mac_copy_answer_rect(const QDragMoveEvent &event)
-{
- if (!event.answerRect().isEmpty()) {
- qt_mac_dnd_answer_rec.rect = event.answerRect();
- qt_mac_dnd_answer_rec.buttons = event.mouseButtons();
- qt_mac_dnd_answer_rec.modifiers = event.keyboardModifiers();
- qt_mac_dnd_answer_rec.lastAction = event.dropAction();
- }
-}
-
-bool qt_mac_mouse_inside_answer_rect(QPoint mouse)
-{
- if (!qt_mac_dnd_answer_rec.rect.isEmpty()
- && qt_mac_dnd_answer_rec.rect.contains(mouse)
- && QApplication::mouseButtons() == qt_mac_dnd_answer_rec.buttons
- && QApplication::keyboardModifiers() == qt_mac_dnd_answer_rec.modifiers)
- return true;
- else
- return false;
-}
-
-bool QWidgetPrivate::qt_mac_dnd_event(uint kind, DragRef dragRef)
-{
- Q_UNUSED(kind);
- Q_UNUSED(dragRef);
- return false;
-}
-
-void QDragManager::updatePixmap()
-{
-}
-
-QCocoaDropData::QCocoaDropData(CFStringRef pasteboard)
- : QInternalMimeData()
-{
- NSString* pasteboardName = (NSString*)pasteboard;
- [pasteboardName retain];
- dropPasteboard = pasteboard;
-}
-
-QCocoaDropData::~QCocoaDropData()
-{
- NSString* pasteboardName = (NSString*)dropPasteboard;
- [pasteboardName release];
-}
-
-QStringList QCocoaDropData::formats_sys() const
-{
- QStringList formats;
- OSPasteboardRef board;
- if (PasteboardCreate(dropPasteboard, &board) != noErr) {
- qDebug("DnD: Cannot get PasteBoard!");
- return formats;
- }
- formats = QMacPasteboard(board, QMacPasteboardMime::MIME_DND).formats();
- return formats;
-}
-
-QVariant QCocoaDropData::retrieveData_sys(const QString &mimeType, QVariant::Type type) const
-{
- QVariant data;
- OSPasteboardRef board;
- if (PasteboardCreate(dropPasteboard, &board) != noErr) {
- qDebug("DnD: Cannot get PasteBoard!");
- return data;
- }
- data = QMacPasteboard(board, QMacPasteboardMime::MIME_DND).retrieveData(mimeType, type);
- CFRelease(board);
- return data;
-}
-
-bool QCocoaDropData::hasFormat_sys(const QString &mimeType) const
-{
- bool has = false;
- OSPasteboardRef board;
- if (PasteboardCreate(dropPasteboard, &board) != noErr) {
- qDebug("DnD: Cannot get PasteBoard!");
- return has;
- }
- has = QMacPasteboard(board, QMacPasteboardMime::MIME_DND).hasFormat(mimeType);
- CFRelease(board);
- return has;
-}
-
-#endif // QT_NO_DRAGANDDROP
-QT_END_NAMESPACE
diff --git a/src/widgets/platforms/mac/qeventdispatcher_mac.mm b/src/widgets/platforms/mac/qeventdispatcher_mac.mm
deleted file mode 100644
index 0056ebeca8..0000000000
--- a/src/widgets/platforms/mac/qeventdispatcher_mac.mm
+++ /dev/null
@@ -1,1127 +0,0 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
-
-/****************************************************************************
-**
-** Copyright (c) 2007-2008, Apple, Inc.
-**
-** All rights reserved.
-**
-** Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are met:
-**
-** * Redistributions of source code must retain the above copyright notice,
-** this list of conditions and the following disclaimer.
-**
-** * Redistributions in binary form must reproduce the above copyright notice,
-** this list of conditions and the following disclaimer in the documentation
-** and/or other materials provided with the distribution.
-**
-** * Neither the name of Apple, Inc. nor the names of its contributors
-** may be used to endorse or promote products derived from this software
-** without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-** CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-** EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-** PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-** PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-** LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-** NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-** SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-**
-****************************************************************************/
-
-#include "qplatformdefs.h"
-#include "private/qt_mac_p.h"
-#include "qeventdispatcher_mac_p.h"
-#include "qapplication.h"
-#include "qevent.h"
-#include "qdialog.h"
-#include "qhash.h"
-#include "qsocketnotifier.h"
-#include "private/qwidget_p.h"
-#include "private/qthread_p.h"
-#include "private/qapplication_p.h"
-
-#include <private/qcocoaapplication_mac_p.h>
-#include "private/qt_cocoa_helpers_mac_p.h"
-
-#ifndef QT_NO_THREAD
-# include "qmutex.h"
-#endif
-
-QT_BEGIN_NAMESPACE
-
-QT_USE_NAMESPACE
-
-/*****************************************************************************
- Externals
- *****************************************************************************/
-extern void qt_event_request_timer(MacTimerInfo *); //qapplication_mac.cpp
-extern MacTimerInfo *qt_event_get_timer(EventRef); //qapplication_mac.cpp
-extern void qt_event_request_select(QEventDispatcherMac *); //qapplication_mac.cpp
-extern void qt_event_request_updates(); //qapplication_mac.cpp
-extern OSWindowRef qt_mac_window_for(const QWidget *); //qwidget_mac.cpp
-extern bool qt_is_gui_used; //qapplication.cpp
-extern bool qt_sendSpontaneousEvent(QObject*, QEvent*); // qapplication.cpp
-extern bool qt_mac_is_macsheet(const QWidget *); //qwidget_mac.cpp
-
-static inline CFRunLoopRef mainRunLoop()
-{
- return CFRunLoopGetMain();
-}
-
-/*****************************************************************************
- Timers stuff
- *****************************************************************************/
-
-/* timer call back */
-void QEventDispatcherMacPrivate::activateTimer(CFRunLoopTimerRef, void *info)
-{
- int timerID =
-#ifdef Q_OS_MAC64
- qint64(info);
-#else
- int(info);
-#endif
-
- MacTimerInfo *tmr;
- tmr = macTimerHash.value(timerID);
- if (tmr == 0 || tmr->pending == true)
- return; // Can't send another timer event if it's pending.
-
-
- if (blockSendPostedEvents) {
- QCoreApplication::postEvent(tmr->obj, new QTimerEvent(tmr->id));
- } else {
- tmr->pending = true;
- QTimerEvent e(tmr->id);
- qt_sendSpontaneousEvent(tmr->obj, &e);
- // Get the value again in case the timer gets unregistered during the sendEvent.
- tmr = macTimerHash.value(timerID);
- if (tmr != 0)
- tmr->pending = false;
- }
-
-}
-
-void QEventDispatcherMac::registerTimer(int timerId, int interval, QObject *obj)
-{
-#ifndef QT_NO_DEBUG
- if (timerId < 1 || interval < 0 || !obj) {
- qWarning("QEventDispatcherMac::registerTimer: invalid arguments");
- return;
- } else if (obj->thread() != thread() || thread() != QThread::currentThread()) {
- qWarning("QObject::startTimer: timers cannot be started from another thread");
- return;
- }
-#endif
-
- MacTimerInfo *t = new MacTimerInfo();
- t->id = timerId;
- t->interval = interval;
- t->obj = obj;
- t->runLoopTimer = 0;
- t->pending = false;
-
- CFAbsoluteTime fireDate = CFAbsoluteTimeGetCurrent();
- CFTimeInterval cfinterval = qMax(CFTimeInterval(interval) / 1000, 0.0000001);
- fireDate += cfinterval;
- QEventDispatcherMacPrivate::macTimerHash.insert(timerId, t);
- CFRunLoopTimerContext info = { 0, (void *)timerId, 0, 0, 0 };
- t->runLoopTimer = CFRunLoopTimerCreate(0, fireDate, cfinterval, 0, 0,
- QEventDispatcherMacPrivate::activateTimer, &info);
- if (t->runLoopTimer == 0) {
- qFatal("QEventDispatcherMac::registerTimer: Cannot create timer");
- }
- CFRunLoopAddTimer(mainRunLoop(), t->runLoopTimer, kCFRunLoopCommonModes);
-}
-
-bool QEventDispatcherMac::unregisterTimer(int identifier)
-{
-#ifndef QT_NO_DEBUG
- if (identifier < 1) {
- qWarning("QEventDispatcherMac::unregisterTimer: invalid argument");
- return false;
- } else if (thread() != QThread::currentThread()) {
- qWarning("QObject::killTimer: timers cannot be stopped from another thread");
- return false;
- }
-#endif
- if (identifier <= 0)
- return false; // not init'd or invalid timer
-
- MacTimerInfo *timerInfo = QEventDispatcherMacPrivate::macTimerHash.take(identifier);
- if (timerInfo == 0)
- return false;
-
- if (!QObjectPrivate::get(timerInfo->obj)->inThreadChangeEvent)
- QAbstractEventDispatcherPrivate::releaseTimerId(identifier);
- CFRunLoopTimerInvalidate(timerInfo->runLoopTimer);
- CFRelease(timerInfo->runLoopTimer);
- delete timerInfo;
-
- return true;
-}
-
-bool QEventDispatcherMac::unregisterTimers(QObject *obj)
-{
-#ifndef QT_NO_DEBUG
- if (!obj) {
- qWarning("QEventDispatcherMac::unregisterTimers: invalid argument");
- return false;
- } else if (obj->thread() != thread() || thread() != QThread::currentThread()) {
- qWarning("QObject::killTimers: timers cannot be stopped from another thread");
- return false;
- }
-#endif
-
- MacTimerHash::iterator it = QEventDispatcherMacPrivate::macTimerHash.begin();
- while (it != QEventDispatcherMacPrivate::macTimerHash.end()) {
- MacTimerInfo *timerInfo = it.value();
- if (timerInfo->obj != obj) {
- ++it;
- } else {
- if (!QObjectPrivate::get(timerInfo->obj)->inThreadChangeEvent)
- QAbstractEventDispatcherPrivate::releaseTimerId(timerInfo->id);
- CFRunLoopTimerInvalidate(timerInfo->runLoopTimer);
- CFRelease(timerInfo->runLoopTimer);
- delete timerInfo;
- it = QEventDispatcherMacPrivate::macTimerHash.erase(it);
- }
- }
- return true;
-}
-
-QList<QEventDispatcherMac::TimerInfo>
-QEventDispatcherMac::registeredTimers(QObject *object) const
-{
- if (!object) {
- qWarning("QEventDispatcherMac:registeredTimers: invalid argument");
- return QList<TimerInfo>();
- }
-
- QList<TimerInfo> list;
-
- MacTimerHash::const_iterator it = QEventDispatcherMacPrivate::macTimerHash.constBegin();
- while (it != QEventDispatcherMacPrivate::macTimerHash.constEnd()) {
- MacTimerInfo *t = it.value();
- if (t->obj == object)
- list << TimerInfo(t->id, t->interval);
- ++it;
- }
- return list;
-}
-
-/**************************************************************************
- Socket Notifiers
- *************************************************************************/
-void qt_mac_socket_callback(CFSocketRef s, CFSocketCallBackType callbackType, CFDataRef,
- const void *, void *info) {
- QEventDispatcherMacPrivate *const eventDispatcher
- = static_cast<QEventDispatcherMacPrivate *>(info);
- int nativeSocket = CFSocketGetNative(s);
- MacSocketInfo *socketInfo = eventDispatcher->macSockets.value(nativeSocket);
- QEvent notifierEvent(QEvent::SockAct);
-
- // There is a race condition that happen where we disable the notifier and
- // the kernel still has a notification to pass on. We then get this
- // notification after we've successfully disabled the CFSocket, but our Qt
- // notifier is now gone. The upshot is we have to check the notifier
- // everytime.
- if (callbackType == kCFSocketReadCallBack) {
- if (socketInfo->readNotifier)
- QApplication::sendEvent(socketInfo->readNotifier, &notifierEvent);
- } else if (callbackType == kCFSocketWriteCallBack) {
- if (socketInfo->writeNotifier)
- QApplication::sendEvent(socketInfo->writeNotifier, &notifierEvent);
- }
-}
-
-/*
- Adds a loop source for the given socket to the current run loop.
-*/
-CFRunLoopSourceRef qt_mac_add_socket_to_runloop(const CFSocketRef socket)
-{
- CFRunLoopSourceRef loopSource = CFSocketCreateRunLoopSource(kCFAllocatorDefault, socket, 0);
- if (!loopSource)
- return 0;
-
- CFRunLoopAddSource(mainRunLoop(), loopSource, kCFRunLoopCommonModes);
- return loopSource;
-}
-
-/*
- Removes the loop source for the given socket from the current run loop.
-*/
-void qt_mac_remove_socket_from_runloop(const CFSocketRef socket, CFRunLoopSourceRef runloop)
-{
- Q_ASSERT(runloop);
- CFRunLoopRemoveSource(mainRunLoop(), runloop, kCFRunLoopCommonModes);
- CFSocketDisableCallBacks(socket, kCFSocketReadCallBack);
- CFSocketDisableCallBacks(socket, kCFSocketWriteCallBack);
- CFRunLoopSourceInvalidate(runloop);
-}
-
-/*
- Register a QSocketNotifier with the mac event system by creating a CFSocket with
- with a read/write callback.
-
- Qt has separate socket notifiers for reading and writing, but on the mac there is
- a limitation of one CFSocket object for each native socket.
-*/
-void QEventDispatcherMac::registerSocketNotifier(QSocketNotifier *notifier)
-{
- Q_ASSERT(notifier);
- int nativeSocket = notifier->socket();
- int type = notifier->type();
-#ifndef QT_NO_DEBUG
- if (nativeSocket < 0 || nativeSocket > FD_SETSIZE) {
- qWarning("QSocketNotifier: Internal error");
- return;
- } else if (notifier->thread() != thread()
- || thread() != QThread::currentThread()) {
- qWarning("QSocketNotifier: socket notifiers cannot be enabled from another thread");
- return;
- }
-#endif
-
- Q_D(QEventDispatcherMac);
-
- if (type == QSocketNotifier::Exception) {
- qWarning("QSocketNotifier::Exception is not supported on Mac OS X");
- return;
- }
-
- // Check if we have a CFSocket for the native socket, create one if not.
- MacSocketInfo *socketInfo = d->macSockets.value(nativeSocket);
- if (!socketInfo) {
- socketInfo = new MacSocketInfo();
-
- // Create CFSocket, specify that we want both read and write callbacks (the callbacks
- // are enabled/disabled later on).
- const int callbackTypes = kCFSocketReadCallBack | kCFSocketWriteCallBack;
- CFSocketContext context = {0, d, 0, 0, 0};
- socketInfo->socket = CFSocketCreateWithNative(kCFAllocatorDefault, nativeSocket, callbackTypes, qt_mac_socket_callback, &context);
- if (CFSocketIsValid(socketInfo->socket) == false) {
- qWarning("QEventDispatcherMac::registerSocketNotifier: Failed to create CFSocket");
- return;
- }
-
- CFOptionFlags flags = CFSocketGetSocketFlags(socketInfo->socket);
- flags |= kCFSocketAutomaticallyReenableWriteCallBack; //QSocketNotifier stays enabled after a write
- flags &= ~kCFSocketCloseOnInvalidate; //QSocketNotifier doesn't close the socket upon destruction/invalidation
- CFSocketSetSocketFlags(socketInfo->socket, flags);
-
- // Add CFSocket to runloop.
- if(!(socketInfo->runloop = qt_mac_add_socket_to_runloop(socketInfo->socket))) {
- qWarning("QEventDispatcherMac::registerSocketNotifier: Failed to add CFSocket to runloop");
- CFSocketInvalidate(socketInfo->socket);
- CFRelease(socketInfo->socket);
- return;
- }
-
- // Disable both callback types by default. This must be done after
- // we add the CFSocket to the runloop, or else these calls will have
- // no effect.
- CFSocketDisableCallBacks(socketInfo->socket, kCFSocketReadCallBack);
- CFSocketDisableCallBacks(socketInfo->socket, kCFSocketWriteCallBack);
-
- d->macSockets.insert(nativeSocket, socketInfo);
- }
-
- // Increment read/write counters and select enable callbacks if necessary.
- if (type == QSocketNotifier::Read) {
- Q_ASSERT(socketInfo->readNotifier == 0);
- socketInfo->readNotifier = notifier;
- CFSocketEnableCallBacks(socketInfo->socket, kCFSocketReadCallBack);
- } else if (type == QSocketNotifier::Write) {
- Q_ASSERT(socketInfo->writeNotifier == 0);
- socketInfo->writeNotifier = notifier;
- CFSocketEnableCallBacks(socketInfo->socket, kCFSocketWriteCallBack);
- }
-}
-
-/*
- Unregister QSocketNotifer. The CFSocket correspoding to this notifier is
- removed from the runloop of this is the last notifier that users
- that CFSocket.
-*/
-void QEventDispatcherMac::unregisterSocketNotifier(QSocketNotifier *notifier)
-{
- Q_ASSERT(notifier);
- int nativeSocket = notifier->socket();
- int type = notifier->type();
-#ifndef QT_NO_DEBUG
- if (nativeSocket < 0 || nativeSocket > FD_SETSIZE) {
- qWarning("QSocketNotifier: Internal error");
- return;
- } else if (notifier->thread() != thread() || thread() != QThread::currentThread()) {
- qWarning("QSocketNotifier: socket notifiers cannot be disabled from another thread");
- return;
- }
-#endif
-
- Q_D(QEventDispatcherMac);
-
- if (type == QSocketNotifier::Exception) {
- qWarning("QSocketNotifier::Exception is not supported on Mac OS X");
- return;
- }
- MacSocketInfo *socketInfo = d->macSockets.value(nativeSocket);
- if (!socketInfo) {
- qWarning("QEventDispatcherMac::unregisterSocketNotifier: Tried to unregister a not registered notifier");
- return;
- }
-
- // Decrement read/write counters and disable callbacks if necessary.
- if (type == QSocketNotifier::Read) {
- Q_ASSERT(notifier == socketInfo->readNotifier);
- socketInfo->readNotifier = 0;
- CFSocketDisableCallBacks(socketInfo->socket, kCFSocketReadCallBack);
- } else if (type == QSocketNotifier::Write) {
- Q_ASSERT(notifier == socketInfo->writeNotifier);
- socketInfo->writeNotifier = 0;
- CFSocketDisableCallBacks(socketInfo->socket, kCFSocketWriteCallBack);
- }
-
- // Remove CFSocket from runloop if this was the last QSocketNotifier.
- if (socketInfo->readNotifier == 0 && socketInfo->writeNotifier == 0) {
- if (CFSocketIsValid(socketInfo->socket))
- qt_mac_remove_socket_from_runloop(socketInfo->socket, socketInfo->runloop);
- CFRunLoopSourceInvalidate(socketInfo->runloop);
- CFRelease(socketInfo->runloop);
- CFSocketInvalidate(socketInfo->socket);
- CFRelease(socketInfo->socket);
- delete socketInfo;
- d->macSockets.remove(nativeSocket);
- }
-}
-
-bool QEventDispatcherMac::hasPendingEvents()
-{
- extern uint qGlobalPostedEventsCount();
- return qGlobalPostedEventsCount() || (qt_is_gui_used && GetNumEventsInQueue(GetMainEventQueue()));
-}
-
-
-static bool qt_mac_send_event(QEventLoop::ProcessEventsFlags, OSEventRef event, OSWindowRef pt)
-{
- if (pt)
- [pt sendEvent:event];
- else
- [NSApp sendEvent:event];
- return true;
-}
-
-static bool IsMouseOrKeyEvent( NSEvent* event )
-{
- bool result = false;
-
- switch( [event type] )
- {
- case NSLeftMouseDown:
- case NSLeftMouseUp:
- case NSRightMouseDown:
- case NSRightMouseUp:
- case NSMouseMoved: // ??
- case NSLeftMouseDragged:
- case NSRightMouseDragged:
- case NSMouseEntered:
- case NSMouseExited:
- case NSKeyDown:
- case NSKeyUp:
- case NSFlagsChanged: // key modifiers changed?
- case NSCursorUpdate: // ??
- case NSScrollWheel:
- case NSTabletPoint:
- case NSTabletProximity:
- case NSOtherMouseDown:
- case NSOtherMouseUp:
- case NSOtherMouseDragged:
-#ifndef QT_NO_GESTURES
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
- case NSEventTypeGesture: // touch events
- case NSEventTypeMagnify:
- case NSEventTypeSwipe:
- case NSEventTypeRotate:
- case NSEventTypeBeginGesture:
- case NSEventTypeEndGesture:
-#endif
-#endif // QT_NO_GESTURES
- result = true;
- break;
-
- default:
- break;
- }
- return result;
-}
-
-static inline void qt_mac_waitForMoreEvents()
-{
- // If no event exist in the cocoa event que, wait
- // (and free up cpu time) until at least one event occur.
- // This implementation is a bit on the edge, but seems to
- // work fine:
- NSEvent* event = [NSApp nextEventMatchingMask:NSAnyEventMask
- untilDate:[NSDate distantFuture]
- inMode:NSDefaultRunLoopMode
- dequeue:YES];
- if (event)
- [NSApp postEvent:event atStart:YES];
-}
-
-static inline void qt_mac_waitForMoreModalSessionEvents()
-{
- // If no event exist in the cocoa event que, wait
- // (and free up cpu time) until at least one event occur.
- // This implementation is a bit on the edge, but seems to
- // work fine:
- NSEvent* event = [NSApp nextEventMatchingMask:NSAnyEventMask
- untilDate:[NSDate distantFuture]
- inMode:NSModalPanelRunLoopMode
- dequeue:YES];
- if (event)
- [NSApp postEvent:event atStart:YES];
-}
-
-bool QEventDispatcherMac::processEvents(QEventLoop::ProcessEventsFlags flags)
-{
- Q_D(QEventDispatcherMac);
- d->interrupt = false;
-
- bool interruptLater = false;
- QtMacInterruptDispatcherHelp::cancelInterruptLater();
-
- // In case we end up recursing while we now process events, make sure
- // that we send remaining posted Qt events before this call returns:
- wakeUp();
- emit awake();
-
- bool excludeUserEvents = flags & QEventLoop::ExcludeUserInputEvents;
- bool retVal = false;
- forever {
- if (d->interrupt)
- break;
-
- QMacCocoaAutoReleasePool pool;
- NSEvent* event = 0;
-
- // First, send all previously excluded input events, if any:
- if (!excludeUserEvents) {
- while (!d->queuedUserInputEvents.isEmpty()) {
- event = static_cast<NSEvent *>(d->queuedUserInputEvents.takeFirst());
- if (!filterEvent(event)) {
- qt_mac_send_event(flags, event, 0);
- retVal = true;
- }
- [event release];
- }
- }
-
- // If Qt is used as a plugin, or as an extension in a native cocoa
- // application, we should not run or stop NSApplication; This will be
- // done from the application itself. And if processEvents is called
- // manually (rather than from a QEventLoop), we cannot enter a tight
- // loop and block this call, but instead we need to return after one flush.
- // Finally, if we are to exclude user input events, we cannot call [NSApp run]
- // as we then loose control over which events gets dispatched:
- const bool canExec_3rdParty = d->nsAppRunCalledByQt || ![NSApp isRunning];
- const bool canExec_Qt = !excludeUserEvents &&
- (flags & QEventLoop::DialogExec || flags & QEventLoop::EventLoopExec) ;
-
- if (canExec_Qt && canExec_3rdParty) {
- // We can use exec-mode, meaning that we can stay in a tight loop until
- // interrupted. This is mostly an optimization, but it allow us to use
- // [NSApp run], which is the normal code path for cocoa applications.
- if (NSModalSession session = d->currentModalSession()) {
- QBoolBlocker execGuard(d->currentExecIsNSAppRun, false);
- while ([NSApp runModalSession:session] == NSRunContinuesResponse && !d->interrupt)
- qt_mac_waitForMoreModalSessionEvents();
-
- if (!d->interrupt && session == d->currentModalSessionCached) {
- // Someone called [NSApp stopModal:] from outside the event
- // dispatcher (e.g to stop a native dialog). But that call wrongly stopped
- // 'session' as well. As a result, we need to restart all internal sessions:
- d->temporarilyStopAllModalSessions();
- }
- } else {
- d->nsAppRunCalledByQt = true;
- QBoolBlocker execGuard(d->currentExecIsNSAppRun, true);
- [NSApp run];
- }
- retVal = true;
- } else {
- // We cannot block the thread (and run in a tight loop).
- // Instead we will process all current pending events and return.
- d->ensureNSAppInitialized();
- if (NSModalSession session = d->currentModalSession()) {
- // INVARIANT: a modal window is executing.
- if (!excludeUserEvents) {
- // Since we can dispatch all kinds of events, we choose
- // to use cocoa's native way of running modal sessions:
- if (flags & QEventLoop::WaitForMoreEvents)
- qt_mac_waitForMoreModalSessionEvents();
- NSInteger status = [NSApp runModalSession:session];
- if (status != NSRunContinuesResponse && session == d->currentModalSessionCached) {
- // INVARIANT: Someone called [NSApp stopModal:] from outside the event
- // dispatcher (e.g to stop a native dialog). But that call wrongly stopped
- // 'session' as well. As a result, we need to restart all internal sessions:
- d->temporarilyStopAllModalSessions();
- }
- retVal = true;
- } else do {
- // Dispatch all non-user events (but que non-user events up for later). In
- // this case, we need more control over which events gets dispatched, and
- // cannot use [NSApp runModalSession:session]:
- event = [NSApp nextEventMatchingMask:NSAnyEventMask
- untilDate:nil
- inMode:NSModalPanelRunLoopMode
- dequeue: YES];
-
- if (event) {
- if (IsMouseOrKeyEvent(event)) {
- [event retain];
- d->queuedUserInputEvents.append(event);
- continue;
- }
- if (!filterEvent(event) && qt_mac_send_event(flags, event, 0))
- retVal = true;
- }
- } while (!d->interrupt && event != nil);
- } else do {
- // INVARIANT: No modal window is executing.
- event = [NSApp nextEventMatchingMask:NSAnyEventMask
- untilDate:nil
- inMode:NSDefaultRunLoopMode
- dequeue: YES];
-
- if (event) {
- if (flags & QEventLoop::ExcludeUserInputEvents) {
- if (IsMouseOrKeyEvent(event)) {
- [event retain];
- d->queuedUserInputEvents.append(event);
- continue;
- }
- }
- if (!filterEvent(event) && qt_mac_send_event(flags, event, 0))
- retVal = true;
- }
- } while (!d->interrupt && event != nil);
-
- // Be sure to flush the Qt posted events when not using exec mode
- // (exec mode will always do this call from the event loop source):
- if (!d->interrupt)
- QCoreApplicationPrivate::sendPostedEvents(0, 0, d->threadData);
-
- // Since the window that holds modality might have changed while processing
- // events, we we need to interrupt when we return back the previous process
- // event recursion to ensure that we spin the correct modal session.
- // We do the interruptLater at the end of the function to ensure that we don't
- // disturb the 'wait for more events' below (as deleteLater will post an event):
- interruptLater = true;
- }
-
- bool canWait = (d->threadData->canWait
- && !retVal
- && !d->interrupt
- && (flags & QEventLoop::WaitForMoreEvents));
- if (canWait) {
- // INVARIANT: We haven't processed any events yet. And we're told
- // to stay inside this function until at least one event is processed.
- qt_mac_waitForMoreEvents();
- flags &= ~QEventLoop::WaitForMoreEvents;
- } else {
- // Done with event processing for now.
- // Leave the function:
- break;
- }
- }
-
- // If we're interrupted, we need to interrupt the _current_
- // recursion as well to check if it is still supposed to be
- // executing. This way we wind down the stack until we land
- // on a recursion that again calls processEvents (typically
- // from QEventLoop), and set interrupt to false:
- if (d->interrupt)
- interrupt();
-
- if (interruptLater)
- QtMacInterruptDispatcherHelp::interruptLater();
-
- return retVal;
-}
-
-void QEventDispatcherMac::wakeUp()
-{
- Q_D(QEventDispatcherMac);
- d->serialNumber.ref();
- CFRunLoopSourceSignal(d->postedEventsSource);
- CFRunLoopWakeUp(mainRunLoop());
-}
-
-void QEventDispatcherMac::flush()
-{
- if(qApp) {
- QWidgetList tlws = QApplication::topLevelWidgets();
- for(int i = 0; i < tlws.size(); i++) {
- QWidget *tlw = tlws.at(i);
- if(tlw->isVisible())
- macWindowFlush(qt_mac_window_for(tlw));
- }
- }
-}
-
-/*****************************************************************************
- QEventDispatcherMac Implementation
- *****************************************************************************/
-MacTimerHash QEventDispatcherMacPrivate::macTimerHash;
-bool QEventDispatcherMacPrivate::blockSendPostedEvents = false;
-bool QEventDispatcherMacPrivate::interrupt = false;
-
-QStack<QCocoaModalSessionInfo> QEventDispatcherMacPrivate::cocoaModalSessionStack;
-bool QEventDispatcherMacPrivate::currentExecIsNSAppRun = false;
-bool QEventDispatcherMacPrivate::nsAppRunCalledByQt = false;
-bool QEventDispatcherMacPrivate::cleanupModalSessionsNeeded = false;
-NSModalSession QEventDispatcherMacPrivate::currentModalSessionCached = 0;
-
-void QEventDispatcherMacPrivate::ensureNSAppInitialized()
-{
- // Some elements in Cocoa require NSApplication to be running before
- // they get fully initialized, in particular the menu bar. This
- // function is intended for cases where a dialog is told to execute before
- // QApplication::exec is called, or the application spins the events loop
- // manually rather than calling QApplication:exec.
- // The function makes sure that NSApplication starts running, but stops
- // it again as soon as the send posted events callback is called. That way
- // we let Cocoa finish the initialization it seems to need. We'll only
- // apply this trick at most once for any application, and we avoid doing it
- // for the common case where main just starts QApplication::exec.
- if (nsAppRunCalledByQt || [NSApp isRunning])
- return;
- nsAppRunCalledByQt = true;
- QBoolBlocker block1(interrupt, true);
- QBoolBlocker block2(currentExecIsNSAppRun, true);
- [NSApp run];
-}
-
-void QEventDispatcherMacPrivate::temporarilyStopAllModalSessions()
-{
- // Flush, and Stop, all created modal session, and as
- // such, make them pending again. The next call to
- // currentModalSession will recreate them again. The
- // reason to stop all session like this is that otherwise
- // a call [NSApp stop] would not stop NSApp, but rather
- // the current modal session. So if we need to stop NSApp
- // we need to stop all the modal session first. To avoid changing
- // the stacking order of the windows while doing so, we put
- // up a block that is used in QCocoaWindow and QCocoaPanel:
- int stackSize = cocoaModalSessionStack.size();
- for (int i=0; i<stackSize; ++i) {
- QCocoaModalSessionInfo &info = cocoaModalSessionStack[i];
- if (info.session) {
- [NSApp endModalSession:info.session];
- info.session = 0;
- }
- }
- currentModalSessionCached = 0;
-}
-
-NSModalSession QEventDispatcherMacPrivate::currentModalSession()
-{
- // If we have one or more modal windows, this function will create
- // a session for each of those, and return the one for the top.
- if (currentModalSessionCached)
- return currentModalSessionCached;
-
- if (cocoaModalSessionStack.isEmpty())
- return 0;
-
- int sessionCount = cocoaModalSessionStack.size();
- for (int i=0; i<sessionCount; ++i) {
- QCocoaModalSessionInfo &info = cocoaModalSessionStack[i];
- if (!info.widget)
- continue;
- if (info.widget->testAttribute(Qt::WA_DontShowOnScreen))
- continue;
- if (!info.session) {
- QMacCocoaAutoReleasePool pool;
- NSWindow *window = qt_mac_window_for(info.widget);
- if (!window)
- continue;
-
- ensureNSAppInitialized();
- QBoolBlocker block1(blockSendPostedEvents, true);
- info.nswindow = window;
- [(NSWindow*) info.nswindow retain];
- int levelBeforeEnterModal = [window level];
- info.session = [NSApp beginModalSessionForWindow:window];
- // Make sure we don't stack the window lower that it was before
- // entering modal, in case it e.g. had the stays-on-top flag set:
- if (levelBeforeEnterModal > [window level])
- [window setLevel:levelBeforeEnterModal];
- }
- currentModalSessionCached = info.session;
- cleanupModalSessionsNeeded = false;
- }
- return currentModalSessionCached;
-}
-
-static void setChildrenWorksWhenModal(QWidget *widget, bool worksWhenModal)
-{
- // For NSPanels (but not NSWindows, sadly), we can set the flag
- // worksWhenModal, so that they are active even when they are not modal.
- QList<QDialog *> dialogs = widget->findChildren<QDialog *>();
- for (int i=0; i<dialogs.size(); ++i){
- NSWindow *window = qt_mac_window_for(dialogs[i]);
- if (window && [window isKindOfClass:[NSPanel class]]) {
- [static_cast<NSPanel *>(window) setWorksWhenModal:worksWhenModal];
- if (worksWhenModal && [window isVisible]){
- [window orderFront:window];
- }
- }
- }
-}
-
-void QEventDispatcherMacPrivate::updateChildrenWorksWhenModal()
-{
- // Make the dialog children of the widget
- // active. And make the dialog children of
- // the previous modal dialog unactive again:
- QMacCocoaAutoReleasePool pool;
- int size = cocoaModalSessionStack.size();
- if (size > 0){
- if (QWidget *prevModal = cocoaModalSessionStack[size-1].widget)
- setChildrenWorksWhenModal(prevModal, true);
- if (size > 1){
- if (QWidget *prevModal = cocoaModalSessionStack[size-2].widget)
- setChildrenWorksWhenModal(prevModal, false);
- }
- }
-}
-
-void QEventDispatcherMacPrivate::cleanupModalSessions()
-{
- // Go through the list of modal sessions, and end those
- // that no longer has a widget assosiated; no widget means
- // the the session has logically ended. The reason we wait like
- // this to actually end the sessions for real (rather than at the
- // point they were marked as stopped), is that ending a session
- // when no other session runs below it on the stack will make cocoa
- // drop some events on the floor.
- QMacCocoaAutoReleasePool pool;
- int stackSize = cocoaModalSessionStack.size();
-
- for (int i=stackSize-1; i>=0; --i) {
- QCocoaModalSessionInfo &info = cocoaModalSessionStack[i];
- if (info.widget) {
- // This session has a widget, and is therefore not marked
- // as stopped. So just make it current. There might still be other
- // stopped sessions on the stack, but those will be stopped on
- // a later "cleanup" call.
- currentModalSessionCached = info.session;
- break;
- }
- cocoaModalSessionStack.remove(i);
- currentModalSessionCached = 0;
- if (info.session) {
- [NSApp endModalSession:info.session];
- [(NSWindow *)info.nswindow release];
- }
- }
-
- updateChildrenWorksWhenModal();
- cleanupModalSessionsNeeded = false;
-}
-
-void QEventDispatcherMacPrivate::beginModalSession(QWidget *widget)
-{
- // Add a new, empty (null), NSModalSession to the stack.
- // It will become active the next time QEventDispatcher::processEvents is called.
- // A QCocoaModalSessionInfo is considered pending to become active if the widget pointer
- // is non-zero, and the session pointer is zero (it will become active upon a call to
- // currentModalSession). A QCocoaModalSessionInfo is considered pending to be stopped if
- // the widget pointer is zero, and the session pointer is non-zero (it will be fully
- // stopped in cleanupModalSessions()).
- QCocoaModalSessionInfo info = {widget, 0, 0};
- cocoaModalSessionStack.push(info);
- updateChildrenWorksWhenModal();
- currentModalSessionCached = 0;
-}
-
-void QEventDispatcherMacPrivate::endModalSession(QWidget *widget)
-{
- // Mark all sessions attached to widget as pending to be stopped. We do this
- // by setting the widget pointer to zero, but leave the session pointer.
- // We don't tell cocoa to stop any sessions just yet, because cocoa only understands
- // when we stop the _current_ modal session (which is the session on top of
- // the stack, and might not belong to 'widget').
- int stackSize = cocoaModalSessionStack.size();
- for (int i=stackSize-1; i>=0; --i) {
- QCocoaModalSessionInfo &info = cocoaModalSessionStack[i];
- if (info.widget == widget) {
- info.widget = 0;
- if (i == stackSize-1) {
- // The top sessions ended. Interrupt the event dispatcher
- // to start spinning the correct session immidiatly:
- currentModalSessionCached = 0;
- cleanupModalSessionsNeeded = true;
- QEventDispatcherMac::instance()->interrupt();
- }
- }
- }
-}
-
-
-QEventDispatcherMacPrivate::QEventDispatcherMacPrivate()
-{
-}
-
-QEventDispatcherMac::QEventDispatcherMac(QObject *parent)
- : QAbstractEventDispatcher(*new QEventDispatcherMacPrivate, parent)
-{
- Q_D(QEventDispatcherMac);
- CFRunLoopSourceContext context;
- bzero(&context, sizeof(CFRunLoopSourceContext));
- context.info = d;
- context.equal = QEventDispatcherMacPrivate::postedEventSourceEqualCallback;
- context.perform = QEventDispatcherMacPrivate::postedEventsSourcePerformCallback;
- d->postedEventsSource = CFRunLoopSourceCreate(0, 0, &context);
- Q_ASSERT(d->postedEventsSource);
- CFRunLoopAddSource(mainRunLoop(), d->postedEventsSource, kCFRunLoopCommonModes);
-
- CFRunLoopObserverContext observerContext;
- bzero(&observerContext, sizeof(CFRunLoopObserverContext));
- observerContext.info = this;
- d->waitingObserver = CFRunLoopObserverCreate(kCFAllocatorDefault,
- kCFRunLoopBeforeWaiting | kCFRunLoopAfterWaiting,
- true, 0,
- QEventDispatcherMacPrivate::waitingObserverCallback,
- &observerContext);
- CFRunLoopAddObserver(mainRunLoop(), d->waitingObserver, kCFRunLoopCommonModes);
-
- /* The first cycle in the loop adds the source and the events of the source
- are not processed.
- We use an observer to process the posted events for the first
- execution of the loop. */
- CFRunLoopObserverContext firstTimeObserverContext;
- bzero(&firstTimeObserverContext, sizeof(CFRunLoopObserverContext));
- firstTimeObserverContext.info = d;
- d->firstTimeObserver = CFRunLoopObserverCreate(kCFAllocatorDefault,
- kCFRunLoopEntry,
- /* repeats = */ false,
- 0,
- QEventDispatcherMacPrivate::firstLoopEntry,
- &firstTimeObserverContext);
- CFRunLoopAddObserver(mainRunLoop(), d->firstTimeObserver, kCFRunLoopCommonModes);
-}
-
-void QEventDispatcherMacPrivate::waitingObserverCallback(CFRunLoopObserverRef,
- CFRunLoopActivity activity, void *info)
-{
- if (activity == kCFRunLoopBeforeWaiting)
- emit static_cast<QEventDispatcherMac*>(info)->aboutToBlock();
- else
- emit static_cast<QEventDispatcherMac*>(info)->awake();
-}
-
-Boolean QEventDispatcherMacPrivate::postedEventSourceEqualCallback(const void *info1, const void *info2)
-{
- return info1 == info2;
-}
-
-inline static void processPostedEvents(QEventDispatcherMacPrivate *const d, const bool blockSendPostedEvents)
-{
- if (blockSendPostedEvents) {
- // We're told to not send posted events (because the event dispatcher
- // is currently working on setting up the correct session to run). But
- // we still need to make sure that we don't fall asleep until pending events
- // are sendt, so we just signal this need, and return:
- CFRunLoopSourceSignal(d->postedEventsSource);
- return;
- }
-
- if (d->cleanupModalSessionsNeeded)
- d->cleanupModalSessions();
-
- if (d->interrupt) {
- if (d->currentExecIsNSAppRun) {
- // The event dispatcher has been interrupted. But since
- // [NSApplication run] is running the event loop, we
- // delayed stopping it until now (to let cocoa process
- // pending cocoa events first).
- if (d->currentModalSessionCached)
- d->temporarilyStopAllModalSessions();
- [NSApp stop:NSApp];
- d->cancelWaitForMoreEvents();
- }
- return;
- }
-
- if (!d->threadData->canWait || (d->serialNumber != d->lastSerial)) {
- d->lastSerial = d->serialNumber;
- QApplicationPrivate::sendPostedEvents(0, 0, d->threadData);
- }
-}
-
-void QEventDispatcherMacPrivate::firstLoopEntry(CFRunLoopObserverRef ref,
- CFRunLoopActivity activity,
- void *info)
-{
- Q_UNUSED(ref);
- Q_UNUSED(activity);
- QApplicationPrivate::qt_initAfterNSAppStarted();
- processPostedEvents(static_cast<QEventDispatcherMacPrivate *>(info), blockSendPostedEvents);
-}
-
-void QEventDispatcherMacPrivate::postedEventsSourcePerformCallback(void *info)
-{
- processPostedEvents(static_cast<QEventDispatcherMacPrivate *>(info), blockSendPostedEvents);
-}
-
-void QEventDispatcherMacPrivate::cancelWaitForMoreEvents()
-{
- // In case the event dispatcher is waiting for more
- // events somewhere, we post a dummy event to wake it up:
- QMacCocoaAutoReleasePool pool;
- [NSApp postEvent:[NSEvent otherEventWithType:NSApplicationDefined location:NSZeroPoint
- modifierFlags:0 timestamp:0. windowNumber:0 context:0
- subtype:QtCocoaEventSubTypeWakeup data1:0 data2:0] atStart:NO];
-}
-
-void QEventDispatcherMac::interrupt()
-{
- Q_D(QEventDispatcherMac);
- d->interrupt = true;
- wakeUp();
-
- // We do nothing more here than setting d->interrupt = true, and
- // poke the event loop if it is sleeping. Actually stopping
- // NSApp, or the current modal session, is done inside the send
- // posted events callback. We do this to ensure that all current pending
- // cocoa events gets delivered before we stop. Otherwise, if we now stop
- // the last event loop recursion, cocoa will just drop pending posted
- // events on the floor before we get a chance to reestablish a new session.
- d->cancelWaitForMoreEvents();
-}
-
-QEventDispatcherMac::~QEventDispatcherMac()
-{
- Q_D(QEventDispatcherMac);
- //timer cleanup
- MacTimerHash::iterator it = QEventDispatcherMacPrivate::macTimerHash.begin();
- while (it != QEventDispatcherMacPrivate::macTimerHash.end()) {
- MacTimerInfo *t = it.value();
- if (t->runLoopTimer) {
- CFRunLoopTimerInvalidate(t->runLoopTimer);
- CFRelease(t->runLoopTimer);
- }
- delete t;
- ++it;
- }
- QEventDispatcherMacPrivate::macTimerHash.clear();
-
- // Remove CFSockets from the runloop.
- for (MacSocketHash::ConstIterator it = d->macSockets.constBegin(); it != d->macSockets.constEnd(); ++it) {
- MacSocketInfo *socketInfo = (*it);
- if (CFSocketIsValid(socketInfo->socket)) {
- qt_mac_remove_socket_from_runloop(socketInfo->socket, socketInfo->runloop);
- CFRunLoopSourceInvalidate(socketInfo->runloop);
- CFRelease(socketInfo->runloop);
- CFSocketInvalidate(socketInfo->socket);
- CFRelease(socketInfo->socket);
- }
- }
- CFRunLoopRemoveSource(mainRunLoop(), d->postedEventsSource, kCFRunLoopCommonModes);
- CFRelease(d->postedEventsSource);
-
- CFRunLoopObserverInvalidate(d->waitingObserver);
- CFRelease(d->waitingObserver);
-
- CFRunLoopObserverInvalidate(d->firstTimeObserver);
- CFRelease(d->firstTimeObserver);
-}
-
-
-QtMacInterruptDispatcherHelp* QtMacInterruptDispatcherHelp::instance = 0;
-
-QtMacInterruptDispatcherHelp::QtMacInterruptDispatcherHelp() : cancelled(false)
-{
- // The whole point of this class is that we enable a way to interrupt
- // the event dispatcher when returning back to a lower recursion level
- // than where interruptLater was called. This is needed to detect if
- // [NSApp run] should still be running at the recursion level it is at.
- // Since the interrupt is canceled if processEvents is called before
- // this object gets deleted, we also avoid interrupting unnecessary.
- deleteLater();
-}
-
-QtMacInterruptDispatcherHelp::~QtMacInterruptDispatcherHelp()
-{
- if (cancelled)
- return;
- instance = 0;
- QEventDispatcherMac::instance()->interrupt();
-}
-
-void QtMacInterruptDispatcherHelp::cancelInterruptLater()
-{
- if (!instance)
- return;
- instance->cancelled = true;
- delete instance;
- instance = 0;
-}
-
-void QtMacInterruptDispatcherHelp::interruptLater()
-{
- cancelInterruptLater();
- instance = new QtMacInterruptDispatcherHelp;
-}
-
-
-QT_END_NAMESPACE
-
diff --git a/src/widgets/platforms/mac/qeventdispatcher_mac_p.h b/src/widgets/platforms/mac/qeventdispatcher_mac_p.h
deleted file mode 100644
index 57797b070b..0000000000
--- a/src/widgets/platforms/mac/qeventdispatcher_mac_p.h
+++ /dev/null
@@ -1,218 +0,0 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
-
-/****************************************************************************
-**
-** Copyright (c) 2007-2008, Apple, Inc.
-**
-** All rights reserved.
-**
-** Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are met:
-**
-** * Redistributions of source code must retain the above copyright notice,
-** this list of conditions and the following disclaimer.
-**
-** * Redistributions in binary form must reproduce the above copyright notice,
-** this list of conditions and the following disclaimer in the documentation
-** and/or other materials provided with the distribution.
-**
-** * Neither the name of Apple, Inc. nor the names of its contributors
-** may be used to endorse or promote products derived from this software
-** without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-** CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-** EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-** PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-** PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-** LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-** NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-** SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-**
-****************************************************************************/
-
-#ifndef QEVENTDISPATCHER_MAC_P_H
-#define QEVENTDISPATCHER_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 <QtGui/qwindowdefs.h>
-#include <QtCore/qhash.h>
-#include <QtCore/qstack.h>
-#include "private/qabstracteventdispatcher_p.h"
-#include "private/qt_mac_p.h"
-
-QT_BEGIN_NAMESPACE
-
-typedef struct _NSModalSession *NSModalSession;
-typedef struct _QCocoaModalSessionInfo {
- QPointer<QWidget> widget;
- NSModalSession session;
- void *nswindow;
-} QCocoaModalSessionInfo;
-
-class QEventDispatcherMacPrivate;
-
-class QEventDispatcherMac : public QAbstractEventDispatcher
-{
- Q_OBJECT
- Q_DECLARE_PRIVATE(QEventDispatcherMac)
-
-public:
- explicit QEventDispatcherMac(QObject *parent = 0);
- ~QEventDispatcherMac();
-
- bool processEvents(QEventLoop::ProcessEventsFlags flags);
- bool hasPendingEvents();
-
- void registerSocketNotifier(QSocketNotifier *notifier);
- void unregisterSocketNotifier(QSocketNotifier *notifier);
-
- void registerTimer(int timerId, int interval, QObject *object);
- bool unregisterTimer(int timerId);
- bool unregisterTimers(QObject *object);
- QList<TimerInfo> registeredTimers(QObject *object) const;
-
- void wakeUp();
- void flush();
- void interrupt();
-
-private:
- friend void qt_mac_select_timer_callbk(__EventLoopTimer*, void*);
- friend class QApplicationPrivate;
-};
-
-struct MacTimerInfo {
- int id;
- int interval;
- QObject *obj;
- bool pending;
- CFRunLoopTimerRef runLoopTimer;
- bool operator==(const MacTimerInfo &other) const
- {
- return (id == other.id);
- }
-};
-typedef QHash<int, MacTimerInfo *> MacTimerHash;
-
-struct MacSocketInfo {
- MacSocketInfo() : socket(0), runloop(0), readNotifier(0), writeNotifier(0) {}
- CFSocketRef socket;
- CFRunLoopSourceRef runloop;
- QObject *readNotifier;
- QObject *writeNotifier;
-};
-typedef QHash<int, MacSocketInfo *> MacSocketHash;
-
-class QEventDispatcherMacPrivate : public QAbstractEventDispatcherPrivate
-{
- Q_DECLARE_PUBLIC(QEventDispatcherMac)
-
-public:
- QEventDispatcherMacPrivate();
-
- static MacTimerHash macTimerHash;
- // Set 'blockSendPostedEvents' to true if you _really_ need
- // to make sure that qt events are not posted while calling
- // low-level cocoa functions (like beginModalForWindow). And
- // use a QBoolBlocker to be safe:
- static bool blockSendPostedEvents;
- // The following variables help organizing modal sessions:
- static QStack<QCocoaModalSessionInfo> cocoaModalSessionStack;
- static bool currentExecIsNSAppRun;
- static bool nsAppRunCalledByQt;
- static bool cleanupModalSessionsNeeded;
- static NSModalSession currentModalSessionCached;
- static NSModalSession currentModalSession();
- static void updateChildrenWorksWhenModal();
- static void temporarilyStopAllModalSessions();
- static void beginModalSession(QWidget *widget);
- static void endModalSession(QWidget *widget);
- static void cancelWaitForMoreEvents();
- static void cleanupModalSessions();
- static void ensureNSAppInitialized();
-
- MacSocketHash macSockets;
- QList<void *> queuedUserInputEvents; // List of EventRef in Carbon, and NSEvent * in Cocoa
- CFRunLoopSourceRef postedEventsSource;
- CFRunLoopObserverRef waitingObserver;
- CFRunLoopObserverRef firstTimeObserver;
- QAtomicInt serialNumber;
- int lastSerial;
- static bool interrupt;
-private:
- static Boolean postedEventSourceEqualCallback(const void *info1, const void *info2);
- static void postedEventsSourcePerformCallback(void *info);
- static void activateTimer(CFRunLoopTimerRef, void *info);
- static void waitingObserverCallback(CFRunLoopObserverRef observer,
- CFRunLoopActivity activity, void *info);
- static void firstLoopEntry(CFRunLoopObserverRef ref, CFRunLoopActivity activity, void *info);
-};
-
-class QtMacInterruptDispatcherHelp : public QObject
-{
- static QtMacInterruptDispatcherHelp *instance;
- bool cancelled;
-
- QtMacInterruptDispatcherHelp();
- ~QtMacInterruptDispatcherHelp();
-
- public:
- static void interruptLater();
- static void cancelInterruptLater();
-};
-
-QT_END_NAMESPACE
-
-#endif // QEVENTDISPATCHER_MAC_P_H
diff --git a/src/widgets/platforms/mac/qkeymapper_mac.cpp b/src/widgets/platforms/mac/qkeymapper_mac.cpp
deleted file mode 100644
index 3cacb098aa..0000000000
--- a/src/widgets/platforms/mac/qkeymapper_mac.cpp
+++ /dev/null
@@ -1,963 +0,0 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
-
-#include <private/qt_mac_p.h>
-#include <qdebug.h>
-#include <qevent.h>
-#include <private/qevent_p.h>
-#include <qtextcodec.h>
-#include <qapplication.h>
-#include <qinputcontext.h>
-#include <private/qkeymapper_p.h>
-#include <private/qapplication_p.h>
-#include <private/qmacinputcontext_p.h>
-
-QT_BEGIN_NAMESPACE
-
-QT_USE_NAMESPACE
-
-/*****************************************************************************
- QKeyMapper debug facilities
- *****************************************************************************/
-//#define DEBUG_KEY_BINDINGS
-//#define DEBUG_KEY_BINDINGS_MODIFIERS
-//#define DEBUG_KEY_MAPS
-
-/*****************************************************************************
- Internal variables and functions
- *****************************************************************************/
-bool qt_mac_eat_unicode_key = false;
-extern bool qt_sendSpontaneousEvent(QObject *obj, QEvent *event); //qapplication_mac.cpp
-
-Q_WIDGETS_EXPORT void qt_mac_secure_keyboard(bool b)
-{
- static bool secure = false;
- if (b != secure){
- b ? EnableSecureEventInput() : DisableSecureEventInput();
- secure = b;
- }
-}
-
-/*
- \internal
- A Mac KeyboardLayoutItem has 8 possible states:
- 1. Unmodified
- 2. Shift
- 3. Control
- 4. Control + Shift
- 5. Alt
- 6. Alt + Shift
- 7. Alt + Control
- 8. Alt + Control + Shift
- 9. Meta
- 10. Meta + Shift
- 11. Meta + Control
- 12. Meta + Control + Shift
- 13. Meta + Alt
- 14. Meta + Alt + Shift
- 15. Meta + Alt + Control
- 16. Meta + Alt + Control + Shift
-*/
-struct KeyboardLayoutItem {
- bool dirty;
- quint32 qtKey[16]; // Can by any Qt::Key_<foo>, or unicode character
-};
-
-// Possible modifier states.
-// NOTE: The order of these states match the order in QKeyMapperPrivate::updatePossibleKeyCodes()!
-static const Qt::KeyboardModifiers ModsTbl[] = {
- Qt::NoModifier, // 0
- Qt::ShiftModifier, // 1
- Qt::ControlModifier, // 2
- Qt::ControlModifier | Qt::ShiftModifier, // 3
- Qt::AltModifier, // 4
- Qt::AltModifier | Qt::ShiftModifier, // 5
- Qt::AltModifier | Qt::ControlModifier, // 6
- Qt::AltModifier | Qt::ShiftModifier | Qt::ControlModifier, // 7
- Qt::MetaModifier, // 8
- Qt::MetaModifier | Qt::ShiftModifier, // 9
- Qt::MetaModifier | Qt::ControlModifier, // 10
- Qt::MetaModifier | Qt::ControlModifier | Qt::ShiftModifier,// 11
- Qt::MetaModifier | Qt::AltModifier, // 12
- Qt::MetaModifier | Qt::AltModifier | Qt::ShiftModifier, // 13
- Qt::MetaModifier | Qt::AltModifier | Qt::ControlModifier, // 14
- Qt::MetaModifier | Qt::AltModifier | Qt::ShiftModifier | Qt::ControlModifier, // 15
-};
-
-/* key maps */
-struct qt_mac_enum_mapper
-{
- int mac_code;
- int qt_code;
-#if defined(DEBUG_KEY_BINDINGS)
-# define QT_MAC_MAP_ENUM(x) x, #x
- const char *desc;
-#else
-# define QT_MAC_MAP_ENUM(x) x
-#endif
-};
-
-//modifiers
-static qt_mac_enum_mapper qt_mac_modifier_symbols[] = {
- { shiftKey, QT_MAC_MAP_ENUM(Qt::ShiftModifier) },
- { rightShiftKey, QT_MAC_MAP_ENUM(Qt::ShiftModifier) },
- { controlKey, QT_MAC_MAP_ENUM(Qt::MetaModifier) },
- { rightControlKey, QT_MAC_MAP_ENUM(Qt::MetaModifier) },
- { cmdKey, QT_MAC_MAP_ENUM(Qt::ControlModifier) },
- { optionKey, QT_MAC_MAP_ENUM(Qt::AltModifier) },
- { rightOptionKey, QT_MAC_MAP_ENUM(Qt::AltModifier) },
- { kEventKeyModifierNumLockMask, QT_MAC_MAP_ENUM(Qt::KeypadModifier) },
- { 0, QT_MAC_MAP_ENUM(0) }
-};
-Qt::KeyboardModifiers qt_mac_get_modifiers(int keys)
-{
-#ifdef DEBUG_KEY_BINDINGS_MODIFIERS
- qDebug("Qt: internal: **Mapping modifiers: %d (0x%04x)", keys, keys);
-#endif
- Qt::KeyboardModifiers ret = Qt::NoModifier;
- for (int i = 0; qt_mac_modifier_symbols[i].qt_code; i++) {
- if (keys & qt_mac_modifier_symbols[i].mac_code) {
-#ifdef DEBUG_KEY_BINDINGS_MODIFIERS
- qDebug("Qt: internal: got modifier: %s", qt_mac_modifier_symbols[i].desc);
-#endif
- ret |= Qt::KeyboardModifier(qt_mac_modifier_symbols[i].qt_code);
- }
- }
- if (qApp->testAttribute(Qt::AA_MacDontSwapCtrlAndMeta)) {
- Qt::KeyboardModifiers oldModifiers = ret;
- ret &= ~(Qt::MetaModifier | Qt::ControlModifier);
- if (oldModifiers & Qt::ControlModifier)
- ret |= Qt::MetaModifier;
- if (oldModifiers & Qt::MetaModifier)
- ret |= Qt::ControlModifier;
- }
- return ret;
-}
-static int qt_mac_get_mac_modifiers(Qt::KeyboardModifiers keys)
-{
-#ifdef DEBUG_KEY_BINDINGS_MODIFIERS
- qDebug("Qt: internal: **Mapping modifiers: %d (0x%04x)", (int)keys, (int)keys);
-#endif
- int ret = 0;
- for (int i = 0; qt_mac_modifier_symbols[i].qt_code; i++) {
- if (keys & qt_mac_modifier_symbols[i].qt_code) {
-#ifdef DEBUG_KEY_BINDINGS_MODIFIERS
- qDebug("Qt: internal: got modifier: %s", qt_mac_modifier_symbols[i].desc);
-#endif
- ret |= qt_mac_modifier_symbols[i].mac_code;
- }
- }
-
- if (qApp->testAttribute(Qt::AA_MacDontSwapCtrlAndMeta)) {
- int oldModifiers = ret;
- ret &= ~(controlKeyBit | cmdKeyBit);
- if (oldModifiers & controlKeyBit)
- ret |= cmdKeyBit;
- if (oldModifiers & cmdKeyBit)
- ret |= controlKeyBit;
- }
- return ret;
-}
-void qt_mac_send_modifiers_changed(quint32 modifiers, QObject *object)
-{
- static quint32 cachedModifiers = 0;
- quint32 lastModifiers = cachedModifiers,
- changedModifiers = lastModifiers ^ modifiers;
- cachedModifiers = modifiers;
-
- //check the bits
- static qt_mac_enum_mapper modifier_key_symbols[] = {
- { shiftKeyBit, QT_MAC_MAP_ENUM(Qt::Key_Shift) },
- { rightShiftKeyBit, QT_MAC_MAP_ENUM(Qt::Key_Shift) }, //???
- { controlKeyBit, QT_MAC_MAP_ENUM(Qt::Key_Meta) },
- { rightControlKeyBit, QT_MAC_MAP_ENUM(Qt::Key_Meta) }, //???
- { cmdKeyBit, QT_MAC_MAP_ENUM(Qt::Key_Control) },
- { optionKeyBit, QT_MAC_MAP_ENUM(Qt::Key_Alt) },
- { rightOptionKeyBit, QT_MAC_MAP_ENUM(Qt::Key_Alt) }, //???
- { alphaLockBit, QT_MAC_MAP_ENUM(Qt::Key_CapsLock) },
- { kEventKeyModifierNumLockBit, QT_MAC_MAP_ENUM(Qt::Key_NumLock) },
- { 0, QT_MAC_MAP_ENUM(0) } };
- for (int i = 0; i <= 32; i++) { //just check each bit
- if (!(changedModifiers & (1 << i)))
- continue;
- QEvent::Type etype = QEvent::KeyPress;
- if (lastModifiers & (1 << i))
- etype = QEvent::KeyRelease;
- int key = 0;
- for (uint x = 0; modifier_key_symbols[x].mac_code; x++) {
- if (modifier_key_symbols[x].mac_code == i) {
-#ifdef DEBUG_KEY_BINDINGS_MODIFIERS
- qDebug("got modifier changed: %s", modifier_key_symbols[x].desc);
-#endif
- key = modifier_key_symbols[x].qt_code;
- break;
- }
- }
- if (!key) {
-#ifdef DEBUG_KEY_BINDINGS_MODIFIERS
- qDebug("could not get modifier changed: %d", i);
-#endif
- continue;
- }
-#ifdef DEBUG_KEY_BINDINGS_MODIFIERS
- qDebug("KeyEvent (modif): Sending %s to %s::%s: %d - 0x%08x",
- etype == QEvent::KeyRelease ? "KeyRelease" : "KeyPress",
- object ? object->metaObject()->className() : "none",
- object ? object->objectName().toLatin1().constData() : "",
- key, (int)modifiers);
-#endif
- QKeyEvent ke(etype, key, qt_mac_get_modifiers(modifiers ^ (1 << i)), QLatin1String(""));
- qt_sendSpontaneousEvent(object, &ke);
- }
-}
-
-//keyboard keys (non-modifiers)
-static qt_mac_enum_mapper qt_mac_keyboard_symbols[] = {
- { kHomeCharCode, QT_MAC_MAP_ENUM(Qt::Key_Home) },
- { kEnterCharCode, QT_MAC_MAP_ENUM(Qt::Key_Enter) },
- { kEndCharCode, QT_MAC_MAP_ENUM(Qt::Key_End) },
- { kBackspaceCharCode, QT_MAC_MAP_ENUM(Qt::Key_Backspace) },
- { kTabCharCode, QT_MAC_MAP_ENUM(Qt::Key_Tab) },
- { kPageUpCharCode, QT_MAC_MAP_ENUM(Qt::Key_PageUp) },
- { kPageDownCharCode, QT_MAC_MAP_ENUM(Qt::Key_PageDown) },
- { kReturnCharCode, QT_MAC_MAP_ENUM(Qt::Key_Return) },
- { kEscapeCharCode, QT_MAC_MAP_ENUM(Qt::Key_Escape) },
- { kLeftArrowCharCode, QT_MAC_MAP_ENUM(Qt::Key_Left) },
- { kRightArrowCharCode, QT_MAC_MAP_ENUM(Qt::Key_Right) },
- { kUpArrowCharCode, QT_MAC_MAP_ENUM(Qt::Key_Up) },
- { kDownArrowCharCode, QT_MAC_MAP_ENUM(Qt::Key_Down) },
- { kHelpCharCode, QT_MAC_MAP_ENUM(Qt::Key_Help) },
- { kDeleteCharCode, QT_MAC_MAP_ENUM(Qt::Key_Delete) },
-//ascii maps, for debug
- { ':', QT_MAC_MAP_ENUM(Qt::Key_Colon) },
- { ';', QT_MAC_MAP_ENUM(Qt::Key_Semicolon) },
- { '<', QT_MAC_MAP_ENUM(Qt::Key_Less) },
- { '=', QT_MAC_MAP_ENUM(Qt::Key_Equal) },
- { '>', QT_MAC_MAP_ENUM(Qt::Key_Greater) },
- { '?', QT_MAC_MAP_ENUM(Qt::Key_Question) },
- { '@', QT_MAC_MAP_ENUM(Qt::Key_At) },
- { ' ', QT_MAC_MAP_ENUM(Qt::Key_Space) },
- { '!', QT_MAC_MAP_ENUM(Qt::Key_Exclam) },
- { '"', QT_MAC_MAP_ENUM(Qt::Key_QuoteDbl) },
- { '#', QT_MAC_MAP_ENUM(Qt::Key_NumberSign) },
- { '$', QT_MAC_MAP_ENUM(Qt::Key_Dollar) },
- { '%', QT_MAC_MAP_ENUM(Qt::Key_Percent) },
- { '&', QT_MAC_MAP_ENUM(Qt::Key_Ampersand) },
- { '\'', QT_MAC_MAP_ENUM(Qt::Key_Apostrophe) },
- { '(', QT_MAC_MAP_ENUM(Qt::Key_ParenLeft) },
- { ')', QT_MAC_MAP_ENUM(Qt::Key_ParenRight) },
- { '*', QT_MAC_MAP_ENUM(Qt::Key_Asterisk) },
- { '+', QT_MAC_MAP_ENUM(Qt::Key_Plus) },
- { ',', QT_MAC_MAP_ENUM(Qt::Key_Comma) },
- { '-', QT_MAC_MAP_ENUM(Qt::Key_Minus) },
- { '.', QT_MAC_MAP_ENUM(Qt::Key_Period) },
- { '/', QT_MAC_MAP_ENUM(Qt::Key_Slash) },
- { '[', QT_MAC_MAP_ENUM(Qt::Key_BracketLeft) },
- { ']', QT_MAC_MAP_ENUM(Qt::Key_BracketRight) },
- { '\\', QT_MAC_MAP_ENUM(Qt::Key_Backslash) },
- { '_', QT_MAC_MAP_ENUM(Qt::Key_Underscore) },
- { '`', QT_MAC_MAP_ENUM(Qt::Key_QuoteLeft) },
- { '{', QT_MAC_MAP_ENUM(Qt::Key_BraceLeft) },
- { '}', QT_MAC_MAP_ENUM(Qt::Key_BraceRight) },
- { '|', QT_MAC_MAP_ENUM(Qt::Key_Bar) },
- { '~', QT_MAC_MAP_ENUM(Qt::Key_AsciiTilde) },
- { '^', QT_MAC_MAP_ENUM(Qt::Key_AsciiCircum) },
- { 0, QT_MAC_MAP_ENUM(0) }
-};
-
-static qt_mac_enum_mapper qt_mac_keyvkey_symbols[] = { //real scan codes
- { 122, QT_MAC_MAP_ENUM(Qt::Key_F1) },
- { 120, QT_MAC_MAP_ENUM(Qt::Key_F2) },
- { 99, QT_MAC_MAP_ENUM(Qt::Key_F3) },
- { 118, QT_MAC_MAP_ENUM(Qt::Key_F4) },
- { 96, QT_MAC_MAP_ENUM(Qt::Key_F5) },
- { 97, QT_MAC_MAP_ENUM(Qt::Key_F6) },
- { 98, QT_MAC_MAP_ENUM(Qt::Key_F7) },
- { 100, QT_MAC_MAP_ENUM(Qt::Key_F8) },
- { 101, QT_MAC_MAP_ENUM(Qt::Key_F9) },
- { 109, QT_MAC_MAP_ENUM(Qt::Key_F10) },
- { 103, QT_MAC_MAP_ENUM(Qt::Key_F11) },
- { 111, QT_MAC_MAP_ENUM(Qt::Key_F12) },
- { 105, QT_MAC_MAP_ENUM(Qt::Key_F13) },
- { 107, QT_MAC_MAP_ENUM(Qt::Key_F14) },
- { 113, QT_MAC_MAP_ENUM(Qt::Key_F15) },
- { 106, QT_MAC_MAP_ENUM(Qt::Key_F16) },
- { 0, QT_MAC_MAP_ENUM(0) }
-};
-
-static qt_mac_enum_mapper qt_mac_private_unicode[] = {
- { 0xF700, QT_MAC_MAP_ENUM(Qt::Key_Up) }, //NSUpArrowFunctionKey
- { 0xF701, QT_MAC_MAP_ENUM(Qt::Key_Down) }, //NSDownArrowFunctionKey
- { 0xF702, QT_MAC_MAP_ENUM(Qt::Key_Left) }, //NSLeftArrowFunctionKey
- { 0xF703, QT_MAC_MAP_ENUM(Qt::Key_Right) }, //NSRightArrowFunctionKey
- { 0xF727, QT_MAC_MAP_ENUM(Qt::Key_Insert) }, //NSInsertFunctionKey
- { 0xF728, QT_MAC_MAP_ENUM(Qt::Key_Delete) }, //NSDeleteFunctionKey
- { 0xF729, QT_MAC_MAP_ENUM(Qt::Key_Home) }, //NSHomeFunctionKey
- { 0xF72B, QT_MAC_MAP_ENUM(Qt::Key_End) }, //NSEndFunctionKey
- { 0xF72C, QT_MAC_MAP_ENUM(Qt::Key_PageUp) }, //NSPageUpFunctionKey
- { 0xF72D, QT_MAC_MAP_ENUM(Qt::Key_PageDown) }, //NSPageDownFunctionKey
- { 0xF72F, QT_MAC_MAP_ENUM(Qt::Key_ScrollLock) }, //NSScrollLockFunctionKey
- { 0xF730, QT_MAC_MAP_ENUM(Qt::Key_Pause) }, //NSPauseFunctionKey
- { 0xF731, QT_MAC_MAP_ENUM(Qt::Key_SysReq) }, //NSSysReqFunctionKey
- { 0xF735, QT_MAC_MAP_ENUM(Qt::Key_Menu) }, //NSMenuFunctionKey
- { 0xF738, QT_MAC_MAP_ENUM(Qt::Key_Print) }, //NSPrintFunctionKey
- { 0xF73A, QT_MAC_MAP_ENUM(Qt::Key_Clear) }, //NSClearDisplayFunctionKey
- { 0xF73D, QT_MAC_MAP_ENUM(Qt::Key_Insert) }, //NSInsertCharFunctionKey
- { 0xF73E, QT_MAC_MAP_ENUM(Qt::Key_Delete) }, //NSDeleteCharFunctionKey
- { 0xF741, QT_MAC_MAP_ENUM(Qt::Key_Select) }, //NSSelectFunctionKey
- { 0xF742, QT_MAC_MAP_ENUM(Qt::Key_Execute) }, //NSExecuteFunctionKey
- { 0xF746, QT_MAC_MAP_ENUM(Qt::Key_Help) }, //NSHelpFunctionKey
- { 0xF747, QT_MAC_MAP_ENUM(Qt::Key_Mode_switch) }, //NSModeSwitchFunctionKey
- { 0, QT_MAC_MAP_ENUM(0) }
-};
-
-static int qt_mac_get_key(int modif, const QChar &key, int virtualKey)
-{
-#ifdef DEBUG_KEY_BINDINGS
- qDebug("**Mapping key: %d (0x%04x) - %d (0x%04x)", key.unicode(), key.unicode(), virtualKey, virtualKey);
-#endif
-
- if (key == kClearCharCode && virtualKey == 0x47)
- return Qt::Key_Clear;
-
- if (key.isDigit()) {
-#ifdef DEBUG_KEY_BINDINGS
- qDebug("%d: got key: %d", __LINE__, key.digitValue());
-#endif
- return key.digitValue() + Qt::Key_0;
- }
-
- if (key.isLetter()) {
-#ifdef DEBUG_KEY_BINDINGS
- qDebug("%d: got key: %d", __LINE__, (key.toUpper().unicode() - 'A'));
-#endif
- return (key.toUpper().unicode() - 'A') + Qt::Key_A;
- }
- if (key.isSymbol()) {
-#ifdef DEBUG_KEY_BINDINGS
- qDebug("%d: got key: %d", __LINE__, (key.unicode()));
-#endif
- return key.unicode();
- }
-
- for (int i = 0; qt_mac_keyboard_symbols[i].qt_code; i++) {
- if (qt_mac_keyboard_symbols[i].mac_code == key) {
- /* To work like Qt for X11 we issue Backtab when Shift + Tab are pressed */
- if (qt_mac_keyboard_symbols[i].qt_code == Qt::Key_Tab && (modif & Qt::ShiftModifier)) {
-#ifdef DEBUG_KEY_BINDINGS
- qDebug("%d: got key: Qt::Key_Backtab", __LINE__);
-#endif
- return Qt::Key_Backtab;
- }
-
-#ifdef DEBUG_KEY_BINDINGS
- qDebug("%d: got key: %s", __LINE__, qt_mac_keyboard_symbols[i].desc);
-#endif
- return qt_mac_keyboard_symbols[i].qt_code;
- }
- }
-
- //last ditch try to match the scan code
- for (int i = 0; qt_mac_keyvkey_symbols[i].qt_code; i++) {
- if (qt_mac_keyvkey_symbols[i].mac_code == virtualKey) {
-#ifdef DEBUG_KEY_BINDINGS
- qDebug("%d: got key: %s", __LINE__, qt_mac_keyvkey_symbols[i].desc);
-#endif
- return qt_mac_keyvkey_symbols[i].qt_code;
- }
- }
-
- // check if they belong to key codes in private unicode range
- if (key >= 0xf700 && key <= 0xf747) {
- if (key >= 0xf704 && key <= 0xf726) {
- return Qt::Key_F1 + (key.unicode() - 0xf704) ;
- }
- for (int i = 0; qt_mac_private_unicode[i].qt_code; i++) {
- if (qt_mac_private_unicode[i].mac_code == key) {
- return qt_mac_private_unicode[i].qt_code;
- }
- }
-
- }
-
- //oh well
-#ifdef DEBUG_KEY_BINDINGS
- qDebug("Unknown case.. %s:%d %d[%d] %d", __FILE__, __LINE__, key.unicode(), key.toLatin1(), virtualKey);
-#endif
- return Qt::Key_unknown;
-}
-
-static Boolean qt_KeyEventComparatorProc(EventRef inEvent, void *data)
-{
- UInt32 ekind = GetEventKind(inEvent),
- eclass = GetEventClass(inEvent);
- return (eclass == kEventClassKeyboard && (void *)ekind == data);
-}
-
-static bool translateKeyEventInternal(EventHandlerCallRef er, EventRef keyEvent, int *qtKey,
- QChar *outChar, Qt::KeyboardModifiers *outModifiers, bool *outHandled)
-{
- const UInt32 ekind = GetEventKind(keyEvent);
- {
- UInt32 mac_modifiers = 0;
- GetEventParameter(keyEvent, kEventParamKeyModifiers, typeUInt32, 0,
- sizeof(mac_modifiers), 0, &mac_modifiers);
-#ifdef DEBUG_KEY_BINDINGS_MODIFIERS
- qDebug("************ Mapping modifiers and key ***********");
-#endif
- *outModifiers = qt_mac_get_modifiers(mac_modifiers);
-#ifdef DEBUG_KEY_BINDINGS_MODIFIERS
- qDebug("------------ Mapping modifiers and key -----------");
-#endif
- }
-
- //get keycode
- UInt32 keyCode = 0;
- GetEventParameter(keyEvent, kEventParamKeyCode, typeUInt32, 0, sizeof(keyCode), 0, &keyCode);
-
- //get mac mapping
- static UInt32 tmp_unused_state = 0L;
- const UCKeyboardLayout *uchrData = 0;
-#if defined(Q_OS_MAC32)
- KeyboardLayoutRef keyLayoutRef = 0;
- KLGetCurrentKeyboardLayout(&keyLayoutRef);
- OSStatus err;
- if (keyLayoutRef != 0) {
- err = KLGetKeyboardLayoutProperty(keyLayoutRef, kKLuchrData,
- (reinterpret_cast<const void **>(&uchrData)));
- if (err != noErr) {
- qWarning("Qt::internal::unable to get keyboardlayout %ld %s:%d",
- long(err), __FILE__, __LINE__);
- }
- }
-#else
- QCFType<TISInputSourceRef> inputSource = TISCopyCurrentKeyboardInputSource();
- Q_ASSERT(inputSource != 0);
- CFDataRef data = static_cast<CFDataRef>(TISGetInputSourceProperty(inputSource,
- kTISPropertyUnicodeKeyLayoutData));
- uchrData = data ? reinterpret_cast<const UCKeyboardLayout *>(CFDataGetBytePtr(data)) : 0;
-#endif
- *qtKey = Qt::Key_unknown;
- if (uchrData) {
- // The easy stuff; use the unicode stuff!
- UniChar string[4];
- UniCharCount actualLength;
- UInt32 currentModifiers = GetCurrentEventKeyModifiers();
- UInt32 currentModifiersWOAltOrControl = currentModifiers & ~(controlKey | optionKey);
- int keyAction;
- switch (ekind) {
- default:
- case kEventRawKeyDown:
- keyAction = kUCKeyActionDown;
- break;
- case kEventRawKeyUp:
- keyAction = kUCKeyActionUp;
- break;
- case kEventRawKeyRepeat:
- keyAction = kUCKeyActionAutoKey;
- break;
- }
- OSStatus err = UCKeyTranslate(uchrData, keyCode, keyAction,
- ((currentModifiersWOAltOrControl >> 8) & 0xff), LMGetKbdType(),
- kUCKeyTranslateNoDeadKeysMask, &tmp_unused_state, 4, &actualLength,
- string);
- if (err == noErr) {
- *outChar = QChar(string[0]);
- *qtKey = qt_mac_get_key(*outModifiers, *outChar, keyCode);
- if (currentModifiersWOAltOrControl != currentModifiers) {
- // Now get the real char.
- err = UCKeyTranslate(uchrData, keyCode, keyAction,
- ((currentModifiers >> 8) & 0xff), LMGetKbdType(),
- kUCKeyTranslateNoDeadKeysMask, &tmp_unused_state, 4, &actualLength,
- string);
- if (err == noErr)
- *outChar = QChar(string[0]);
- }
- } else {
- qWarning("Qt::internal::UCKeyTranslate is returnining %ld %s:%d",
- long(err), __FILE__, __LINE__);
- }
- }
-#ifdef Q_OS_MAC32
- else {
- // The road less travelled; use KeyTranslate
- const void *keyboard_layout;
- KeyboardLayoutRef keyLayoutRef = 0;
- KLGetCurrentKeyboardLayout(&keyLayoutRef);
- err = KLGetKeyboardLayoutProperty(keyLayoutRef, kKLKCHRData,
- reinterpret_cast<const void **>(&keyboard_layout));
-
- int translatedChar = KeyTranslate(keyboard_layout, (GetCurrentEventKeyModifiers() &
- (kEventKeyModifierNumLockMask|shiftKey|cmdKey|
- rightShiftKey|alphaLock)) | keyCode,
- &tmp_unused_state);
- if (!translatedChar) {
- if (outHandled) {
- qt_mac_eat_unicode_key = false;
- if (er)
- CallNextEventHandler(er, keyEvent);
- *outHandled = qt_mac_eat_unicode_key;
- }
- return false;
- }
-
- //map it into qt keys
- *qtKey = qt_mac_get_key(*outModifiers, QChar(translatedChar), keyCode);
- if (*outModifiers & (Qt::AltModifier | Qt::ControlModifier)) {
- if (translatedChar & (1 << 7)) //high ascii
- translatedChar = 0;
- } else { //now get the real ascii value
- UInt32 tmp_mod = 0L;
- static UInt32 tmp_state = 0L;
- if (*outModifiers & Qt::ShiftModifier)
- tmp_mod |= shiftKey;
- if (*outModifiers & Qt::MetaModifier)
- tmp_mod |= controlKey;
- if (*outModifiers & Qt::ControlModifier)
- tmp_mod |= cmdKey;
- if (GetCurrentEventKeyModifiers() & alphaLock) //no Qt mapper
- tmp_mod |= alphaLock;
- if (*outModifiers & Qt::AltModifier)
- tmp_mod |= optionKey;
- if (*outModifiers & Qt::KeypadModifier)
- tmp_mod |= kEventKeyModifierNumLockMask;
- translatedChar = KeyTranslate(keyboard_layout, tmp_mod | keyCode, &tmp_state);
- }
- {
- ByteCount unilen = 0;
- if (GetEventParameter(keyEvent, kEventParamKeyUnicodes, typeUnicodeText, 0, 0, &unilen, 0)
- == noErr && unilen == 2) {
- GetEventParameter(keyEvent, kEventParamKeyUnicodes, typeUnicodeText, 0, unilen, 0, outChar);
- } else if (translatedChar) {
- static QTextCodec *c = 0;
- if (!c)
- c = QTextCodec::codecForName("Apple Roman");
- char tmpChar = (char)translatedChar; // **sigh**
- *outChar = c->toUnicode(&tmpChar, 1).at(0);
- } else {
- *qtKey = qt_mac_get_key(*outModifiers, QChar(translatedChar), keyCode);
- }
- }
- }
-#endif
- if (*qtKey == Qt::Key_unknown)
- *qtKey = qt_mac_get_key(*outModifiers, *outChar, keyCode);
- return true;
-}
-
-QKeyMapperPrivate::QKeyMapperPrivate()
-{
- memset(keyLayout, 0, sizeof(keyLayout));
- keyboard_layout_format.unicode = 0;
-#ifdef Q_OS_MAC32
- keyboard_mode = NullMode;
-#else
- currentInputSource = 0;
-#endif
-}
-
-QKeyMapperPrivate::~QKeyMapperPrivate()
-{
- deleteLayouts();
-}
-
-bool
-QKeyMapperPrivate::updateKeyboard()
-{
- const UCKeyboardLayout *uchrData = 0;
-#ifdef Q_OS_MAC32
- KeyboardLayoutRef keyLayoutRef = 0;
- KLGetCurrentKeyboardLayout(&keyLayoutRef);
-
- if (keyboard_mode != NullMode && currentKeyboardLayout == keyLayoutRef)
- return false;
-
- OSStatus err;
- if (keyLayoutRef != 0) {
- err = KLGetKeyboardLayoutProperty(keyLayoutRef, kKLuchrData,
- const_cast<const void **>(reinterpret_cast<const void **>(&uchrData)));
- if (err != noErr) {
- qWarning("Qt::internal::unable to get unicode keyboardlayout %ld %s:%d",
- long(err), __FILE__, __LINE__);
- }
- }
-#else
- QCFType<TISInputSourceRef> source = TISCopyCurrentKeyboardInputSource();
- if (keyboard_mode != NullMode && source == currentInputSource) {
- return false;
- }
- Q_ASSERT(source != 0);
- CFDataRef data = static_cast<CFDataRef>(TISGetInputSourceProperty(source,
- kTISPropertyUnicodeKeyLayoutData));
- uchrData = data ? reinterpret_cast<const UCKeyboardLayout *>(CFDataGetBytePtr(data)) : 0;
-#endif
-
- keyboard_kind = LMGetKbdType();
- if (uchrData) {
- keyboard_layout_format.unicode = uchrData;
- keyboard_mode = UnicodeMode;
- }
-#ifdef Q_OS_MAC32
- else {
- void *happy;
- err = KLGetKeyboardLayoutProperty(keyLayoutRef, kKLKCHRData,
- const_cast<const void **>(reinterpret_cast<void **>(&happy)));
- if (err != noErr) {
- qFatal("Qt::internal::unable to get non-unicode layout, cannot procede %ld %s:%d",
- long(err), __FILE__, __LINE__);
- }
- keyboard_layout_format.other = happy;
- keyboard_mode = OtherMode;
- }
-
- currentKeyboardLayout = keyLayoutRef;
-#else
- currentInputSource = source;
-#endif
- keyboard_dead = 0;
- CFStringRef iso639Code;
-#ifdef Q_OS_MAC32
-# ifndef kKLLanguageCode
-# define kKLLanguageCode 9
-# endif
- KLGetKeyboardLayoutProperty(currentKeyboardLayout, kKLLanguageCode,
- reinterpret_cast<const void **>(&iso639Code));
-#else
- CFArrayRef array = static_cast<CFArrayRef>(TISGetInputSourceProperty(currentInputSource, kTISPropertyInputSourceLanguages));
- iso639Code = static_cast<CFStringRef>(CFArrayGetValueAtIndex(array, 0)); // Actually a RFC3066bis, but it's close enough
-#endif
- if (iso639Code) {
- keyboardInputLocale = QLocale(QCFString::toQString(iso639Code));
- keyboardInputDirection = keyboardInputLocale.textDirection();
- } else {
- keyboardInputLocale = QLocale::c();
- keyboardInputDirection = Qt::LeftToRight;
- }
- return true;
-}
-
-void
-QKeyMapperPrivate::deleteLayouts()
-{
- keyboard_mode = NullMode;
- for (int i = 0; i < 255; ++i) {
- if (keyLayout[i]) {
- delete keyLayout[i];
- keyLayout[i] = 0;
- }
- }
-}
-
-void
-QKeyMapperPrivate::clearMappings()
-{
- deleteLayouts();
- updateKeyboard();
-}
-
-QList<int>
-QKeyMapperPrivate::possibleKeys(QKeyEvent *e)
-{
- QList<int> ret;
-
- KeyboardLayoutItem *kbItem = keyLayout[e->nativeVirtualKey()];
- if (!kbItem) // Key is not in any keyboard layout (e.g. eisu-key on Japanese keyboard)
- return ret;
-
- int baseKey = kbItem->qtKey[0];
- Qt::KeyboardModifiers keyMods = e->modifiers();
- ret << int(baseKey + keyMods); // The base key is _always_ valid, of course
-
- for (int i = 1; i < 8; ++i) {
- Qt::KeyboardModifiers neededMods = ModsTbl[i];
- int key = kbItem->qtKey[i];
- if (key && key != baseKey && ((keyMods & neededMods) == neededMods))
- ret << int(key + (keyMods & ~neededMods));
- }
-
- return ret;
-}
-
-bool QKeyMapperPrivate::translateKeyEvent(QWidget *widget, EventHandlerCallRef er, EventRef event,
- void *info, bool grab)
-{
- Q_ASSERT(GetEventClass(event) == kEventClassKeyboard);
- bool handled_event=true;
- UInt32 ekind = GetEventKind(event);
-
- // unfortunately modifiers changed event looks quite different, so I have a separate
- // code path
- if (ekind == kEventRawKeyModifiersChanged) {
- //figure out changed modifiers, wish Apple would just send a delta
- UInt32 modifiers = 0;
- GetEventParameter(event, kEventParamKeyModifiers, typeUInt32, 0,
- sizeof(modifiers), 0, &modifiers);
- qt_mac_send_modifiers_changed(modifiers, widget);
- return true;
- }
-
- QInputContext *currentContext = qApp->inputContext();
- if (currentContext && currentContext->isComposing()) {
- if (ekind == kEventRawKeyDown) {
- QMacInputContext *context = qobject_cast<QMacInputContext*>(currentContext);
- if (context)
- context->setLastKeydownEvent(event);
- }
- return false;
- }
- // Once we process the key down , we don't need to send the saved event again from
- // kEventTextInputUnicodeForKeyEvent, so clear it.
- if (currentContext && ekind == kEventRawKeyDown) {
- QMacInputContext *context = qobject_cast<QMacInputContext*>(currentContext);
- if (context)
- context->setLastKeydownEvent(0);
- }
-
- //get modifiers
- Qt::KeyboardModifiers modifiers;
- int qtKey;
- QChar ourChar;
- if (translateKeyEventInternal(er, event, &qtKey, &ourChar, &modifiers,
- &handled_event) == false)
- return handled_event;
- QString text(ourChar);
- /* This is actually wrong - but unfortunately it is the best that can be
- done for now because of the Control/Meta mapping problems */
- if (modifiers & (Qt::ControlModifier | Qt::MetaModifier)
- && !qApp->testAttribute(Qt::AA_MacDontSwapCtrlAndMeta)) {
- text = QString();
- }
-
-
- if (widget) {
- // Try to compress key events.
- if (!text.isEmpty() && widget->testAttribute(Qt::WA_KeyCompression)) {
- EventTime lastTime = GetEventTime(event);
- for (;;) {
- EventRef releaseEvent = FindSpecificEventInQueue(GetMainEventQueue(),
- qt_KeyEventComparatorProc,
- (void*)kEventRawKeyUp);
- if (!releaseEvent)
- break;
- const EventTime releaseTime = GetEventTime(releaseEvent);
- if (releaseTime < lastTime)
- break;
- lastTime = releaseTime;
-
- EventRef pressEvent = FindSpecificEventInQueue(GetMainEventQueue(),
- qt_KeyEventComparatorProc,
- (void*)kEventRawKeyDown);
- if (!pressEvent)
- break;
- const EventTime pressTime = GetEventTime(pressEvent);
- if (pressTime < lastTime)
- break;
- lastTime = pressTime;
-
- Qt::KeyboardModifiers compressMod;
- int compressQtKey = 0;
- QChar compressChar;
- if (translateKeyEventInternal(er, pressEvent,
- &compressQtKey, &compressChar, &compressMod, 0)
- == false) {
- break;
- }
- // Copied from qapplication_x11.cpp (change both).
-
- bool stopCompression =
- // 1) misc keys
- (compressQtKey >= Qt::Key_Escape && compressQtKey <= Qt::Key_SysReq)
- // 2) cursor movement
- || (compressQtKey >= Qt::Key_Home && compressQtKey <= Qt::Key_PageDown)
- // 3) extra keys
- || (compressQtKey >= Qt::Key_Super_L && compressQtKey <= Qt::Key_Direction_R)
- // 4) something that a) doesn't translate to text or b) translates
- // to newline text
- || (compressQtKey == 0)
- || (compressChar == QLatin1Char('\n'))
- || (compressQtKey == Qt::Key_unknown);
-
- if (compressMod == modifiers && !compressChar.isNull() && !stopCompression) {
-#ifdef DEBUG_KEY_BINDINGS
- qDebug("compressing away %c", compressChar.toLatin1());
-#endif
- text += compressChar;
- // Clean up
- RemoveEventFromQueue(GetMainEventQueue(), releaseEvent);
- RemoveEventFromQueue(GetMainEventQueue(), pressEvent);
- } else {
-#ifdef DEBUG_KEY_BINDINGS
- qDebug("stoping compression..");
-#endif
- break;
- }
- }
- }
-
- // There is no way to get the scan code from carbon. But we cannot use the value 0, since
- // it indicates that the event originates from somewhere else than the keyboard
- UInt32 macScanCode = 1;
- UInt32 macVirtualKey = 0;
- GetEventParameter(event, kEventParamKeyCode, typeUInt32, 0, sizeof(macVirtualKey), 0, &macVirtualKey);
- UInt32 macModifiers = 0;
- GetEventParameter(event, kEventParamKeyModifiers, typeUInt32, 0,
- sizeof(macModifiers), 0, &macModifiers);
- // The unicode characters in the range 0xF700-0xF747 are reserved
- // by Mac OS X for transient use as keyboard function keys. We
- // wont send 'text' for such key events. This is done to match
- // behavior on other platforms.
- unsigned int *unicodeKey = (unsigned int*)info;
- if (*unicodeKey >= 0xf700 && *unicodeKey <= 0xf747)
- text = QString();
- bool isAccepted;
- handled_event = QKeyMapper::sendKeyEvent(widget, grab,
- (ekind == kEventRawKeyUp) ? QEvent::KeyRelease : QEvent::KeyPress,
- qtKey, modifiers, text, ekind == kEventRawKeyRepeat, 0,
- macScanCode, macVirtualKey, macModifiers
- ,&isAccepted
- );
- *unicodeKey = (unsigned int)isAccepted;
- }
- return handled_event;
-}
-
-void
-QKeyMapperPrivate::updateKeyMap(EventHandlerCallRef, EventRef event, void *
- unicodeKey // unicode character from NSEvent (modifiers applied)
- )
-{
- UInt32 macVirtualKey = 0;
- GetEventParameter(event, kEventParamKeyCode, typeUInt32, 0, sizeof(macVirtualKey), 0, &macVirtualKey);
- if (updateKeyboard())
- QKeyMapper::changeKeyboard();
- else if (keyLayout[macVirtualKey])
- return;
-
- UniCharCount buffer_size = 10;
- UniChar buffer[buffer_size];
- keyLayout[macVirtualKey] = new KeyboardLayoutItem;
- for (int i = 0; i < 16; ++i) {
- UniCharCount out_buffer_size = 0;
- keyLayout[macVirtualKey]->qtKey[i] = 0;
-#ifdef Q_WS_MAC32
- if (keyboard_mode == UnicodeMode) {
-#endif
- const UInt32 keyModifier = ((qt_mac_get_mac_modifiers(ModsTbl[i]) >> 8) & 0xFF);
- OSStatus err = UCKeyTranslate(keyboard_layout_format.unicode, macVirtualKey, kUCKeyActionDown, keyModifier,
- keyboard_kind, 0, &keyboard_dead, buffer_size, &out_buffer_size, buffer);
- if (err == noErr && out_buffer_size) {
- const QChar unicode(buffer[0]);
- int qtkey = qt_mac_get_key(keyModifier, unicode, macVirtualKey);
- if (qtkey == Qt::Key_unknown)
- qtkey = unicode.unicode();
- keyLayout[macVirtualKey]->qtKey[i] = qtkey;
- }
-#ifndef Q_WS_MAC32
- else {
- const QChar unicode(*((UniChar *)unicodeKey));
- int qtkey = qt_mac_get_key(keyModifier, unicode, macVirtualKey);
- if (qtkey == Qt::Key_unknown)
- qtkey = unicode.unicode();
- keyLayout[macVirtualKey]->qtKey[i] = qtkey;
- }
-#endif
-#ifdef Q_WS_MAC32
- } else {
- const UInt32 keyModifier = (qt_mac_get_mac_modifiers(ModsTbl[i]));
-
- uchar translatedChar = KeyTranslate(keyboard_layout_format.other, keyModifier | macVirtualKey, &keyboard_dead);
- if (translatedChar) {
- static QTextCodec *c = 0;
- if (!c)
- c = QTextCodec::codecForName("Apple Roman");
- const QChar unicode(c->toUnicode((const char *)&translatedChar, 1).at(0));
- int qtkey = qt_mac_get_key(keyModifier, unicode, macVirtualKey);
- if (qtkey == Qt::Key_unknown)
- qtkey = unicode.unicode();
- keyLayout[macVirtualKey]->qtKey[i] = qtkey;
- }
- }
-#endif
- }
-#ifdef DEBUG_KEY_MAPS
- qDebug("updateKeyMap for virtual key = 0x%02x!", (uint)macVirtualKey);
- for (int i = 0; i < 16; ++i) {
- qDebug(" [%d] (%d,0x%02x,'%c')", i,
- keyLayout[macVirtualKey]->qtKey[i],
- keyLayout[macVirtualKey]->qtKey[i],
- keyLayout[macVirtualKey]->qtKey[i]);
- }
-#endif
-}
-
-bool
-QKeyMapper::sendKeyEvent(QWidget *widget, bool grab,
- QEvent::Type type, int code, Qt::KeyboardModifiers modifiers,
- const QString &text, bool autorepeat, int count,
- quint32 nativeScanCode, quint32 nativeVirtualKey,
- quint32 nativeModifiers, bool *isAccepted)
-{
- Q_UNUSED(count);
- Q_UNUSED(grab);
-
- if (widget && widget->isEnabled()) {
- bool key_event = true;
- if (key_event) {
-#if defined(DEBUG_KEY_BINDINGS) || defined(DEBUG_KEY_BINDINGS_MODIFIERS)
- qDebug("KeyEvent: Sending %s to %s::%s: %s 0x%08x%s",
- type == QEvent::KeyRelease ? "KeyRelease" : "KeyPress",
- widget ? widget->metaObject()->className() : "none",
- widget ? widget->objectName().toLatin1().constData() : "",
- text.toLatin1().constData(), int(modifiers),
- autorepeat ? " Repeat" : "");
-#endif
- QKeyEventEx ke(type, code, modifiers, text, autorepeat, qMax(1, text.length()),
- nativeScanCode, nativeVirtualKey, nativeModifiers);
- bool retMe = qt_sendSpontaneousEvent(widget,&ke);
- if (isAccepted)
- *isAccepted = ke.isAccepted();
- return retMe;
- }
- }
- return false;
-}
-
-QT_END_NAMESPACE
diff --git a/src/widgets/platforms/mac/qmacdefines_mac.h b/src/widgets/platforms/mac/qmacdefines_mac.h
deleted file mode 100644
index 9f27dfa584..0000000000
--- a/src/widgets/platforms/mac/qmacdefines_mac.h
+++ /dev/null
@@ -1,158 +0,0 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
-
-/****************************************************************************
-**
-** Copyright (c) 2007-2008, Apple, Inc.
-**
-** All rights reserved.
-**
-** Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are met:
-**
-** * Redistributions of source code must retain the above copyright notice,
-** this list of conditions and the following disclaimer.
-**
-** * Redistributions in binary form must reproduce the above copyright notice,
-** this list of conditions and the following disclaimer in the documentation
-** and/or other materials provided with the distribution.
-**
-** * Neither the name of Apple, Inc. nor the names of its contributors
-** may be used to endorse or promote products derived from this software
-** without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-** CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-** EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-** PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-** PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-** LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-** NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-** SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-**
-****************************************************************************/
-
-/*
- * qmacdefines_mac_p.h
- * All the defines you'll ever need for Qt/Mac :-)
- */
-
-/* This is just many defines. Therefore it doesn't need things like:
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Gui)
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-Yes, it is an informative comment ;-)
-*/
-
-#include <QtCore/qglobal.h>
-
-#ifdef qDebug
-# define old_qDebug qDebug
-# undef qDebug
-#endif
-
-#ifdef __LP64__
-typedef signed int OSStatus;
-#else
-typedef signed long OSStatus;
-#endif
-
-#ifdef __OBJC__
-# ifdef slots
-# define old_slots slots
-# undef slots
-# endif
-#include <Cocoa/Cocoa.h>
-# ifdef old_slots
-# undef slots
-# define slots
-# undef old_slots
-# endif
-#endif
- typedef struct OpaqueEventHandlerCallRef * EventHandlerCallRef;
- typedef struct OpaqueEventRef * EventRef;
- typedef struct OpaqueMenuRef * MenuRef;
- typedef struct OpaquePasteboardRef* PasteboardRef;
- typedef struct OpaqueRgnHandle * RgnHandle;
- typedef const struct __HIShape *HIShapeRef;
- typedef struct __HIShape *HIMutableShapeRef;
- typedef struct CGRect CGRect;
- typedef struct CGImage *CGImageRef;
- typedef struct CGContext *CGContextRef;
- typedef struct GDevice * GDPtr;
- typedef GDPtr * GDHandle;
- typedef struct OpaqueIconRef * IconRef;
-# ifdef __OBJC__
- typedef NSWindow* OSWindowRef;
- typedef NSView *OSViewRef;
- typedef NSMenu *OSMenuRef;
- typedef NSEvent *OSEventRef;
-# else
- typedef void *OSWindowRef;
- typedef void *OSViewRef;
- typedef void *OSMenuRef;
- typedef void *OSEventRef;
-# endif
-
-typedef PasteboardRef OSPasteboardRef;
-typedef struct AEDesc AEDescList;
-typedef AEDescList AERecord;
-typedef AERecord AppleEvent;
-
-#ifdef check
-#undef check
-#endif
-
-#ifdef old_qDebug
-# undef qDebug
-# define qDebug QT_NO_QDEBUG_MACRO
-# undef old_qDebug
-#endif
diff --git a/src/widgets/platforms/mac/qmacgesturerecognizer_mac.mm b/src/widgets/platforms/mac/qmacgesturerecognizer_mac.mm
deleted file mode 100644
index 54823aa04f..0000000000
--- a/src/widgets/platforms/mac/qmacgesturerecognizer_mac.mm
+++ /dev/null
@@ -1,270 +0,0 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
-
-#include "qmacgesturerecognizer_mac_p.h"
-#include "qgesture.h"
-#include "qgesture_p.h"
-#include "qevent.h"
-#include "qevent_p.h"
-#include "qwidget.h"
-#include "qdebug.h"
-
-#ifndef QT_NO_GESTURES
-
-QT_BEGIN_NAMESPACE
-
-QMacSwipeGestureRecognizer::QMacSwipeGestureRecognizer()
-{
-}
-
-QGesture *QMacSwipeGestureRecognizer::create(QObject * /*target*/)
-{
- return new QSwipeGesture;
-}
-
-QGestureRecognizer::Result
-QMacSwipeGestureRecognizer::recognize(QGesture *gesture, QObject *obj, QEvent *event)
-{
- if (event->type() == QEvent::NativeGesture && obj->isWidgetType()) {
- QNativeGestureEvent *ev = static_cast<QNativeGestureEvent*>(event);
- switch (ev->gestureType) {
- case QNativeGestureEvent::Swipe: {
- QSwipeGesture *g = static_cast<QSwipeGesture *>(gesture);
- g->setSwipeAngle(ev->angle);
- g->setHotSpot(ev->position);
- return QGestureRecognizer::FinishGesture | QGestureRecognizer::ConsumeEventHint;
- break; }
- default:
- break;
- }
- }
-
- return QGestureRecognizer::Ignore;
-}
-
-void QMacSwipeGestureRecognizer::reset(QGesture *gesture)
-{
- QSwipeGesture *g = static_cast<QSwipeGesture *>(gesture);
- g->setSwipeAngle(0);
- QGestureRecognizer::reset(gesture);
-}
-
-////////////////////////////////////////////////////////////////////////
-
-QMacPinchGestureRecognizer::QMacPinchGestureRecognizer()
-{
-}
-
-QGesture *QMacPinchGestureRecognizer::create(QObject * /*target*/)
-{
- return new QPinchGesture;
-}
-
-QGestureRecognizer::Result
-QMacPinchGestureRecognizer::recognize(QGesture *gesture, QObject *obj, QEvent *event)
-{
- if (event->type() == QEvent::NativeGesture && obj->isWidgetType()) {
- QPinchGesture *g = static_cast<QPinchGesture *>(gesture);
- QNativeGestureEvent *ev = static_cast<QNativeGestureEvent*>(event);
- switch(ev->gestureType) {
- case QNativeGestureEvent::GestureBegin:
- reset(gesture);
- g->setStartCenterPoint(static_cast<QWidget*>(obj)->mapFromGlobal(ev->position));
- g->setCenterPoint(g->startCenterPoint());
- g->setChangeFlags(QPinchGesture::CenterPointChanged);
- g->setTotalChangeFlags(g->totalChangeFlags() | g->changeFlags());
- g->setHotSpot(ev->position);
- return QGestureRecognizer::MayBeGesture | QGestureRecognizer::ConsumeEventHint;
- case QNativeGestureEvent::Rotate: {
- g->setLastScaleFactor(g->scaleFactor());
- g->setLastRotationAngle(g->rotationAngle());
- g->setRotationAngle(g->rotationAngle() + ev->percentage);
- g->setChangeFlags(QPinchGesture::RotationAngleChanged);
- g->setTotalChangeFlags(g->totalChangeFlags() | g->changeFlags());
- g->setHotSpot(ev->position);
- return QGestureRecognizer::TriggerGesture | QGestureRecognizer::ConsumeEventHint;
- }
- case QNativeGestureEvent::Zoom:
- g->setLastScaleFactor(g->scaleFactor());
- g->setLastRotationAngle(g->rotationAngle());
- g->setScaleFactor(g->scaleFactor() * (1 + ev->percentage));
- g->setChangeFlags(QPinchGesture::ScaleFactorChanged);
- g->setTotalChangeFlags(g->totalChangeFlags() | g->changeFlags());
- g->setHotSpot(ev->position);
- return QGestureRecognizer::TriggerGesture | QGestureRecognizer::ConsumeEventHint;
- case QNativeGestureEvent::GestureEnd:
- return QGestureRecognizer::FinishGesture | QGestureRecognizer::ConsumeEventHint;
- default:
- break;
- }
- }
-
- return QGestureRecognizer::Ignore;
-}
-
-void QMacPinchGestureRecognizer::reset(QGesture *gesture)
-{
- QPinchGesture *g = static_cast<QPinchGesture *>(gesture);
- g->setChangeFlags(0);
- g->setTotalChangeFlags(0);
- g->setScaleFactor(1.0f);
- g->setTotalScaleFactor(1.0f);
- g->setLastScaleFactor(1.0f);
- g->setRotationAngle(0.0f);
- g->setTotalRotationAngle(0.0f);
- g->setLastRotationAngle(0.0f);
- g->setCenterPoint(QPointF());
- g->setStartCenterPoint(QPointF());
- g->setLastCenterPoint(QPointF());
- QGestureRecognizer::reset(gesture);
-}
-
-////////////////////////////////////////////////////////////////////////
-
-
-QMacPanGestureRecognizer::QMacPanGestureRecognizer() : _panCanceled(true)
-{
-}
-
-QGesture *QMacPanGestureRecognizer::create(QObject *target)
-{
- if (!target)
- return new QPanGesture;
-
- if (QWidget *w = qobject_cast<QWidget *>(target)) {
- w->setAttribute(Qt::WA_AcceptTouchEvents);
- w->setAttribute(Qt::WA_TouchPadAcceptSingleTouchEvents);
- return new QPanGesture;
- }
- return 0;
-}
-
-QGestureRecognizer::Result
-QMacPanGestureRecognizer::recognize(QGesture *gesture, QObject *target, QEvent *event)
-{
- const int panBeginDelay = 300;
- const int panBeginRadius = 3;
-
- QPanGesture *g = static_cast<QPanGesture *>(gesture);
-
- switch (event->type()) {
- case QEvent::TouchBegin: {
- const QTouchEvent *ev = static_cast<const QTouchEvent*>(event);
- if (ev->touchPoints().size() == 1) {
- reset(gesture);
- _startPos = QCursor::pos();
- _panTimer.start(panBeginDelay, target);
- _panCanceled = false;
- return QGestureRecognizer::MayBeGesture;
- }
- break;}
- case QEvent::TouchEnd: {
- if (_panCanceled)
- break;
-
- const QTouchEvent *ev = static_cast<const QTouchEvent*>(event);
- if (ev->touchPoints().size() == 1)
- return QGestureRecognizer::FinishGesture;
- break;}
- case QEvent::TouchUpdate: {
- if (_panCanceled)
- break;
-
- const QTouchEvent *ev = static_cast<const QTouchEvent*>(event);
- if (ev->touchPoints().size() == 1) {
- if (_panTimer.isActive()) {
- // INVARIANT: Still in maybeGesture. Check if the user
- // moved his finger so much that it makes sense to cancel the pan:
- const QPointF p = QCursor::pos();
- if ((p - _startPos).manhattanLength() > panBeginRadius) {
- _panCanceled = true;
- _panTimer.stop();
- return QGestureRecognizer::CancelGesture;
- }
- } else {
- const QPointF p = QCursor::pos();
- const QPointF posOffset = p - _startPos;
- g->setLastOffset(g->offset());
- g->setOffset(QPointF(posOffset.x(), posOffset.y()));
- g->setHotSpot(_startPos);
- return QGestureRecognizer::TriggerGesture;
- }
- } else if (_panTimer.isActive()) {
- // I only want to cancel the pan if the user is pressing
- // more than one finger, and the pan hasn't started yet:
- _panCanceled = true;
- _panTimer.stop();
- return QGestureRecognizer::CancelGesture;
- }
- break;}
- case QEvent::Timer: {
- QTimerEvent *ev = static_cast<QTimerEvent *>(event);
- if (ev->timerId() == _panTimer.timerId()) {
- _panTimer.stop();
- if (_panCanceled)
- break;
- // Begin new pan session!
- _startPos = QCursor::pos();
- g->setHotSpot(_startPos);
- return QGestureRecognizer::TriggerGesture | QGestureRecognizer::ConsumeEventHint;
- }
- break; }
- default:
- break;
- }
-
- return QGestureRecognizer::Ignore;
-}
-
-void QMacPanGestureRecognizer::reset(QGesture *gesture)
-{
- QPanGesture *g = static_cast<QPanGesture *>(gesture);
- _startPos = QPointF();
- _panCanceled = true;
- g->setOffset(QPointF(0, 0));
- g->setLastOffset(QPointF(0, 0));
- g->setAcceleration(qreal(1));
- QGestureRecognizer::reset(gesture);
-}
-
-QT_END_NAMESPACE
-
-#endif // QT_NO_GESTURES
diff --git a/src/widgets/platforms/mac/qmacgesturerecognizer_mac_p.h b/src/widgets/platforms/mac/qmacgesturerecognizer_mac_p.h
deleted file mode 100644
index c77ead3c21..0000000000
--- a/src/widgets/platforms/mac/qmacgesturerecognizer_mac_p.h
+++ /dev/null
@@ -1,104 +0,0 @@
-/****************************************************************************
-**
-** 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 QMACSWIPEGESTURERECOGNIZER_MAC_P_H
-#define QMACSWIPEGESTURERECOGNIZER_MAC_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include "qtimer.h"
-#include "qpoint.h"
-#include "qgesturerecognizer.h"
-
-#ifndef QT_NO_GESTURES
-
-QT_BEGIN_NAMESPACE
-
-class QMacSwipeGestureRecognizer : public QGestureRecognizer
-{
-public:
- QMacSwipeGestureRecognizer();
-
- QGesture *create(QObject *target);
- QGestureRecognizer::Result recognize(QGesture *gesture, QObject *watched, QEvent *event);
- void reset(QGesture *gesture);
-};
-
-class QMacPinchGestureRecognizer : public QGestureRecognizer
-{
-public:
- QMacPinchGestureRecognizer();
-
- QGesture *create(QObject *target);
- QGestureRecognizer::Result recognize(QGesture *gesture, QObject *watched, QEvent *event);
- void reset(QGesture *gesture);
-};
-
-
-class QMacPanGestureRecognizer : public QObject, public QGestureRecognizer
-{
-public:
- QMacPanGestureRecognizer();
-
- QGesture *create(QObject *target);
- QGestureRecognizer::Result recognize(QGesture *gesture, QObject *watched, QEvent *event);
- void reset(QGesture *gesture);
-private:
- QPointF _startPos;
- QBasicTimer _panTimer;
- bool _panCanceled;
-};
-
-
-QT_END_NAMESPACE
-
-#endif // QT_NO_GESTURES
-
-#endif // QMACSWIPEGESTURERECOGNIZER_MAC_P_H
diff --git a/src/widgets/platforms/mac/qmacinputcontext_mac.cpp b/src/widgets/platforms/mac/qmacinputcontext_mac.cpp
deleted file mode 100644
index ee0bf70427..0000000000
--- a/src/widgets/platforms/mac/qmacinputcontext_mac.cpp
+++ /dev/null
@@ -1,124 +0,0 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
-
-#include <qvarlengtharray.h>
-#include <qwidget.h>
-#include <private/qmacinputcontext_p.h>
-#include "qtextformat.h"
-#include <qdebug.h>
-#include <private/qapplication_p.h>
-#include <private/qkeymapper_p.h>
-
-QT_BEGIN_NAMESPACE
-
-extern bool qt_sendSpontaneousEvent(QObject*, QEvent*);
-
-#if (MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_5)
-# define typeRefCon typeSInt32
-# define typeByteCount typeSInt32
-#endif
-
-QMacInputContext::QMacInputContext(QObject *parent)
- : QInputContext(parent), composing(false), recursionGuard(false), textDocument(0),
- keydownEvent(0)
-{
-// createTextDocument();
-}
-
-QMacInputContext::~QMacInputContext()
-{
-}
-
-void
-QMacInputContext::createTextDocument()
-{
-}
-
-
-QString QMacInputContext::language()
-{
- return QString();
-}
-
-
-void QMacInputContext::mouseHandler(int pos, QMouseEvent *e)
-{
- Q_UNUSED(pos);
- Q_UNUSED(e);
-}
-
-
-void QMacInputContext::setFocusWidget(QWidget *w)
-{
- createTextDocument();
- QInputContext::setFocusWidget(w);
-}
-
-
-
-void
-QMacInputContext::initialize()
-{
-}
-
-void
-QMacInputContext::cleanup()
-{
-}
-
-void QMacInputContext::setLastKeydownEvent(EventRef event)
-{
- EventRef tmpEvent = keydownEvent;
- keydownEvent = event;
- if (keydownEvent)
- RetainEvent(keydownEvent);
- if (tmpEvent)
- ReleaseEvent(tmpEvent);
-}
-
-OSStatus
-QMacInputContext::globalEventProcessor(EventHandlerCallRef, EventRef event, void *)
-{
- Q_UNUSED(event);
- return noErr; //we eat the event
-}
-
-QT_END_NAMESPACE
diff --git a/src/widgets/platforms/mac/qmacinputcontext_p.h b/src/widgets/platforms/mac/qmacinputcontext_p.h
deleted file mode 100644
index 7a7ef9687b..0000000000
--- a/src/widgets/platforms/mac/qmacinputcontext_p.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/****************************************************************************
-**
-** 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 QMACINPUTCONTEXT_P_H
-#define QMACINPUTCONTEXT_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 "QtWidgets/qinputcontext.h"
-#include "private/qt_mac_p.h"
-
-QT_BEGIN_NAMESPACE
-
-class Q_WIDGETS_EXPORT QMacInputContext : public QInputContext
-{
- Q_OBJECT
- //Q_DECLARE_PRIVATE(QMacInputContext)
- void createTextDocument();
-public:
- explicit QMacInputContext(QObject* parent = 0);
- virtual ~QMacInputContext();
-
- virtual void setFocusWidget(QWidget *w);
- virtual QString identifierName() { return QLatin1String("mac"); }
- virtual QString language();
-
- virtual void reset();
-
- virtual bool isComposing() const;
-
- static OSStatus globalEventProcessor(EventHandlerCallRef, EventRef, void *);
- static void initialize();
- static void cleanup();
-
- EventRef lastKeydownEvent() { return keydownEvent; }
- void setLastKeydownEvent(EventRef);
-
-protected:
- void mouseHandler(int pos, QMouseEvent *);
-private:
- bool composing;
- bool recursionGuard;
- TSMDocumentID textDocument;
- QString currentText;
- EventRef keydownEvent;
-};
-
-QT_END_NAMESPACE
-
-#endif // QMACINPUTCONTEXT_P_H
diff --git a/src/widgets/platforms/mac/qmime_mac.cpp b/src/widgets/platforms/mac/qmime_mac.cpp
deleted file mode 100644
index 730f672ecd..0000000000
--- a/src/widgets/platforms/mac/qmime_mac.cpp
+++ /dev/null
@@ -1,1126 +0,0 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
-
-#include "qmime.h"
-
-//#define USE_INTERNET_CONFIG
-
-#ifndef USE_INTERNET_CONFIG
-# include "qfile.h"
-# include "qfileinfo.h"
-# include "qtextstream.h"
-# include "qdir.h"
-# include <unistd.h>
-# include <sys/types.h>
-# include <sys/stat.h>
-# include <sys/fcntl.h>
-#endif
-
-#include "qdebug.h"
-#include "qpixmap.h"
-#include "qimagewriter.h"
-#include "qimagereader.h"
-#include "qdatastream.h"
-#include "qbuffer.h"
-#include "qdatetime.h"
-#include "qapplication_p.h"
-#include "qtextcodec.h"
-#include "qregexp.h"
-#include "qurl.h"
-#include "qmap.h"
-#include <private/qt_mac_p.h>
-
-
-#ifdef Q_WS_MAC32
-#include <QuickTime/QuickTime.h>
-#include <qlibrary.h>
-#endif
-
-QT_BEGIN_NAMESPACE
-
-extern CGImageRef qt_mac_createCGImageFromQImage(const QImage &img, const QImage **imagePtr = 0); // qpaintengine_mac.cpp
-
-typedef QList<QMacPasteboardMime*> MimeList;
-Q_GLOBAL_STATIC(MimeList, globalMimeList)
-
-static void cleanup_mimes()
-{
- MimeList *mimes = globalMimeList();
- while (!mimes->isEmpty())
- delete mimes->takeFirst();
-}
-
-Q_GLOBAL_STATIC(QStringList, globalDraggedTypesList)
-
-/*!
- \fn void qRegisterDraggedTypes(const QStringList &types)
- \relates QMacPasteboardMime
-
- Registers the given \a types as custom pasteboard types.
-
- This function should be called to enable the Drag and Drop events
- for custom pasteboard types on Cocoa implementations. This is required
- in addition to a QMacPasteboardMime subclass implementation. By default
- drag and drop is enabled for all standard pasteboard types.
-
- \sa QMacPasteboardMime
-*/
-Q_WIDGETS_EXPORT void qRegisterDraggedTypes(const QStringList &types)
-{
- (*globalDraggedTypesList()) += types;
-}
-
-const QStringList& qEnabledDraggedTypes()
-{
- return (*globalDraggedTypesList());
-}
-
-
-/*****************************************************************************
- QDnD debug facilities
- *****************************************************************************/
-//#define DEBUG_MIME_MAPS
-
-//functions
-extern QString qt_mac_from_pascal_string(const Str255); //qglobal.cpp
-extern void qt_mac_from_pascal_string(QString, Str255, TextEncoding encoding=0, int len=-1); //qglobal.cpp
-
-ScrapFlavorType qt_mac_mime_type = 'CUTE';
-CFStringRef qt_mac_mime_typeUTI = CFSTR("com.pasteboard.trolltech.marker");
-
-/*!
- \class QMacPasteboardMime
- \brief The QMacPasteboardMime class converts between a MIME type and a
- \l{http://developer.apple.com/macosx/uniformtypeidentifiers.html}{Uniform
- Type Identifier (UTI)} format.
- \since 4.2
-
- \ingroup draganddrop
- \inmodule QtWidgets
-
- Qt's drag and drop and clipboard facilities use the MIME
- standard. On X11, this maps trivially to the Xdnd protocol. On
- Mac, although some applications use MIME to describe clipboard
- contents, it is more common to use Apple's UTI format.
-
- QMacPasteboardMime's role is to bridge the gap between MIME and UTI;
- By subclasses this class, one can extend Qt's drag and drop
- and clipboard handling to convert to and from unsupported, or proprietary, UTI formats.
-
- A subclass of QMacPasteboardMime will automatically be registered, and active, upon instantiation.
-
- Qt has predefined support for the following UTIs:
- \list
- \i public.utf8-plain-text - converts to "text/plain"
- \i public.utf16-plain-text - converts to "text/plain"
- \i public.html - converts to "text/html"
- \i public.url - converts to "text/uri-list"
- \i public.file-url - converts to "text/uri-list"
- \i public.tiff - converts to "application/x-qt-image"
- \i public.vcard - converts to "text/plain"
- \i com.apple.traditional-mac-plain-text - converts to "text/plain"
- \i com.apple.pict - converts to "application/x-qt-image"
- \endlist
-
- When working with MIME data, Qt will interate through all instances of QMacPasteboardMime to
- find an instance that can convert to, or from, a specific MIME type. It will do this by calling
- canConvert() on each instance, starting with (and choosing) the last created instance first.
- The actual conversions will be done by using convertToMime() and convertFromMime().
-
- \note The API uses the term "flavor" in some cases. This is for backwards
- compatibility reasons, and should now be understood as UTIs.
-*/
-
-/*! \enum QMacPasteboardMime::QMacPasteboardMimeType
- \internal
-*/
-
-/*!
- Constructs a new conversion object of type \a t, adding it to the
- globally accessed list of available convertors.
-*/
-QMacPasteboardMime::QMacPasteboardMime(char t) : type(t)
-{
- globalMimeList()->append(this);
-}
-
-/*!
- Destroys a conversion object, removing it from the global
- list of available convertors.
-*/
-QMacPasteboardMime::~QMacPasteboardMime()
-{
- if(!QApplication::closingDown())
- globalMimeList()->removeAll(this);
-}
-
-class QMacPasteboardMimeAny : public QMacPasteboardMime {
-private:
-
-public:
- QMacPasteboardMimeAny() : QMacPasteboardMime(MIME_QT_CONVERTOR|MIME_ALL) {
- }
- ~QMacPasteboardMimeAny() {
- }
- QString convertorName();
-
- QString flavorFor(const QString &mime);
- QString mimeFor(QString flav);
- bool canConvert(const QString &mime, QString flav);
- QVariant convertToMime(const QString &mime, QList<QByteArray> data, QString flav);
- QList<QByteArray> convertFromMime(const QString &mime, QVariant data, QString flav);
-};
-
-QString QMacPasteboardMimeAny::convertorName()
-{
- return QLatin1String("Any-Mime");
-}
-
-QString QMacPasteboardMimeAny::flavorFor(const QString &mime)
-{
- // do not handle the mime type name in the drag pasteboard
- if(mime == QLatin1String("application/x-qt-mime-type-name"))
- return QString();
- QString ret = QLatin1String("com.trolltech.anymime.") + mime;
- return ret.replace(QLatin1Char('/'), QLatin1String("--"));
-}
-
-QString QMacPasteboardMimeAny::mimeFor(QString flav)
-{
- const QString any_prefix = QLatin1String("com.trolltech.anymime.");
- if(flav.size() > any_prefix.length() && flav.startsWith(any_prefix))
- return flav.mid(any_prefix.length()).replace(QLatin1String("--"), QLatin1String("/"));
- return QString();
-}
-
-bool QMacPasteboardMimeAny::canConvert(const QString &mime, QString flav)
-{
- return mimeFor(flav) == mime;
-}
-
-QVariant QMacPasteboardMimeAny::convertToMime(const QString &mime, QList<QByteArray> data, QString)
-{
- if(data.count() > 1)
- qWarning("QMacPasteboardMimeAny: Cannot handle multiple member data");
- QVariant ret;
- if (mime == QLatin1String("text/plain"))
- ret = QString::fromUtf8(data.first());
- else
- ret = data.first();
- return ret;
-}
-
-QList<QByteArray> QMacPasteboardMimeAny::convertFromMime(const QString &mime, QVariant data, QString)
-{
- QList<QByteArray> ret;
- if (mime == QLatin1String("text/plain"))
- ret.append(data.toString().toUtf8());
- else
- ret.append(data.toByteArray());
- return ret;
-}
-
-class QMacPasteboardMimeTypeName : public QMacPasteboardMime {
-private:
-
-public:
- QMacPasteboardMimeTypeName() : QMacPasteboardMime(MIME_QT_CONVERTOR|MIME_ALL) {
- }
- ~QMacPasteboardMimeTypeName() {
- }
- QString convertorName();
-
- QString flavorFor(const QString &mime);
- QString mimeFor(QString flav);
- bool canConvert(const QString &mime, QString flav);
- QVariant convertToMime(const QString &mime, QList<QByteArray> data, QString flav);
- QList<QByteArray> convertFromMime(const QString &mime, QVariant data, QString flav);
-};
-
-QString QMacPasteboardMimeTypeName::convertorName()
-{
- return QLatin1String("Qt-Mime-Type");
-}
-
-QString QMacPasteboardMimeTypeName::flavorFor(const QString &mime)
-{
- if(mime == QLatin1String("application/x-qt-mime-type-name"))
- return QLatin1String("com.trolltech.qt.MimeTypeName");
- return QString();
-}
-
-QString QMacPasteboardMimeTypeName::mimeFor(QString)
-{
- return QString();
-}
-
-bool QMacPasteboardMimeTypeName::canConvert(const QString &, QString)
-{
- return false;
-}
-
-QVariant QMacPasteboardMimeTypeName::convertToMime(const QString &, QList<QByteArray>, QString)
-{
- QVariant ret;
- return ret;
-}
-
-QList<QByteArray> QMacPasteboardMimeTypeName::convertFromMime(const QString &, QVariant, QString)
-{
- QList<QByteArray> ret;
- ret.append(QString("x-qt-mime-type-name").toUtf8());
- return ret;
-}
-
-class QMacPasteboardMimePlainText : public QMacPasteboardMime {
-public:
- QMacPasteboardMimePlainText() : QMacPasteboardMime(MIME_ALL) { }
- QString convertorName();
-
- QString flavorFor(const QString &mime);
- QString mimeFor(QString flav);
- bool canConvert(const QString &mime, QString flav);
- QVariant convertToMime(const QString &mime, QList<QByteArray> data, QString flav);
- QList<QByteArray> convertFromMime(const QString &mime, QVariant data, QString flav);
-};
-
-QString QMacPasteboardMimePlainText::convertorName()
-{
- return QLatin1String("PlainText");
-}
-
-QString QMacPasteboardMimePlainText::flavorFor(const QString &mime)
-{
- if (mime == QLatin1String("text/plain"))
- return QLatin1String("com.apple.traditional-mac-plain-text");
- return QString();
-}
-
-QString QMacPasteboardMimePlainText::mimeFor(QString flav)
-{
- if (flav == QLatin1String("com.apple.traditional-mac-plain-text"))
- return QLatin1String("text/plain");
- return QString();
-}
-
-bool QMacPasteboardMimePlainText::canConvert(const QString &mime, QString flav)
-{
- return flavorFor(mime) == flav;
-}
-
-QVariant QMacPasteboardMimePlainText::convertToMime(const QString &mimetype, QList<QByteArray> data, QString flavor)
-{
- if(data.count() > 1)
- qWarning("QMacPasteboardMimePlainText: Cannot handle multiple member data");
- const QByteArray &firstData = data.first();
- QVariant ret;
- if(flavor == QCFString(QLatin1String("com.apple.traditional-mac-plain-text"))) {
- QCFString str(CFStringCreateWithBytes(kCFAllocatorDefault,
- reinterpret_cast<const UInt8 *>(firstData.constData()),
- firstData.size(), CFStringGetSystemEncoding(), false));
- ret = QString(str);
- } else {
- qWarning("QMime::convertToMime: unhandled mimetype: %s", qPrintable(mimetype));
- }
- return ret;
-}
-
-QList<QByteArray> QMacPasteboardMimePlainText::convertFromMime(const QString &, QVariant data, QString flavor)
-{
- QList<QByteArray> ret;
- QString string = data.toString();
- if(flavor == QCFString(QLatin1String("com.apple.traditional-mac-plain-text")))
- ret.append(string.toLatin1());
- return ret;
-}
-
-class QMacPasteboardMimeUnicodeText : public QMacPasteboardMime {
-public:
- QMacPasteboardMimeUnicodeText() : QMacPasteboardMime(MIME_ALL) { }
- QString convertorName();
-
- QString flavorFor(const QString &mime);
- QString mimeFor(QString flav);
- bool canConvert(const QString &mime, QString flav);
- QVariant convertToMime(const QString &mime, QList<QByteArray> data, QString flav);
- QList<QByteArray> convertFromMime(const QString &mime, QVariant data, QString flav);
-};
-
-QString QMacPasteboardMimeUnicodeText::convertorName()
-{
- return QLatin1String("UnicodeText");
-}
-
-QString QMacPasteboardMimeUnicodeText::flavorFor(const QString &mime)
-{
- if (mime == QLatin1String("text/plain"))
- return QLatin1String("public.utf16-plain-text");
- int i = mime.indexOf(QLatin1String("charset="));
- if (i >= 0) {
- QString cs(mime.mid(i+8).toLower());
- i = cs.indexOf(QLatin1Char(';'));
- if (i>=0)
- cs = cs.left(i);
- if (cs == QLatin1String("system"))
- return QLatin1String("public.utf8-plain-text");
- else if (cs == QLatin1String("iso-10646-ucs-2")
- || cs == QLatin1String("utf16"))
- return QLatin1String("public.utf16-plain-text");
- }
- return QString();
-}
-
-QString QMacPasteboardMimeUnicodeText::mimeFor(QString flav)
-{
- if (flav == QLatin1String("public.utf16-plain-text") || flav == QLatin1String("public.utf8-plain-text"))
- return QLatin1String("text/plain");
- return QString();
-}
-
-bool QMacPasteboardMimeUnicodeText::canConvert(const QString &mime, QString flav)
-{
- return flavorFor(mime) == flav;
-}
-
-QVariant QMacPasteboardMimeUnicodeText::convertToMime(const QString &mimetype, QList<QByteArray> data, QString flavor)
-{
- if(data.count() > 1)
- qWarning("QMacPasteboardMimeUnicodeText: Cannot handle multiple member data");
- const QByteArray &firstData = data.first();
- // I can only handle two types (system and unicode) so deal with them that way
- QVariant ret;
- if(flavor == QLatin1String("public.utf8-plain-text")) {
- QCFString str(CFStringCreateWithBytes(kCFAllocatorDefault,
- reinterpret_cast<const UInt8 *>(firstData.constData()),
- firstData.size(), CFStringGetSystemEncoding(), false));
- ret = QString(str);
- } else if (flavor == QLatin1String("public.utf16-plain-text")) {
- ret = QString(reinterpret_cast<const QChar *>(firstData.constData()),
- firstData.size() / sizeof(QChar));
- } else {
- qWarning("QMime::convertToMime: unhandled mimetype: %s", qPrintable(mimetype));
- }
- return ret;
-}
-
-QList<QByteArray> QMacPasteboardMimeUnicodeText::convertFromMime(const QString &, QVariant data, QString flavor)
-{
- QList<QByteArray> ret;
- QString string = data.toString();
- if(flavor == QLatin1String("public.utf8-plain-text"))
- ret.append(string.toUtf8());
- else if (flavor == QLatin1String("public.utf16-plain-text"))
- ret.append(QByteArray((char*)string.utf16(), string.length()*2));
- return ret;
-}
-
-class QMacPasteboardMimeHTMLText : public QMacPasteboardMime {
-public:
- QMacPasteboardMimeHTMLText() : QMacPasteboardMime(MIME_ALL) { }
- QString convertorName();
-
- QString flavorFor(const QString &mime);
- QString mimeFor(QString flav);
- bool canConvert(const QString &mime, QString flav);
- QVariant convertToMime(const QString &mime, QList<QByteArray> data, QString flav);
- QList<QByteArray> convertFromMime(const QString &mime, QVariant data, QString flav);
-};
-
-QString QMacPasteboardMimeHTMLText::convertorName()
-{
- return QLatin1String("HTML");
-}
-
-QString QMacPasteboardMimeHTMLText::flavorFor(const QString &mime)
-{
- if (mime == QLatin1String("text/html"))
- return QLatin1String("public.html");
- return QString();
-}
-
-QString QMacPasteboardMimeHTMLText::mimeFor(QString flav)
-{
- if (flav == QLatin1String("public.html"))
- return QLatin1String("text/html");
- return QString();
-}
-
-bool QMacPasteboardMimeHTMLText::canConvert(const QString &mime, QString flav)
-{
- return flavorFor(mime) == flav;
-}
-
-QVariant QMacPasteboardMimeHTMLText::convertToMime(const QString &mimeType, QList<QByteArray> data, QString flavor)
-{
- if (!canConvert(mimeType, flavor))
- return QVariant();
- if (data.count() > 1)
- qWarning("QMacPasteboardMimeHTMLText: Cannot handle multiple member data");
- return data.first();
-}
-
-QList<QByteArray> QMacPasteboardMimeHTMLText::convertFromMime(const QString &mime, QVariant data, QString flavor)
-{
- QList<QByteArray> ret;
- if (!canConvert(mime, flavor))
- return ret;
- ret.append(data.toByteArray());
- return ret;
-}
-
-
-#ifdef Q_WS_MAC32
-
-// This can be removed once 10.6 is the minimum (or we have to require 64-bit) whichever comes first.
-
-typedef ComponentResult (*PtrGraphicsImportSetDataHandle)(GraphicsImportComponent, Handle);
-typedef ComponentResult (*PtrGraphicsImportCreateCGImage)(GraphicsImportComponent, CGImageRef*, UInt32);
-typedef ComponentResult (*PtrGraphicsExportSetInputCGImage)(GraphicsExportComponent, CGImageRef);
-typedef ComponentResult (*PtrGraphicsExportSetOutputHandle)(GraphicsExportComponent, Handle);
-typedef ComponentResult (*PtrGraphicsExportDoExport)(GraphicsExportComponent, unsigned long *);
-
-static PtrGraphicsImportSetDataHandle ptrGraphicsImportSetDataHandle = 0;
-static PtrGraphicsImportCreateCGImage ptrGraphicsImportCreateCGImage = 0;
-static PtrGraphicsExportSetInputCGImage ptrGraphicsExportSetInputCGImage = 0;
-static PtrGraphicsExportSetOutputHandle ptrGraphicsExportSetOutputHandle = 0;
-static PtrGraphicsExportDoExport ptrGraphicsExportDoExport = 0;
-
-static bool resolveMimeQuickTimeSymbols()
-{
- if (ptrGraphicsImportSetDataHandle == 0) {
- QLibrary library(QLatin1String("/System/Library/Frameworks/QuickTime.framework/QuickTime"));
- ptrGraphicsImportSetDataHandle = reinterpret_cast<PtrGraphicsImportSetDataHandle>(library.resolve("GraphicsImportSetDataHandle"));
- ptrGraphicsImportCreateCGImage = reinterpret_cast<PtrGraphicsImportCreateCGImage>(library.resolve("GraphicsImportCreateCGImage"));
- ptrGraphicsExportSetInputCGImage = reinterpret_cast<PtrGraphicsExportSetInputCGImage>(library.resolve("GraphicsExportSetInputCGImage"));
- ptrGraphicsExportSetOutputHandle = reinterpret_cast<PtrGraphicsExportSetOutputHandle>(library.resolve("GraphicsExportSetOutputHandle"));
- ptrGraphicsExportDoExport = reinterpret_cast<PtrGraphicsExportDoExport>(library.resolve("GraphicsExportDoExport"));
- }
-
- return ptrGraphicsImportSetDataHandle != 0
- && ptrGraphicsImportCreateCGImage != 0 && ptrGraphicsExportSetInputCGImage != 0
- && ptrGraphicsExportSetOutputHandle != 0 && ptrGraphicsExportDoExport != 0;
-}
-
-class QMacPasteboardMimePict : public QMacPasteboardMime {
-public:
- QMacPasteboardMimePict() : QMacPasteboardMime(MIME_ALL) { }
- QString convertorName();
-
- QString flavorFor(const QString &mime);
- QString mimeFor(QString flav);
- bool canConvert(const QString &mime, QString flav);
- QVariant convertToMime(const QString &mime, QList<QByteArray> data, QString flav);
- QList<QByteArray> convertFromMime(const QString &mime, QVariant data, QString flav);
-};
-
-QString QMacPasteboardMimePict::convertorName()
-{
- return QLatin1String("Pict");
-}
-
-QString QMacPasteboardMimePict::flavorFor(const QString &mime)
-{
- if(mime.startsWith(QLatin1String("application/x-qt-image")))
- return QLatin1String("com.apple.pict");
- return QString();
-}
-
-QString QMacPasteboardMimePict::mimeFor(QString flav)
-{
- if(flav == QLatin1String("com.apple.pict"))
- return QLatin1String("application/x-qt-image");
- return QString();
-}
-
-bool QMacPasteboardMimePict::canConvert(const QString &mime, QString flav)
-{
- return flav == QLatin1String("com.apple.pict")
- && mime == QLatin1String("application/x-qt-image");
-}
-
-
-QVariant QMacPasteboardMimePict::convertToMime(const QString &mime, QList<QByteArray> data, QString flav)
-{
- if(data.count() > 1)
- qWarning("QMacPasteboardMimePict: Cannot handle multiple member data");
- QVariant ret;
- if (!resolveMimeQuickTimeSymbols())
- return ret;
-
- if(!canConvert(mime, flav))
- return ret;
- const QByteArray &a = data.first();
-
- // This function expects the 512 header (just to skip it, so create the extra space for it).
- Handle pic = NewHandle(a.size() + 512);
- memcpy(*pic + 512, a.constData(), a.size());
-
- GraphicsImportComponent graphicsImporter;
- ComponentResult result = OpenADefaultComponent(GraphicsImporterComponentType,
- kQTFileTypePicture, &graphicsImporter);
- QCFType<CGImageRef> cgImage;
- if (!result)
- result = ptrGraphicsImportSetDataHandle(graphicsImporter, pic);
- if (!result)
- result = ptrGraphicsImportCreateCGImage(graphicsImporter, &cgImage,
- kGraphicsImportCreateCGImageUsingCurrentSettings);
- if (!result)
- ret = QVariant(QPixmap::fromMacCGImageRef(cgImage).toImage());
- CloseComponent(graphicsImporter);
- DisposeHandle(pic);
- return ret;
-}
-
-QList<QByteArray> QMacPasteboardMimePict::convertFromMime(const QString &mime, QVariant variant,
- QString flav)
-{
- QList<QByteArray> ret;
- if (!resolveMimeQuickTimeSymbols())
- return ret;
-
- if (!canConvert(mime, flav))
- return ret;
- QCFType<CGImageRef> cgimage = qt_mac_createCGImageFromQImage(qvariant_cast<QImage>(variant));
- Handle pic = NewHandle(0);
- GraphicsExportComponent graphicsExporter;
- ComponentResult result = OpenADefaultComponent(GraphicsExporterComponentType,
- kQTFileTypePicture, &graphicsExporter);
- if (!result) {
- unsigned long sizeWritten;
- result = ptrGraphicsExportSetInputCGImage(graphicsExporter, cgimage);
- if (!result)
- result = ptrGraphicsExportSetOutputHandle(graphicsExporter, pic);
- if (!result)
- result = ptrGraphicsExportDoExport(graphicsExporter, &sizeWritten);
-
- CloseComponent(graphicsExporter);
- }
-
- int size = GetHandleSize((Handle)pic);
- // Skip the Picture File header (512 bytes) and feed the raw data
- QByteArray ar(reinterpret_cast<char *>(*pic + 512), size - 512);
- ret.append(ar);
- DisposeHandle(pic);
- return ret;
-}
-
-
-#endif //Q_WS_MAC32
-
-class QMacPasteboardMimeTiff : public QMacPasteboardMime {
-public:
- QMacPasteboardMimeTiff() : QMacPasteboardMime(MIME_ALL) { }
- QString convertorName();
-
- QString flavorFor(const QString &mime);
- QString mimeFor(QString flav);
- bool canConvert(const QString &mime, QString flav);
- QVariant convertToMime(const QString &mime, QList<QByteArray> data, QString flav);
- QList<QByteArray> convertFromMime(const QString &mime, QVariant data, QString flav);
-};
-
-QString QMacPasteboardMimeTiff::convertorName()
-{
- return QLatin1String("Tiff");
-}
-
-QString QMacPasteboardMimeTiff::flavorFor(const QString &mime)
-{
- if(mime.startsWith(QLatin1String("application/x-qt-image")))
- return QLatin1String("public.tiff");
- return QString();
-}
-
-QString QMacPasteboardMimeTiff::mimeFor(QString flav)
-{
- if(flav == QLatin1String("public.tiff"))
- return QLatin1String("application/x-qt-image");
- return QString();
-}
-
-bool QMacPasteboardMimeTiff::canConvert(const QString &mime, QString flav)
-{
- return flav == QLatin1String("public.tiff") && mime == QLatin1String("application/x-qt-image");
-}
-
-QVariant QMacPasteboardMimeTiff::convertToMime(const QString &mime, QList<QByteArray> data, QString flav)
-{
- if(data.count() > 1)
- qWarning("QMacPasteboardMimeTiff: Cannot handle multiple member data");
- QVariant ret;
- if (!canConvert(mime, flav))
- return ret;
- const QByteArray &a = data.first();
- QCFType<CGImageRef> image;
- QCFType<CFDataRef> tiffData = CFDataCreateWithBytesNoCopy(0,
- reinterpret_cast<const UInt8 *>(a.constData()),
- a.size(), kCFAllocatorNull);
- QCFType<CGImageSourceRef> imageSource = CGImageSourceCreateWithData(tiffData, 0);
- image = CGImageSourceCreateImageAtIndex(imageSource, 0, 0);
-
- if (image != 0)
- ret = QVariant(QPixmap::fromMacCGImageRef(image).toImage());
- return ret;
-}
-
-QList<QByteArray> QMacPasteboardMimeTiff::convertFromMime(const QString &mime, QVariant variant, QString flav)
-{
- QList<QByteArray> ret;
- if (!canConvert(mime, flav))
- return ret;
-
- QImage img = qvariant_cast<QImage>(variant);
- QCFType<CGImageRef> cgimage = qt_mac_createCGImageFromQImage(img);
-#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4)
- if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_4) {
- QCFType<CFMutableDataRef> data = CFDataCreateMutable(0, 0);
- QCFType<CGImageDestinationRef> imageDestination = CGImageDestinationCreateWithData(data, kUTTypeTIFF, 1, 0);
- if (imageDestination != 0) {
- CFTypeRef keys[2];
- QCFType<CFTypeRef> values[2];
- QCFType<CFDictionaryRef> options;
- keys[0] = kCGImagePropertyPixelWidth;
- keys[1] = kCGImagePropertyPixelHeight;
- int width = img.width();
- int height = img.height();
- values[0] = CFNumberCreate(0, kCFNumberIntType, &width);
- values[1] = CFNumberCreate(0, kCFNumberIntType, &height);
- options = CFDictionaryCreate(0, reinterpret_cast<const void **>(keys),
- reinterpret_cast<const void **>(values), 2,
- &kCFTypeDictionaryKeyCallBacks,
- &kCFTypeDictionaryValueCallBacks);
- CGImageDestinationAddImage(imageDestination, cgimage, options);
- CGImageDestinationFinalize(imageDestination);
- }
- QByteArray ar(CFDataGetLength(data), 0);
- CFDataGetBytes(data,
- CFRangeMake(0, ar.size()),
- reinterpret_cast<UInt8 *>(ar.data()));
- ret.append(ar);
- } else
-#endif
- {
-#ifdef Q_WS_MAC32
- Handle tiff = NewHandle(0);
- if (resolveMimeQuickTimeSymbols()) {
- GraphicsExportComponent graphicsExporter;
- ComponentResult result = OpenADefaultComponent(GraphicsExporterComponentType,
- kQTFileTypeTIFF, &graphicsExporter);
- if (!result) {
- unsigned long sizeWritten;
- result = ptrGraphicsExportSetInputCGImage(graphicsExporter, cgimage);
- if (!result)
- result = ptrGraphicsExportSetOutputHandle(graphicsExporter, tiff);
- if (!result)
- result = ptrGraphicsExportDoExport(graphicsExporter, &sizeWritten);
-
- CloseComponent(graphicsExporter);
- }
- }
- int size = GetHandleSize((Handle)tiff);
- QByteArray ar(reinterpret_cast<char *>(*tiff), size);
- ret.append(ar);
- DisposeHandle(tiff);
-#endif
- }
- return ret;
-}
-
-
-class QMacPasteboardMimeFileUri : public QMacPasteboardMime {
-public:
- QMacPasteboardMimeFileUri() : QMacPasteboardMime(MIME_ALL) { }
- QString convertorName();
-
- QString flavorFor(const QString &mime);
- QString mimeFor(QString flav);
- bool canConvert(const QString &mime, QString flav);
- QVariant convertToMime(const QString &mime, QList<QByteArray> data, QString flav);
- QList<QByteArray> convertFromMime(const QString &mime, QVariant data, QString flav);
-};
-
-QString QMacPasteboardMimeFileUri::convertorName()
-{
- return QLatin1String("FileURL");
-}
-
-QString QMacPasteboardMimeFileUri::flavorFor(const QString &mime)
-{
- if (mime == QLatin1String("text/uri-list"))
- return QCFString(UTTypeCreatePreferredIdentifierForTag(kUTTagClassOSType, CFSTR("furl"), 0));
- return QString();
-}
-
-QString QMacPasteboardMimeFileUri::mimeFor(QString flav)
-{
- if (flav == QCFString(UTTypeCreatePreferredIdentifierForTag(kUTTagClassOSType, CFSTR("furl"), 0)))
- return QLatin1String("text/uri-list");
- return QString();
-}
-
-bool QMacPasteboardMimeFileUri::canConvert(const QString &mime, QString flav)
-{
- return mime == QLatin1String("text/uri-list")
- && flav == QCFString(UTTypeCreatePreferredIdentifierForTag(kUTTagClassOSType, CFSTR("furl"), 0));
-}
-
-QVariant QMacPasteboardMimeFileUri::convertToMime(const QString &mime, QList<QByteArray> data, QString flav)
-{
- if(!canConvert(mime, flav))
- return QVariant();
- QList<QVariant> ret;
- for(int i = 0; i < data.size(); ++i) {
- QUrl url = QUrl::fromEncoded(data.at(i));
- if (url.host().toLower() == QLatin1String("localhost"))
- url.setHost(QString());
- url.setPath(url.path().normalized(QString::NormalizationForm_C));
- ret.append(url);
- }
- return QVariant(ret);
-}
-
-QList<QByteArray> QMacPasteboardMimeFileUri::convertFromMime(const QString &mime, QVariant data, QString flav)
-{
- QList<QByteArray> ret;
- if (!canConvert(mime, flav))
- return ret;
- QList<QVariant> urls = data.toList();
- for(int i = 0; i < urls.size(); ++i) {
- QUrl url = urls.at(i).toUrl();
- if (url.scheme().isEmpty())
- url.setScheme(QLatin1String("file"));
- if (url.scheme().toLower() == QLatin1String("file")) {
- if (url.host().isEmpty())
- url.setHost(QLatin1String("localhost"));
- url.setPath(url.path().normalized(QString::NormalizationForm_D));
- }
- ret.append(url.toEncoded());
- }
- return ret;
-}
-
-class QMacPasteboardMimeUrl : public QMacPasteboardMime {
-public:
- QMacPasteboardMimeUrl() : QMacPasteboardMime(MIME_ALL) { }
- QString convertorName();
-
- QString flavorFor(const QString &mime);
- QString mimeFor(QString flav);
- bool canConvert(const QString &mime, QString flav);
- QVariant convertToMime(const QString &mime, QList<QByteArray> data, QString flav);
- QList<QByteArray> convertFromMime(const QString &mime, QVariant data, QString flav);
-};
-
-QString QMacPasteboardMimeUrl::convertorName()
-{
- return QLatin1String("URL");
-}
-
-QString QMacPasteboardMimeUrl::flavorFor(const QString &mime)
-{
- if(mime.startsWith(QLatin1String("text/uri-list")))
- return QLatin1String("public.url");
- return QString();
-}
-
-QString QMacPasteboardMimeUrl::mimeFor(QString flav)
-{
- if(flav == QLatin1String("public.url"))
- return QLatin1String("text/uri-list");
- return QString();
-}
-
-bool QMacPasteboardMimeUrl::canConvert(const QString &mime, QString flav)
-{
- return flav == QLatin1String("public.url")
- && mime == QLatin1String("text/uri-list");
-}
-
-QVariant QMacPasteboardMimeUrl::convertToMime(const QString &mime, QList<QByteArray> data, QString flav)
-{
- if(!canConvert(mime, flav))
- return QVariant();
-
- QList<QVariant> ret;
- for (int i=0; i<data.size(); ++i) {
- QUrl url = QUrl::fromEncoded(data.at(i));
- if (url.host().toLower() == QLatin1String("localhost"))
- url.setHost(QString());
- url.setPath(url.path().normalized(QString::NormalizationForm_C));
- ret.append(url);
- }
- return QVariant(ret);
-}
-
-QList<QByteArray> QMacPasteboardMimeUrl::convertFromMime(const QString &mime, QVariant data, QString flav)
-{
- QList<QByteArray> ret;
- if (!canConvert(mime, flav))
- return ret;
-
- QList<QVariant> urls = data.toList();
- for(int i=0; i<urls.size(); ++i) {
- QUrl url = urls.at(i).toUrl();
- if (url.scheme().isEmpty())
- url.setScheme(QLatin1String("file"));
- if (url.scheme().toLower() == QLatin1String("file")) {
- if (url.host().isEmpty())
- url.setHost(QLatin1String("localhost"));
- url.setPath(url.path().normalized(QString::NormalizationForm_D));
- }
- ret.append(url.toEncoded());
- }
- return ret;
-}
-
-class QMacPasteboardMimeVCard : public QMacPasteboardMime
-{
-public:
- QMacPasteboardMimeVCard() : QMacPasteboardMime(MIME_ALL){ }
- QString convertorName();
-
- QString flavorFor(const QString &mime);
- QString mimeFor(QString flav);
- bool canConvert(const QString &mime, QString flav);
- QVariant convertToMime(const QString &mime, QList<QByteArray> data, QString flav);
- QList<QByteArray> convertFromMime(const QString &mime, QVariant data, QString flav);
-};
-
-QString QMacPasteboardMimeVCard::convertorName()
-{
- return QString("VCard");
-}
-
-bool QMacPasteboardMimeVCard::canConvert(const QString &mime, QString flav)
-{
- return mimeFor(flav) == mime;
-}
-
-QString QMacPasteboardMimeVCard::flavorFor(const QString &mime)
-{
- if(mime.startsWith(QLatin1String("text/plain")))
- return QLatin1String("public.vcard");
- return QString();
-}
-
-QString QMacPasteboardMimeVCard::mimeFor(QString flav)
-{
- if (flav == QLatin1String("public.vcard"))
- return QLatin1String("text/plain");
- return QString();
-}
-
-QVariant QMacPasteboardMimeVCard::convertToMime(const QString &mime, QList<QByteArray> data, QString)
-{
- QByteArray cards;
- if (mime == QLatin1String("text/plain")) {
- for (int i=0; i<data.size(); ++i)
- cards += data[i];
- }
- return QVariant(cards);
-}
-
-QList<QByteArray> QMacPasteboardMimeVCard::convertFromMime(const QString &mime, QVariant data, QString)
-{
- QList<QByteArray> ret;
- if (mime == QLatin1String("text/plain"))
- ret.append(data.toString().toUtf8());
- return ret;
-}
-
-
-/*!
- \internal
-
- This is an internal function.
-*/
-void QMacPasteboardMime::initialize()
-{
- if(globalMimeList()->isEmpty()) {
- qAddPostRoutine(cleanup_mimes);
-
- //standard types that we wrap
- new QMacPasteboardMimeTiff;
-#ifdef Q_WS_MAC32
- // 10.6 does automatic synthesis to and from PICT to standard image types (like TIFF),
- // so don't bother doing it ourselves, especially since it's not available in 64-bit.
- if (QSysInfo::MacintoshVersion < QSysInfo::MV_10_6)
- new QMacPasteboardMimePict;
-#endif
- new QMacPasteboardMimeUnicodeText;
- new QMacPasteboardMimePlainText;
- new QMacPasteboardMimeHTMLText;
- new QMacPasteboardMimeFileUri;
- new QMacPasteboardMimeUrl;
- new QMacPasteboardMimeTypeName;
- new QMacPasteboardMimeVCard;
- //make sure our "non-standard" types are always last! --Sam
- new QMacPasteboardMimeAny;
- }
-}
-
-/*!
- Returns the most-recently created QMacPasteboardMime of type \a t that can convert
- between the \a mime and \a flav formats. Returns 0 if no such convertor
- exists.
-*/
-QMacPasteboardMime*
-QMacPasteboardMime::convertor(uchar t, const QString &mime, QString flav)
-{
- MimeList *mimes = globalMimeList();
- for(MimeList::const_iterator it = mimes->constBegin(); it != mimes->constEnd(); ++it) {
-#ifdef DEBUG_MIME_MAPS
- qDebug("QMacPasteboardMime::convertor: seeing if %s (%d) can convert %s to %d[%c%c%c%c] [%d]",
- (*it)->convertorName().toLatin1().constData(),
- (*it)->type & t, mime.toLatin1().constData(),
- flav, (flav >> 24) & 0xFF, (flav >> 16) & 0xFF, (flav >> 8) & 0xFF, (flav) & 0xFF,
- (*it)->canConvert(mime,flav));
- for(int i = 0; i < (*it)->countFlavors(); ++i) {
- int f = (*it)->flavor(i);
- qDebug(" %d) %d[%c%c%c%c] [%s]", i, f,
- (f >> 24) & 0xFF, (f >> 16) & 0xFF, (f >> 8) & 0xFF, (f) & 0xFF,
- (*it)->convertorName().toLatin1().constData());
- }
-#endif
- if(((*it)->type & t) && (*it)->canConvert(mime, flav))
- return (*it);
- }
- return 0;
-}
-/*!
- Returns a MIME type of type \a t for \a flav, or 0 if none exists.
-*/
-QString QMacPasteboardMime::flavorToMime(uchar t, QString flav)
-{
- MimeList *mimes = globalMimeList();
- for(MimeList::const_iterator it = mimes->constBegin(); it != mimes->constEnd(); ++it) {
-#ifdef DEBUG_MIME_MAPS
- qDebug("QMacMIme::flavorToMime: attempting %s (%d) for flavor %d[%c%c%c%c] [%s]",
- (*it)->convertorName().toLatin1().constData(),
- (*it)->type & t, flav, (flav >> 24) & 0xFF, (flav >> 16) & 0xFF, (flav >> 8) & 0xFF, (flav) & 0xFF,
- (*it)->mimeFor(flav).toLatin1().constData());
-
-#endif
- if((*it)->type & t) {
- QString mimeType = (*it)->mimeFor(flav);
- if(!mimeType.isNull())
- return mimeType;
- }
- }
- return QString();
-}
-
-/*!
- Returns a list of all currently defined QMacPasteboardMime objects of type \a t.
-*/
-QList<QMacPasteboardMime*> QMacPasteboardMime::all(uchar t)
-{
- MimeList ret;
- MimeList *mimes = globalMimeList();
- for(MimeList::const_iterator it = mimes->constBegin(); it != mimes->constEnd(); ++it) {
- if((*it)->type & t)
- ret.append((*it));
- }
- return ret;
-}
-
-
-/*!
- \fn QString QMacPasteboardMime::convertorName()
-
- Returns a name for the convertor.
-
- All subclasses must reimplement this pure virtual function.
-*/
-
-/*!
- \fn bool QMacPasteboardMime::canConvert(const QString &mime, QString flav)
-
- Returns true if the convertor can convert (both ways) between
- \a mime and \a flav; otherwise returns false.
-
- All subclasses must reimplement this pure virtual function.
-*/
-
-/*!
- \fn QString QMacPasteboardMime::mimeFor(QString flav)
-
- Returns the MIME UTI used for Mac flavor \a flav, or 0 if this
- convertor does not support \a flav.
-
- All subclasses must reimplement this pure virtual function.
-*/
-
-/*!
- \fn QString QMacPasteboardMime::flavorFor(const QString &mime)
-
- Returns the Mac UTI used for MIME type \a mime, or 0 if this
- convertor does not support \a mime.
-
- All subclasses must reimplement this pure virtual function.
-*/
-
-/*!
- \fn QVariant QMacPasteboardMime::convertToMime(const QString &mime, QList<QByteArray> data, QString flav)
-
- Returns \a data converted from Mac UTI \a flav to MIME type \a
- mime.
-
- Note that Mac flavors must all be self-terminating. The input \a
- data may contain trailing data.
-
- All subclasses must reimplement this pure virtual function.
-*/
-
-/*!
- \fn QList<QByteArray> QMacPasteboardMime::convertFromMime(const QString &mime, QVariant data, QString flav)
-
- Returns \a data converted from MIME type \a mime
- to Mac UTI \a flav.
-
- Note that Mac flavors must all be self-terminating. The return
- value may contain trailing data.
-
- All subclasses must reimplement this pure virtual function.
-*/
-
-
-QT_END_NAMESPACE
diff --git a/src/widgets/platforms/mac/qnsframeview_mac_p.h b/src/widgets/platforms/mac/qnsframeview_mac_p.h
deleted file mode 100644
index 1534ad1461..0000000000
--- a/src/widgets/platforms/mac/qnsframeview_mac_p.h
+++ /dev/null
@@ -1,154 +0,0 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of qapplication_*.cpp, qwidget*.cpp, qcolor_x11.cpp, qfiledialog.cpp
-// and many other. This header file may change from version to version
-// without notice, or even be removed.
-//
-// We mean it.
-//
-
-// Private AppKit class (dumped from classdump).
-
-#import <Cocoa/Cocoa.h>
-
-@interface NSFrameView : NSView
-{
- unsigned int styleMask;
- NSString *_title;
- NSCell *titleCell;
- NSButton *closeButton;
- NSButton *zoomButton;
- NSButton *minimizeButton;
- char resizeByIncrement;
- char frameNeedsDisplay;
- unsigned char tabViewCount;
- NSSize resizeParameter;
- int shadowState;
-}
-
-+ (void)initialize;
-+ (void)initTitleCell:fp8 styleMask:(unsigned int)fp12;
-+ (struct _NSRect)frameRectForContentRect:(struct _NSRect)fp8 styleMask:(unsigned int)fp24;
-+ (struct _NSRect)contentRectForFrameRect:(struct _NSRect)fp8 styleMask:(unsigned int)fp24;
-+ (struct _NSSize)minFrameSizeForMinContentSize:(struct _NSSize)fp8 styleMask:(unsigned int)fp16;
-+ (struct _NSSize)minContentSizeForMinFrameSize:(struct _NSSize)fp8 styleMask:(unsigned int)fp16;
-+ (float)minFrameWidthWithTitle:fp8 styleMask:(unsigned int)fp12;
-+ (unsigned int)_validateStyleMask:(unsigned int)fp8;
-- initWithFrame:(struct _NSRect)fp8 styleMask:(unsigned int)fp24 owner:fp28;
-- initWithFrame:(struct _NSRect)fp8;
-- (void)dealloc;
-- (void)shapeWindow;
-- (void)tileAndSetWindowShape:(char)fp8;
-- (void)tile;
-- (void)drawRect:(struct _NSRect)fp8;
-- (void)_drawFrameRects:(struct _NSRect)fp8;
-- (void)drawFrame:(struct _NSRect)fp8;
-- (void)drawThemeContentFill:(struct _NSRect)fp8 inView:fp24;
-- (void)drawWindowBackgroundRect:(struct _NSRect)fp8;
-- (void)drawWindowBackgroundRegion:(void *)fp8;
-- (float)contentAlpha;
-- (void)_windowChangedKeyState;
-- (void)_updateButtonState;
-- (char)_isSheet;
-- (char)_isUtility;
-- (void)setShadowState:(int)fp8;
-- (int)shadowState;
-- (char)_canHaveToolbar;
-- (char)_toolbarIsInTransition;
-- (char)_toolbarIsShown;
-- (char)_toolbarIsHidden;
-- (void)_showToolbarWithAnimation:(char)fp8;
-- (void)_hideToolbarWithAnimation:(char)fp8;
-- (float)_distanceFromToolbarBaseToTitlebar;
-- (int)_shadowType;
-- (unsigned int)_shadowFlags;
-- (void)_setShadowParameters;
-- (void)_drawFrameShadowAndFlushContext:fp8;
-- (void)setUpGState;
-- (void)adjustHalftonePhase;
-- (void)systemColorsDidChange:fp8;
-- frameColor;
-- contentFill;
-- (void)tabViewAdded;
-- (void)tabViewRemoved;
-- title;
-- (void)setTitle:fp8;
-- titleCell;
-- (void)initTitleCell:fp8;
-- (void)setResizeIncrements:(struct _NSSize)fp8;
-- (struct _NSSize)resizeIncrements;
-- (void)setAspectRatio:(struct _NSSize)fp8;
-- (struct _NSSize)aspectRatio;
-- (unsigned int)styleMask;
-- representedFilename;
-- (void)setRepresentedFilename:fp8;
-- (void)setDocumentEdited:(char)fp8;
-- (void)_setFrameNeedsDisplay:(char)fp8;
-- (char)frameNeedsDisplay;
-- titleFont;
-- (struct _NSRect)_maxTitlebarTitleRect;
-- (struct _NSRect)titlebarRect;
-- (void)_setUtilityWindow:(char)fp8;
-- (void)_setNonactivatingPanel:(char)fp8;
-- (void)setIsClosable:(char)fp8;
-- (void)setIsResizable:(char)fp8;
-- closeButton;
-- minimizeButton;
-- zoomButton;
-- (struct _NSSize)miniaturizedSize;
-- (void)_clearDragMargins;
-- (void)_resetDragMargins;
-- (void)setTitle:fp8 andDefeatWrap:(char)fp12;
-- (struct _NSRect)frameRectForContentRect:(struct _NSRect)fp8 styleMask:(unsigned int)fp24;
-- (struct _NSRect)contentRectForFrameRect:(struct _NSRect)fp8 styleMask:(unsigned int)fp24;
-- (struct _NSSize)minFrameSizeForMinContentSize:(struct _NSSize)fp8 styleMask:(unsigned int)fp16;
-- (struct _NSRect)dragRectForFrameRect:(struct _NSRect)fp8;
-- (struct _NSRect)contentRect;
-- (struct _NSSize)minFrameSize;
-- (void)_recursiveDisplayRectIfNeededIgnoringOpacity:(struct _NSRect)fp8 isVisibleRect:(char)fp24 rectIsVisibleRectForView:fp28 topView:(char)fp32;
-
-@end
diff --git a/src/widgets/platforms/mac/qnsthemeframe_mac_p.h b/src/widgets/platforms/mac/qnsthemeframe_mac_p.h
deleted file mode 100644
index 1768ad8687..0000000000
--- a/src/widgets/platforms/mac/qnsthemeframe_mac_p.h
+++ /dev/null
@@ -1,246 +0,0 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of qapplication_*.cpp, qwidget*.cpp, qcolor_x11.cpp, qfiledialog.cpp
-// and many other. This header file may change from version to version
-// without notice, or even be removed.
-//
-// We mean it.
-//
-
-// Private AppKit class (dumped from classdump).
-
-#import <Cocoa/Cocoa.h>
-#import "qnstitledframe_mac_p.h"
-
-@interface NSThemeFrame : NSTitledFrame
-{
- NSButton *toolbarButton;
- int toolbarVisibleStatus;
- NSImage *showToolbarTransitionImage;
- NSSize showToolbarPreWindowSize;
- NSButton *modeButton;
- int leftGroupTrackingTagNum;
- int rightGroupTrackingTagNum;
- char mouseInsideLeftGroup;
- char mouseInsideRightGroup;
- int widgetState;
- NSString *displayName;
-}
-
-+ (void)initialize;
-+ (float)_windowBorderThickness:(unsigned int)fp8;
-+ (float)_minXWindowBorderWidth:(unsigned int)fp8;
-+ (float)_maxXWindowBorderWidth:(unsigned int)fp8;
-+ (float)_minYWindowBorderHeight:(unsigned int)fp8;
-+ (float)_windowTitlebarButtonSpacingWidth:(unsigned int)fp8;
-+ (float)_windowFileButtonSpacingWidth:(unsigned int)fp8;
-+ (float)_minXTitlebarWidgetInset:(unsigned int)fp8;
-+ (float)_maxXTitlebarWidgetInset:(unsigned int)fp8;
-+ (float)minFrameWidthWithTitle:fp8 styleMask:(unsigned int)fp12;
-+ (float)_windowSideTitlebarTitleMinWidth:(unsigned int)fp8;
-+ (float)_windowTitlebarTitleMinHeight:(unsigned int)fp8;
-+ (float)_sideTitlebarWidth:(unsigned int)fp8;
-+ (float)_titlebarHeight:(unsigned int)fp8;
-+ (float)_resizeHeight:(unsigned int)fp8;
-+ (char)_resizeFromEdge;
-+ (struct _NSSize)sizeOfTitlebarButtons:(unsigned int)fp8;
-+ (float)_contentToFrameMinXWidth:(unsigned int)fp8;
-+ (float)_contentToFrameMaxXWidth:(unsigned int)fp8;
-+ (float)_contentToFrameMinYHeight:(unsigned int)fp8;
-+ (float)_contentToFrameMaxYHeight:(unsigned int)fp8;
-+ (unsigned int)_validateStyleMask:(unsigned int)fp8;
-- (struct _NSSize)_topCornerSize;
-- (struct _NSSize)_bottomCornerSize;
-- (void *)_createWindowOpaqueShape;
-- (void)shapeWindow;
-- (void)_recursiveDisplayRectIfNeededIgnoringOpacity:(NSRect)fp8 isVisibleRect:(char)fp24 rectIsVisibleRectForView:fp28 topView:(char)fp32;
-- (void *)_regionForOpaqueDescendants:(NSRect)fp8 forMove:(char)fp24;
-- (void)_drawFrameInterior:(NSRect *)fp8 clip:(NSRect)fp12;
-- (void)_setTextShadow:(char)fp8;
-- (void)_drawTitleBar:(NSRect)fp8;
-- (void)_drawResizeIndicators:(NSRect)fp8;
-- (void)_drawFrameRects:(NSRect)fp8;
-- (void)drawFrame:(NSRect)fp8;
-- contentFill;
-- (void)viewDidEndLiveResize;
-- (float)contentAlpha;
-- (void)setThemeFrameWidgetState:(int)fp8;
-- (char)constrainResizeEdge:(int *)fp8 withDelta:(struct _NSSize)fp12 elapsedTime:(float)fp20;
-- (void)addFileButton:fp8;
-- (void)_updateButtons;
-- (void)_updateButtonState;
-- newCloseButton;
-- newZoomButton;
-- newMiniaturizeButton;
-- newToolbarButton;
-- newFileButton;
-- (void)_resetTitleBarButtons;
-- (void)setDocumentEdited:(char)fp8;
-- toolbarButton;
-- modeButton;
-- initWithFrame:(NSRect)fp8 styleMask:(unsigned int)fp24 owner:fp28;
-- (void)dealloc;
-- (void)setFrameSize:(struct _NSSize)fp8;
-- (char)_canHaveToolbar;
-- (char)_toolbarIsInTransition;
-- (char)_toolbarIsShown;
-- (char)_toolbarIsHidden;
-- _toolbarView;
-- _toolbar;
-- (float)_distanceFromToolbarBaseToTitlebar;
-- (unsigned int)_shadowFlags;
-- (NSRect)frameRectForContentRect:(NSRect)fp8 styleMask:(unsigned int)fp24;
-- (NSRect)contentRectForFrameRect:(NSRect)fp8 styleMask:(unsigned int)fp24;
-- (struct _NSSize)minFrameSizeForMinContentSize:(struct _NSSize)fp8 styleMask:(unsigned int)fp16;
-- (NSRect)contentRect;
-- (NSRect)_contentRectExcludingToolbar;
-- (NSRect)_contentRectIncludingToolbarAtHome;
-- (void)_setToolbarShowHideResizeWeightingOptimizationOn:(char)fp8;
-- (char)_usingToolbarShowHideWeightingOptimization;
-- (void)handleSetFrameCommonRedisplay;
-- (void)_startLiveResizeAsTopLevel;
-- (void)_endLiveResizeAsTopLevel;
-- (void)_growContentReshapeContentAndToolbarView:(int)fp8 animate:(char)fp12;
-- (char)_growWindowReshapeContentAndToolbarView:(int)fp8 animate:(char)fp12;
-- (void)_reshapeContentAndToolbarView:(int)fp8 resizeWindow:(char)fp12 animate:(char)fp16;
-- (void)_toolbarFrameSizeChanged:fp8 oldSize:(struct _NSSize)fp12;
-- (void)_syncToolbarPosition;
-- (void)_showHideToolbar:(int)fp8 resizeWindow:(char)fp12 animate:(char)fp16;
-- (void)_showToolbarWithAnimation:(char)fp8;
-- (void)_hideToolbarWithAnimation:(char)fp8;
-- (void)_drawToolbarTransitionIfNecessary;
-- (void)drawRect:(NSRect)fp8;
-- (void)resetCursorRects;
-- (char)shouldBeTreatedAsInkEvent:fp8;
-- (char)_shouldBeTreatedAsInkEventInInactiveWindow:fp8;
-//- hitTest:(struct _NSPoint)fp8; // collides with hittest in qcocoasharedwindowmethods_mac_p.h
-- (NSRect)_leftGroupRect;
-- (NSRect)_rightGroupRect;
-- (void)_updateWidgets;
-- (void)_updateMouseTracking;
-- (void)mouseEntered:fp8;
-- (void)mouseExited:fp8;
-- (void)_setMouseEnteredGroup:(char)fp8 entered:(char)fp12;
-- (char)_mouseInGroup:fp8;
-- (struct _NSSize)miniaturizedSize;
-- (float)_minXTitlebarDecorationMinWidth;
-- (float)_maxXTitlebarDecorationMinWidth;
-- (struct _NSSize)minFrameSize;
-- (float)_windowBorderThickness;
-- (float)_windowTitlebarXResizeBorderThickness;
-- (float)_windowTitlebarYResizeBorderThickness;
-- (float)_windowResizeBorderThickness;
-- (float)_minXWindowBorderWidth;
-- (float)_maxXWindowBorderWidth;
-- (float)_minYWindowBorderHeight;
-- (float)_maxYWindowBorderHeight;
-- (float)_minYTitlebarButtonsOffset;
-- (float)_minYTitlebarTitleOffset;
-- (float)_sideTitlebarWidth;
-- (float)_titlebarHeight;
-- (NSRect)_titlebarTitleRect;
-- (NSRect)titlebarRect;
-- (float)_windowTitlebarTitleMinHeight;
-- (struct _NSSize)_sizeOfTitlebarFileButton;
-- (struct _NSSize)sizeOfTitlebarToolbarButton;
-- (float)_windowTitlebarButtonSpacingWidth;
-- (float)_windowFileButtonSpacingWidth;
-- (float)_minXTitlebarWidgetInset;
-- (float)_maxXTitlebarWidgetInset;
-- (float)_minXTitlebarButtonsWidth;
-- (float)_maxXTitlebarButtonsWidth;
-- (struct _NSPoint)_closeButtonOrigin;
-- (struct _NSPoint)_zoomButtonOrigin;
-- (struct _NSPoint)_collapseButtonOrigin;
-- (struct _NSPoint)_toolbarButtonOrigin;
-- (struct _NSPoint)_fileButtonOrigin;
-- (void)_tileTitlebar;
-- (NSRect)_commandPopupRect;
-- (void)_resetDragMargins;
-- (float)_maxYTitlebarDragHeight;
-- (float)_minXTitlebarDragWidth;
-- (float)_maxXTitlebarDragWidth;
-- (float)_contentToFrameMinXWidth;
-- (float)_contentToFrameMaxXWidth;
-- (float)_contentToFrameMinYHeight;
-- (float)_contentToFrameMaxYHeight;
-- (float)_windowResizeCornerThickness;
-- (NSRect)_minYResizeRect;
-- (NSRect)_minYminXResizeRect;
-- (NSRect)_minYmaxXResizeRect;
-- (NSRect)_minXResizeRect;
-- (NSRect)_minXminYResizeRect;
-- (NSRect)_minXmaxYResizeRect;
-- (NSRect)_maxYResizeRect;
-- (NSRect)_maxYminXResizeRect;
-- (NSRect)_maxYmaxXResizeRect;
-- (NSRect)_maxXResizeRect;
-- (NSRect)_maxXminYResizeRect;
-- (NSRect)_maxXmaxYResizeRect;
-- (NSRect)_minXTitlebarResizeRect;
-- (NSRect)_maxXTitlebarResizeRect;
-- (NSRect)_minXBorderRect;
-- (NSRect)_maxXBorderRect;
-- (NSRect)_maxYBorderRect;
-- (NSRect)_minYBorderRect;
-- (void)_setUtilityWindow:(char)fp8;
-- (char)_isUtility;
-- (float)_sheetHeightAdjustment;
-- (void)_setSheet:(char)fp8;
-- (char)_isSheet;
-- (char)_isResizable;
-- (char)_isClosable;
-- (char)_isMiniaturizable;
-- (char)_hasToolbar;
-- (NSRect)_growBoxRect;
-- (void)_drawGrowBoxWithClip:(NSRect)fp8;
-- (char)_inactiveButtonsNeedMask;
-- (void)mouseDown:fp8;
-- _displayName;
-- (void)_setDisplayName:fp8;
-
-@end
diff --git a/src/widgets/platforms/mac/qnstitledframe_mac_p.h b/src/widgets/platforms/mac/qnstitledframe_mac_p.h
deleted file mode 100644
index 531b943646..0000000000
--- a/src/widgets/platforms/mac/qnstitledframe_mac_p.h
+++ /dev/null
@@ -1,205 +0,0 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of qapplication_*.cpp, qwidget*.cpp, qcolor_x11.cpp, qfiledialog.cpp
-// and many other. This header file may change from version to version
-// without notice, or even be removed.
-//
-// We mean it.
-//
-
-// Private AppKit class (dumped from classdump).
-
-#import <Cocoa/Cocoa.h>
-#import "qnsframeview_mac_p.h"
-
-
-@interface NSTitledFrame : NSFrameView
-{
- int resizeFlags;
- id fileButton; /* NSDocumentDragButton* */
- NSSize titleCellSize;
-}
-
-+ (float)_windowBorderThickness:(unsigned int)fp8;
-+ (float)_minXWindowBorderWidth:(unsigned int)fp8;
-+ (float)_maxXWindowBorderWidth:(unsigned int)fp8;
-+ (float)_minYWindowBorderHeight:(unsigned int)fp8;
-+ (char)_resizeFromEdge;
-+ (NSRect)frameRectForContentRect:(NSRect)fp8 styleMask:(unsigned int)fp24;
-+ (NSRect)contentRectForFrameRect:(NSRect)fp8 styleMask:(unsigned int)fp24;
-+ (struct _NSSize)minFrameSizeForMinContentSize:(struct _NSSize)fp8 styleMask:(unsigned int)fp16;
-+ (struct _NSSize)minContentSizeForMinFrameSize:(struct _NSSize)fp8 styleMask:(unsigned int)fp16;
-+ (float)minFrameWidthWithTitle:fp8 styleMask:(unsigned int)fp12;
-+ (struct _NSSize)_titleCellSizeForTitle:fp8 styleMask:(unsigned int)fp12;
-+ (float)_titleCellHeight:(unsigned int)fp8;
-+ (float)_windowTitlebarTitleMinHeight:(unsigned int)fp8;
-+ (float)_titlebarHeight:(unsigned int)fp8;
-+ (struct _NSSize)sizeOfTitlebarButtons:(unsigned int)fp8;
-+ (float)windowTitlebarLinesSpacingWidth:(unsigned int)fp8;
-+ (float)windowTitlebarTitleLinesSpacingWidth:(unsigned int)fp8;
-+ (float)_contentToFrameMinXWidth:(unsigned int)fp8;
-+ (float)_contentToFrameMaxXWidth:(unsigned int)fp8;
-+ (float)_contentToFrameMinYHeight:(unsigned int)fp8;
-+ (float)_contentToFrameMaxYHeight:(unsigned int)fp8;
-- initWithFrame:(NSRect)fp8 styleMask:(unsigned int)fp24 owner:fp28;
-- (void)dealloc;
-- (void)setIsClosable:(char)fp8;
-- (void)setIsResizable:(char)fp8;
-- (void)_resetTitleFont;
-- (void)_setUtilityWindow:(char)fp8;
-- (char)isOpaque;
-- (char)worksWhenModal;
-- (void)propagateFrameDirtyRects:(NSRect)fp8;
-- (void)_showDrawRect:(NSRect)fp8;
-- (void)_drawFrameInterior:(NSRect *)fp8 clip:(NSRect)fp12;
-- (void)drawFrame:(NSRect)fp8;
-- (void)_drawFrameRects:(NSRect)fp8;
-- (void)_drawTitlebar:(NSRect)fp8;
-- (void)_drawTitlebarPattern:(int)fp8 inRect:(NSRect)fp12 clippedByRect:(NSRect)fp28 forKey:(char)fp44 alignment:(int)fp48;
-- (void)_drawTitlebarLines:(int)fp8 inRect:(NSRect)fp12 clippedByRect:(NSRect)fp28;
-- frameHighlightColor;
-- frameShadowColor;
-- (void)setFrameSize:(struct _NSSize)fp8;
-- (void)setFrameOrigin:(struct _NSPoint)fp8;
-- (void)tileAndSetWindowShape:(char)fp8;
-- (void)tile;
-- (void)_tileTitlebar;
-- (void)setTitle:fp8;
-- (char)_shouldRepresentFilename;
-- (void)setRepresentedFilename:fp8;
-- (void)_drawTitleStringIn:(NSRect)fp8 withColor:fp24;
-- titleFont;
-- (void)_drawResizeIndicators:(NSRect)fp8;
-- titleButtonOfClass:(Class)fp8;
-- initTitleButton:fp8;
-- newCloseButton;
-- newZoomButton;
-- newMiniaturizeButton;
-- newFileButton;
-- fileButton;
-- (void)_removeButtons;
-- (void)_updateButtons;
-- (char)_eventInTitlebar:fp8;
-- (char)acceptsFirstMouse:fp8;
-- (void)mouseDown:fp8;
-- (void)mouseUp:fp8;
-- (void)rightMouseDown:fp8;
-- (void)rightMouseUp:fp8;
-- (int)resizeEdgeForEvent:fp8;
-- (struct _NSSize)_resizeDeltaFromPoint:(struct _NSPoint)fp8 toEvent:fp16;
-- (NSRect)_validFrameForResizeFrame:(NSRect)fp8 fromResizeEdge:(int)fp24;
-- (NSRect)frame:(NSRect)fp8 resizedFromEdge:(int)fp24 withDelta:(struct _NSSize)fp28;
-- (char)constrainResizeEdge:(int *)fp8 withDelta:(struct _NSSize)fp12 elapsedTime:(float)fp20;
-- (void)resizeWithEvent:fp8;
-- (int)resizeFlags;
-- (void)resetCursorRects;
-- (void)setDocumentEdited:(char)fp8;
-- (struct _NSSize)miniaturizedSize;
-- (struct _NSSize)minFrameSize;
-- (float)_windowBorderThickness;
-- (float)_windowTitlebarXResizeBorderThickness;
-- (float)_windowTitlebarYResizeBorderThickness;
-- (float)_windowResizeBorderThickness;
-- (float)_minXWindowBorderWidth;
-- (float)_maxXWindowBorderWidth;
-- (float)_minYWindowBorderHeight;
-- (void)_invalidateTitleCellSize;
-- (void)_invalidateTitleCellWidth;
-- (float)_titleCellHeight;
-- (struct _NSSize)_titleCellSize;
-- (float)_titlebarHeight;
-- (NSRect)titlebarRect;
-- (NSRect)_maxTitlebarTitleRect;
-- (NSRect)_titlebarTitleRect;
-- (float)_windowTitlebarTitleMinHeight;
-- (NSRect)dragRectForFrameRect:(NSRect)fp8;
-- (struct _NSSize)sizeOfTitlebarButtons;
-- (struct _NSSize)_sizeOfTitlebarFileButton;
-- (float)_windowTitlebarButtonSpacingWidth;
-- (float)_minXTitlebarButtonsWidth;
-- (float)_maxXTitlebarButtonsWidth;
-- (int)_numberOfTitlebarLines;
-- (float)windowTitlebarLinesSpacingWidth;
-- (float)windowTitlebarTitleLinesSpacingWidth;
-- (float)_minLinesWidthWithSpace;
-- (NSRect)_minXTitlebarLinesRectWithTitleCellRect:(NSRect)fp8;
-- (NSRect)_maxXTitlebarLinesRectWithTitleCellRect:(NSRect)fp8;
-- (float)_minXTitlebarDecorationMinWidth;
-- (float)_maxXTitlebarDecorationMinWidth;
-- (struct _NSPoint)_closeButtonOrigin;
-- (struct _NSPoint)_zoomButtonOrigin;
-- (struct _NSPoint)_collapseButtonOrigin;
-- (struct _NSPoint)_fileButtonOrigin;
-- (float)_maxYTitlebarDragHeight;
-- (float)_minXTitlebarDragWidth;
-- (float)_maxXTitlebarDragWidth;
-- (float)_contentToFrameMinXWidth;
-- (float)_contentToFrameMaxXWidth;
-- (float)_contentToFrameMinYHeight;
-- (float)_contentToFrameMaxYHeight;
-- (NSRect)contentRect;
-- (float)_windowResizeCornerThickness;
-- (NSRect)_minYResizeRect;
-- (NSRect)_minYminXResizeRect;
-- (NSRect)_minYmaxXResizeRect;
-- (NSRect)_minXResizeRect;
-- (NSRect)_minXminYResizeRect;
-- (NSRect)_minXmaxYResizeRect;
-- (NSRect)_maxYResizeRect;
-- (NSRect)_maxYminXResizeRect;
-- (NSRect)_maxYmaxXResizeRect;
-- (NSRect)_maxXResizeRect;
-- (NSRect)_maxXminYResizeRect;
-- (NSRect)_maxXmaxYResizeRect;
-- (NSRect)_minXTitlebarResizeRect;
-- (NSRect)_maxXTitlebarResizeRect;
-- (NSRect)_minXBorderRect;
-- (NSRect)_maxXBorderRect;
-- (NSRect)_maxYBorderRect;
-- (NSRect)_minYBorderRect;
-
-@end
diff --git a/src/widgets/platforms/mac/qpaintdevice_mac.cpp b/src/widgets/platforms/mac/qpaintdevice_mac.cpp
deleted file mode 100644
index 01f4a18bf6..0000000000
--- a/src/widgets/platforms/mac/qpaintdevice_mac.cpp
+++ /dev/null
@@ -1,103 +0,0 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
-
-#include "qpaintdevice.h"
-#include "qpainter.h"
-#include "qwidget.h"
-#include "qbitmap.h"
-#include "qapplication.h"
-#include "qprinter.h"
-#include <qdebug.h>
-#include <private/qt_mac_p.h>
-#include <private/qprintengine_mac_p.h>
-#include <private/qpixmap_mac_p.h>
-#include <private/qpixmap_raster_p.h>
-
-QT_BEGIN_NAMESPACE
-
-/*****************************************************************************
- Internal variables and functions
- *****************************************************************************/
-
-/*! \internal */
-float qt_mac_defaultDpi_x()
-{
- // Mac OS X currently assumes things to be 72 dpi.
- // (see http://developer.apple.com/releasenotes/GraphicsImaging/RN-ResolutionIndependentUI/)
- // This may need to be re-worked as we go further in the resolution-independence stuff.
- return 72;
-}
-
-/*! \internal */
-float qt_mac_defaultDpi_y()
-{
- // Mac OS X currently assumes things to be 72 dpi.
- // (see http://developer.apple.com/releasenotes/GraphicsImaging/RN-ResolutionIndependentUI/)
- // This may need to be re-worked as we go further in the resolution-independence stuff.
- return 72;
-}
-
-
-/*! \internal
-
- Returns the QuickDraw CGrafPtr of the paint device. 0 is returned
- if it can't be obtained. Do not hold the pointer around for long
- as it can be relocated.
-
- \warning This function is only available on Mac OS X.
-*/
-
-Q_WIDGETS_EXPORT GrafPtr qt_mac_qd_context(const QPaintDevice *device)
-{
- if (device->devType() == QInternal::Pixmap) {
- return static_cast<GrafPtr>(static_cast<const QPixmap *>(device)->macQDHandle());
- } else if(device->devType() == QInternal::Widget) {
- return static_cast<GrafPtr>(static_cast<const QWidget *>(device)->macQDHandle());
- } else if(device->devType() == QInternal::Printer) {
- QPaintEngine *engine = static_cast<const QPrinter *>(device)->paintEngine();
- return static_cast<GrafPtr>(static_cast<const QMacPrintEngine *>(engine)->handle());
- }
- return 0;
-}
-
-extern CGColorSpaceRef qt_mac_colorSpaceForDeviceType(const QPaintDevice *pdev);
-
-QT_END_NAMESPACE
diff --git a/src/widgets/platforms/mac/qpaintengine_mac.cpp b/src/widgets/platforms/mac/qpaintengine_mac.cpp
deleted file mode 100644
index f1e397e7b0..0000000000
--- a/src/widgets/platforms/mac/qpaintengine_mac.cpp
+++ /dev/null
@@ -1,1538 +0,0 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
-
-#include <qbitmap.h>
-#include <qpaintdevice.h>
-#include <private/qpaintengine_mac_p.h>
-#include <qpainterpath.h>
-#include <qpixmapcache.h>
-#include <private/qpaintengine_raster_p.h>
-#include <private/qprintengine_mac_p.h>
-#include <qprinter.h>
-#include <qstack.h>
-#include <qtextcodec.h>
-#include <qwidget.h>
-#include <qvarlengtharray.h>
-#include <qdebug.h>
-#include <qcoreapplication.h>
-#include <qmath.h>
-
-#include <private/qfont_p.h>
-#include <private/qfontengine_p.h>
-#include <private/qfontengine_coretext_p.h>
-#include <private/qfontengine_mac_p.h>
-#include <private/qnumeric_p.h>
-#include <private/qpainter_p.h>
-#include <private/qpainterpath_p.h>
-#include <private/qpixmap_mac_p.h>
-#include <private/qt_mac_p.h>
-#include <private/qtextengine_p.h>
-#include <private/qwidget_p.h>
-#include <private/qt_cocoa_helpers_mac_p.h>
-
-#include <string.h>
-
-QT_BEGIN_NAMESPACE
-
-extern int qt_antialiasing_threshold; // QApplication.cpp
-
-/*****************************************************************************
- External functions
- *****************************************************************************/
-extern CGImageRef qt_mac_create_imagemask(const QPixmap &px, const QRectF &sr); //qpixmap_mac.cpp
-extern QPoint qt_mac_posInWindow(const QWidget *w); //qwidget_mac.cpp
-extern OSWindowRef qt_mac_window_for(const QWidget *); //qwidget_mac.cpp
-extern CGContextRef qt_mac_cg_context(const QPaintDevice *); //qpaintdevice_mac.cpp
-extern void qt_mac_dispose_rgn(RgnHandle r); //qregion_mac.cpp
-extern QPixmap qt_pixmapForBrush(int, bool); //qbrush.cpp
-
-void qt_mac_clip_cg(CGContextRef hd, const QRegion &rgn, CGAffineTransform *orig_xform);
-
-
-/*****************************************************************************
- QCoreGraphicsPaintEngine utility functions
- *****************************************************************************/
-
-//conversion
-inline static float qt_mac_convert_color_to_cg(int c) { return ((float)c * 1000 / 255) / 1000; }
-inline static int qt_mac_convert_color_from_cg(float c) { return qRound(c * 255); }
-CGAffineTransform qt_mac_convert_transform_to_cg(const QTransform &t) {
- return CGAffineTransformMake(t.m11(), t.m12(), t.m21(), t.m22(), t.dx(), t.dy());
-}
-
-inline static QCFType<CGColorRef> cgColorForQColor(const QColor &col, QPaintDevice *pdev)
-{
- CGFloat components[] = {
- qt_mac_convert_color_to_cg(col.red()),
- qt_mac_convert_color_to_cg(col.green()),
- qt_mac_convert_color_to_cg(col.blue()),
- qt_mac_convert_color_to_cg(col.alpha())
- };
- return CGColorCreate(qt_mac_colorSpaceForDeviceType(pdev), components);
-}
-
-// There's architectural problems with using native gradients
-// on the Mac at the moment, so disable them.
-// #define QT_MAC_USE_NATIVE_GRADIENTS
-
-#ifdef QT_MAC_USE_NATIVE_GRADIENTS
-static bool drawGradientNatively(const QGradient *gradient)
-{
- return gradient->spread() == QGradient::PadSpread;
-}
-
-// gradiant callback
-static void qt_mac_color_gradient_function(void *info, const CGFloat *in, CGFloat *out)
-{
- QBrush *brush = static_cast<QBrush *>(info);
- Q_ASSERT(brush && brush->gradient());
-
- const QGradientStops stops = brush->gradient()->stops();
- const int n = stops.count();
- Q_ASSERT(n >= 1);
- const QGradientStop *begin = stops.constBegin();
- const QGradientStop *end = begin + n;
-
- qreal p = in[0];
- const QGradientStop *i = begin;
- while (i != end && i->first < p)
- ++i;
-
- QRgb c;
- if (i == begin) {
- c = begin->second.rgba();
- } else if (i == end) {
- c = (end - 1)->second.rgba();
- } else {
- const QGradientStop &s1 = *(i - 1);
- const QGradientStop &s2 = *i;
- qreal p1 = s1.first;
- qreal p2 = s2.first;
- QRgb c1 = s1.second.rgba();
- QRgb c2 = s2.second.rgba();
- int idist = 256 * (p - p1) / (p2 - p1);
- int dist = 256 - idist;
- c = qRgba(INTERPOLATE_PIXEL_256(qRed(c1), dist, qRed(c2), idist),
- INTERPOLATE_PIXEL_256(qGreen(c1), dist, qGreen(c2), idist),
- INTERPOLATE_PIXEL_256(qBlue(c1), dist, qBlue(c2), idist),
- INTERPOLATE_PIXEL_256(qAlpha(c1), dist, qAlpha(c2), idist));
- }
-
- out[0] = qt_mac_convert_color_to_cg(qRed(c));
- out[1] = qt_mac_convert_color_to_cg(qGreen(c));
- out[2] = qt_mac_convert_color_to_cg(qBlue(c));
- out[3] = qt_mac_convert_color_to_cg(qAlpha(c));
-}
-#endif
-
-//clipping handling
-void QCoreGraphicsPaintEnginePrivate::resetClip()
-{
- static bool inReset = false;
- if (inReset)
- return;
- inReset = true;
-
- CGAffineTransform old_xform = CGContextGetCTM(hd);
-
- //setup xforms
- CGContextConcatCTM(hd, CGAffineTransformInvert(old_xform));
- while (stackCount > 0) {
- restoreGraphicsState();
- }
- saveGraphicsState();
- inReset = false;
- //reset xforms
- CGContextConcatCTM(hd, CGAffineTransformInvert(CGContextGetCTM(hd)));
- CGContextConcatCTM(hd, old_xform);
-}
-
-static CGRect qt_mac_compose_rect(const QRectF &r, float off=0)
-{
- return CGRectMake(r.x()+off, r.y()+off, r.width(), r.height());
-}
-
-static CGMutablePathRef qt_mac_compose_path(const QPainterPath &p, float off=0)
-{
- CGMutablePathRef ret = CGPathCreateMutable();
- QPointF startPt;
- for (int i=0; i<p.elementCount(); ++i) {
- const QPainterPath::Element &elm = p.elementAt(i);
- switch (elm.type) {
- case QPainterPath::MoveToElement:
- if(i > 0
- && p.elementAt(i - 1).x == startPt.x()
- && p.elementAt(i - 1).y == startPt.y())
- CGPathCloseSubpath(ret);
- startPt = QPointF(elm.x, elm.y);
- CGPathMoveToPoint(ret, 0, elm.x+off, elm.y+off);
- break;
- case QPainterPath::LineToElement:
- CGPathAddLineToPoint(ret, 0, elm.x+off, elm.y+off);
- break;
- case QPainterPath::CurveToElement:
- Q_ASSERT(p.elementAt(i+1).type == QPainterPath::CurveToDataElement);
- Q_ASSERT(p.elementAt(i+2).type == QPainterPath::CurveToDataElement);
- CGPathAddCurveToPoint(ret, 0,
- elm.x+off, elm.y+off,
- p.elementAt(i+1).x+off, p.elementAt(i+1).y+off,
- p.elementAt(i+2).x+off, p.elementAt(i+2).y+off);
- i+=2;
- break;
- default:
- qFatal("QCoreGraphicsPaintEngine::drawPath(), unhandled type: %d", elm.type);
- break;
- }
- }
- if(!p.isEmpty()
- && p.elementAt(p.elementCount() - 1).x == startPt.x()
- && p.elementAt(p.elementCount() - 1).y == startPt.y())
- CGPathCloseSubpath(ret);
- return ret;
-}
-
-CGColorSpaceRef QCoreGraphicsPaintEngine::m_genericColorSpace = 0;
-QHash<CGDirectDisplayID, CGColorSpaceRef> QCoreGraphicsPaintEngine::m_displayColorSpaceHash;
-bool QCoreGraphicsPaintEngine::m_postRoutineRegistered = false;
-
-CGColorSpaceRef QCoreGraphicsPaintEngine::macGenericColorSpace()
-{
-#if 0
- if (!m_genericColorSpace) {
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
- if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_4) {
- m_genericColorSpace = CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB);
- } else
-#endif
- {
- m_genericColorSpace = CGColorSpaceCreateDeviceRGB();
- }
- if (!m_postRoutineRegistered) {
- m_postRoutineRegistered = true;
- qAddPostRoutine(QCoreGraphicsPaintEngine::cleanUpMacColorSpaces);
- }
- }
- return m_genericColorSpace;
-#else
- // Just return the main display colorspace for the moment.
- return macDisplayColorSpace();
-#endif
-}
-
-//pattern handling (tiling)
-#if 1
-# define QMACPATTERN_MASK_MULTIPLIER 32
-#else
-# define QMACPATTERN_MASK_MULTIPLIER 1
-#endif
-class QMacPattern
-{
-public:
- QMacPattern() : as_mask(false), pdev(0), image(0) { data.bytes = 0; }
- ~QMacPattern() { CGImageRelease(image); }
- int width() {
- if(image)
- return CGImageGetWidth(image);
- if(data.bytes)
- return 8*QMACPATTERN_MASK_MULTIPLIER;
- return data.pixmap.width();
- }
- int height() {
- if(image)
- return CGImageGetHeight(image);
- if(data.bytes)
- return 8*QMACPATTERN_MASK_MULTIPLIER;
- return data.pixmap.height();
- }
-
- //input
- QColor foreground;
- bool as_mask;
- struct {
- QPixmap pixmap;
- const uchar *bytes;
- } data;
- QPaintDevice *pdev;
- //output
- CGImageRef image;
-};
-static void qt_mac_draw_pattern(void *info, CGContextRef c)
-{
- QMacPattern *pat = (QMacPattern*)info;
- int w = 0, h = 0;
- bool isBitmap = (pat->data.pixmap.depth() == 1);
- if(!pat->image) { //lazy cache
- if(pat->as_mask) {
- Q_ASSERT(pat->data.bytes);
- w = h = 8;
-#if (QMACPATTERN_MASK_MULTIPLIER == 1)
- CGDataProviderRef provider = CGDataProviderCreateWithData(0, pat->data.bytes, w*h, 0);
- pat->image = CGImageMaskCreate(w, h, 1, 1, 1, provider, 0, false);
- CGDataProviderRelease(provider);
-#else
- const int numBytes = (w*h)/sizeof(uchar);
- uchar xor_bytes[numBytes];
- for(int i = 0; i < numBytes; ++i)
- xor_bytes[i] = pat->data.bytes[i] ^ 0xFF;
- CGDataProviderRef provider = CGDataProviderCreateWithData(0, xor_bytes, w*h, 0);
- CGImageRef swatch = CGImageMaskCreate(w, h, 1, 1, 1, provider, 0, false);
- CGDataProviderRelease(provider);
-
- const QColor c0(0, 0, 0, 0), c1(255, 255, 255, 255);
- QPixmap pm(w*QMACPATTERN_MASK_MULTIPLIER, h*QMACPATTERN_MASK_MULTIPLIER);
- pm.fill(c0);
- CGContextRef pm_ctx = qt_mac_cg_context(&pm);
- CGContextSetFillColorWithColor(c, cgColorForQColor(c1, pat->pdev));
- CGRect rect = CGRectMake(0, 0, w, h);
- for(int x = 0; x < QMACPATTERN_MASK_MULTIPLIER; ++x) {
- rect.origin.x = x * w;
- for(int y = 0; y < QMACPATTERN_MASK_MULTIPLIER; ++y) {
- rect.origin.y = y * h;
- qt_mac_drawCGImage(pm_ctx, &rect, swatch);
- }
- }
- pat->image = qt_mac_create_imagemask(pm, pm.rect());
- CGImageRelease(swatch);
- CGContextRelease(pm_ctx);
- w *= QMACPATTERN_MASK_MULTIPLIER;
- h *= QMACPATTERN_MASK_MULTIPLIER;
-#endif
- } else {
- w = pat->data.pixmap.width();
- h = pat->data.pixmap.height();
- if (isBitmap)
- pat->image = qt_mac_create_imagemask(pat->data.pixmap, pat->data.pixmap.rect());
- else
- pat->image = (CGImageRef)pat->data.pixmap.macCGHandle();
- }
- } else {
- w = CGImageGetWidth(pat->image);
- h = CGImageGetHeight(pat->image);
- }
-
- //draw
- bool needRestore = false;
- if (CGImageIsMask(pat->image)) {
- CGContextSaveGState(c);
- CGContextSetFillColorWithColor(c, cgColorForQColor(pat->foreground, pat->pdev));
- }
- CGRect rect = CGRectMake(0, 0, w, h);
- qt_mac_drawCGImage(c, &rect, pat->image);
- if(needRestore)
- CGContextRestoreGState(c);
-}
-static void qt_mac_dispose_pattern(void *info)
-{
- QMacPattern *pat = (QMacPattern*)info;
- delete pat;
-}
-
-/*****************************************************************************
- QCoreGraphicsPaintEngine member functions
- *****************************************************************************/
-
-inline static QPaintEngine::PaintEngineFeatures qt_mac_cg_features()
-{
- return QPaintEngine::PaintEngineFeatures(QPaintEngine::AllFeatures & ~QPaintEngine::PaintOutsidePaintEvent
- & ~QPaintEngine::PerspectiveTransform
- & ~QPaintEngine::ConicalGradientFill
- & ~QPaintEngine::LinearGradientFill
- & ~QPaintEngine::RadialGradientFill
- & ~QPaintEngine::BrushStroke);
-}
-
-QCoreGraphicsPaintEngine::QCoreGraphicsPaintEngine()
-: QPaintEngine(*(new QCoreGraphicsPaintEnginePrivate), qt_mac_cg_features())
-{
-}
-
-QCoreGraphicsPaintEngine::QCoreGraphicsPaintEngine(QPaintEnginePrivate &dptr)
-: QPaintEngine(dptr, qt_mac_cg_features())
-{
-}
-
-QCoreGraphicsPaintEngine::~QCoreGraphicsPaintEngine()
-{
-}
-
-bool
-QCoreGraphicsPaintEngine::begin(QPaintDevice *pdev)
-{
- Q_D(QCoreGraphicsPaintEngine);
- if(isActive()) { // already active painting
- qWarning("QCoreGraphicsPaintEngine::begin: Painter already active");
- return false;
- }
-
- //initialization
- d->pdev = pdev;
- d->complexXForm = false;
- d->cosmeticPen = QCoreGraphicsPaintEnginePrivate::CosmeticSetPenWidth;
- d->cosmeticPenSize = 1;
- d->current.clipEnabled = false;
- d->pixelSize = QPoint(1,1);
- d->hd = qt_mac_cg_context(pdev);
- if(d->hd) {
- d->saveGraphicsState();
- d->orig_xform = CGContextGetCTM(d->hd);
- if (d->shading) {
- CGShadingRelease(d->shading);
- d->shading = 0;
- }
- d->setClip(0); //clear the context's clipping
- }
-
- setActive(true);
-
- if(d->pdev->devType() == QInternal::Widget) { // device is a widget
- QWidget *w = (QWidget*)d->pdev;
- bool unclipped = w->testAttribute(Qt::WA_PaintUnclipped);
-
- if((w->windowType() == Qt::Desktop)) {
- if(!unclipped)
- qWarning("QCoreGraphicsPaintEngine::begin: Does not support clipped desktop on Mac OS X");
- // ## need to do [qt_mac_window_for(w) makeKeyAndOrderFront]; (need to rename the file)
- } else if(unclipped) {
- qWarning("QCoreGraphicsPaintEngine::begin: Does not support unclipped painting");
- }
- } else if(d->pdev->devType() == QInternal::Pixmap) { // device is a pixmap
- QPixmap *pm = (QPixmap*)d->pdev;
- if(pm->isNull()) {
- qWarning("QCoreGraphicsPaintEngine::begin: Cannot paint null pixmap");
- end();
- return false;
- }
- }
-
- setDirty(QPaintEngine::DirtyPen);
- setDirty(QPaintEngine::DirtyBrush);
- setDirty(QPaintEngine::DirtyBackground);
- setDirty(QPaintEngine::DirtyHints);
- return true;
-}
-
-bool
-QCoreGraphicsPaintEngine::end()
-{
- Q_D(QCoreGraphicsPaintEngine);
- setActive(false);
- if(d->pdev->devType() == QInternal::Widget && static_cast<QWidget*>(d->pdev)->windowType() == Qt::Desktop) {
-// // ### need to do [qt_mac_window_for(static_cast<QWidget *>(d->pdev)) orderOut]; (need to rename)
-
- }
- if(d->shading) {
- CGShadingRelease(d->shading);
- d->shading = 0;
- }
- d->pdev = 0;
- if(d->hd) {
- d->restoreGraphicsState();
- CGContextSynchronize(d->hd);
- CGContextRelease(d->hd);
- d->hd = 0;
- }
- return true;
-}
-
-void
-QCoreGraphicsPaintEngine::updateState(const QPaintEngineState &state)
-{
- Q_D(QCoreGraphicsPaintEngine);
- QPaintEngine::DirtyFlags flags = state.state();
-
- if (flags & DirtyTransform)
- updateMatrix(state.transform());
-
- if (flags & DirtyClipEnabled) {
- if (state.isClipEnabled())
- updateClipPath(painter()->clipPath(), Qt::ReplaceClip);
- else
- updateClipPath(QPainterPath(), Qt::NoClip);
- }
-
- if (flags & DirtyClipPath) {
- updateClipPath(state.clipPath(), state.clipOperation());
- } else if (flags & DirtyClipRegion) {
- updateClipRegion(state.clipRegion(), state.clipOperation());
- }
-
- // If the clip has changed we need to update all other states
- // too, since they are included in the system context on OSX,
- // and changing the clip resets that context back to scratch.
- if (flags & (DirtyClipPath | DirtyClipRegion | DirtyClipEnabled))
- flags |= AllDirty;
-
- if (flags & DirtyPen)
- updatePen(state.pen());
- if (flags & (DirtyBrush|DirtyBrushOrigin))
- updateBrush(state.brush(), state.brushOrigin());
- if (flags & DirtyFont)
- updateFont(state.font());
- if (flags & DirtyOpacity)
- updateOpacity(state.opacity());
- if (flags & DirtyHints)
- updateRenderHints(state.renderHints());
- if (flags & DirtyCompositionMode)
- updateCompositionMode(state.compositionMode());
-
- if (flags & (DirtyPen | DirtyTransform)) {
- if (!d->current.pen.isCosmetic()) {
- d->cosmeticPen = QCoreGraphicsPaintEnginePrivate::CosmeticNone;
- } else if (d->current.transform.m11() < d->current.transform.m22()-1.0 ||
- d->current.transform.m11() > d->current.transform.m22()+1.0) {
- d->cosmeticPen = QCoreGraphicsPaintEnginePrivate::CosmeticTransformPath;
- d->cosmeticPenSize = d->adjustPenWidth(d->current.pen.widthF());
- if (!d->cosmeticPenSize)
- d->cosmeticPenSize = 1.0;
- } else {
- d->cosmeticPen = QCoreGraphicsPaintEnginePrivate::CosmeticSetPenWidth;
- static const float sqrt2 = sqrt(2);
- qreal width = d->current.pen.widthF();
- if (!width)
- width = 1;
- d->cosmeticPenSize = sqrt(pow(d->pixelSize.y(), 2) + pow(d->pixelSize.x(), 2)) / sqrt2 * width;
- }
- }
-}
-
-void
-QCoreGraphicsPaintEngine::updatePen(const QPen &pen)
-{
- Q_D(QCoreGraphicsPaintEngine);
- Q_ASSERT(isActive());
- d->current.pen = pen;
- d->setStrokePen(pen);
-}
-
-void
-QCoreGraphicsPaintEngine::updateBrush(const QBrush &brush, const QPointF &brushOrigin)
-{
- Q_D(QCoreGraphicsPaintEngine);
- Q_ASSERT(isActive());
- d->current.brush = brush;
-
-#ifdef QT_MAC_USE_NATIVE_GRADIENTS
- // Quartz supports only pad spread
- if (const QGradient *gradient = brush.gradient()) {
- if (drawGradientNatively(gradient)) {
- gccaps |= QPaintEngine::LinearGradientFill | QPaintEngine::RadialGradientFill;
- } else {
- gccaps &= ~(QPaintEngine::LinearGradientFill | QPaintEngine::RadialGradientFill);
- }
- }
-#endif
-
- if (d->shading) {
- CGShadingRelease(d->shading);
- d->shading = 0;
- }
- d->setFillBrush(brushOrigin);
-}
-
-void
-QCoreGraphicsPaintEngine::updateOpacity(qreal opacity)
-{
- Q_D(QCoreGraphicsPaintEngine);
- CGContextSetAlpha(d->hd, opacity);
-}
-
-void
-QCoreGraphicsPaintEngine::updateFont(const QFont &)
-{
- Q_D(QCoreGraphicsPaintEngine);
- Q_ASSERT(isActive());
- updatePen(d->current.pen);
-}
-
-void
-QCoreGraphicsPaintEngine::updateMatrix(const QTransform &transform)
-{
- Q_D(QCoreGraphicsPaintEngine);
- Q_ASSERT(isActive());
-
- if (qt_is_nan(transform.m11()) || qt_is_nan(transform.m12()) || qt_is_nan(transform.m13())
- || qt_is_nan(transform.m21()) || qt_is_nan(transform.m22()) || qt_is_nan(transform.m23())
- || qt_is_nan(transform.m31()) || qt_is_nan(transform.m32()) || qt_is_nan(transform.m33()))
- return;
-
- d->current.transform = transform;
- d->setTransform(transform.isIdentity() ? 0 : &transform);
- d->complexXForm = (transform.m11() != 1 || transform.m22() != 1
- || transform.m12() != 0 || transform.m21() != 0);
- d->pixelSize = d->devicePixelSize(d->hd);
-}
-
-void
-QCoreGraphicsPaintEngine::updateClipPath(const QPainterPath &p, Qt::ClipOperation op)
-{
- Q_D(QCoreGraphicsPaintEngine);
- Q_ASSERT(isActive());
- if(op == Qt::NoClip) {
- if(d->current.clipEnabled) {
- d->current.clipEnabled = false;
- d->current.clip = QRegion();
- d->setClip(0);
- }
- } else {
- if(!d->current.clipEnabled)
- op = Qt::ReplaceClip;
- d->current.clipEnabled = true;
- QRegion clipRegion(p.toFillPolygon().toPolygon(), p.fillRule());
- if(op == Qt::ReplaceClip) {
- d->current.clip = clipRegion;
- d->setClip(0);
- if(p.isEmpty()) {
- CGRect rect = CGRectMake(0, 0, 0, 0);
- CGContextClipToRect(d->hd, rect);
- } else {
- CGMutablePathRef path = qt_mac_compose_path(p);
- CGContextBeginPath(d->hd);
- CGContextAddPath(d->hd, path);
- if(p.fillRule() == Qt::WindingFill)
- CGContextClip(d->hd);
- else
- CGContextEOClip(d->hd);
- CGPathRelease(path);
- }
- } else if(op == Qt::IntersectClip) {
- d->current.clip = d->current.clip.intersected(clipRegion);
- d->setClip(&d->current.clip);
- }
- }
-}
-
-void
-QCoreGraphicsPaintEngine::updateClipRegion(const QRegion &clipRegion, Qt::ClipOperation op)
-{
- Q_D(QCoreGraphicsPaintEngine);
- Q_ASSERT(isActive());
- if(op == Qt::NoClip) {
- d->current.clipEnabled = false;
- d->current.clip = QRegion();
- d->setClip(0);
- } else {
- if(!d->current.clipEnabled)
- op = Qt::ReplaceClip;
- d->current.clipEnabled = true;
- if(op == Qt::IntersectClip)
- d->current.clip = d->current.clip.intersected(clipRegion);
- else if(op == Qt::ReplaceClip)
- d->current.clip = clipRegion;
- d->setClip(&d->current.clip);
- }
-}
-
-void
-QCoreGraphicsPaintEngine::drawPath(const QPainterPath &p)
-{
- Q_D(QCoreGraphicsPaintEngine);
- Q_ASSERT(isActive());
-
- if (state->compositionMode() == QPainter::CompositionMode_Destination)
- return;
-
- CGMutablePathRef path = qt_mac_compose_path(p);
- uchar ops = QCoreGraphicsPaintEnginePrivate::CGStroke;
- if(p.fillRule() == Qt::WindingFill)
- ops |= QCoreGraphicsPaintEnginePrivate::CGFill;
- else
- ops |= QCoreGraphicsPaintEnginePrivate::CGEOFill;
- CGContextBeginPath(d->hd);
- d->drawPath(ops, path);
- CGPathRelease(path);
-}
-
-void
-QCoreGraphicsPaintEngine::drawRects(const QRectF *rects, int rectCount)
-{
- Q_D(QCoreGraphicsPaintEngine);
- Q_ASSERT(isActive());
-
- if (state->compositionMode() == QPainter::CompositionMode_Destination)
- return;
-
- for (int i=0; i<rectCount; ++i) {
- QRectF r = rects[i];
-
- CGMutablePathRef path = CGPathCreateMutable();
- CGPathAddRect(path, 0, qt_mac_compose_rect(r));
- d->drawPath(QCoreGraphicsPaintEnginePrivate::CGFill|QCoreGraphicsPaintEnginePrivate::CGStroke,
- path);
- CGPathRelease(path);
- }
-}
-
-void
-QCoreGraphicsPaintEngine::drawPoints(const QPointF *points, int pointCount)
-{
- Q_D(QCoreGraphicsPaintEngine);
- Q_ASSERT(isActive());
-
- if (state->compositionMode() == QPainter::CompositionMode_Destination)
- return;
-
- if (d->current.pen.capStyle() == Qt::FlatCap)
- CGContextSetLineCap(d->hd, kCGLineCapSquare);
-
- CGMutablePathRef path = CGPathCreateMutable();
- for(int i=0; i < pointCount; i++) {
- float x = points[i].x(), y = points[i].y();
- CGPathMoveToPoint(path, 0, x, y);
- CGPathAddLineToPoint(path, 0, x+0.001, y);
- }
-
- bool doRestore = false;
- if(d->cosmeticPen == QCoreGraphicsPaintEnginePrivate::CosmeticNone && !(state->renderHints() & QPainter::Antialiasing)) {
- //we don't want adjusted pens for point rendering
- doRestore = true;
- d->saveGraphicsState();
- CGContextSetLineWidth(d->hd, d->current.pen.widthF());
- }
- d->drawPath(QCoreGraphicsPaintEnginePrivate::CGStroke, path);
- if (doRestore)
- d->restoreGraphicsState();
- CGPathRelease(path);
- if (d->current.pen.capStyle() == Qt::FlatCap)
- CGContextSetLineCap(d->hd, kCGLineCapButt);
-}
-
-void
-QCoreGraphicsPaintEngine::drawEllipse(const QRectF &r)
-{
- Q_D(QCoreGraphicsPaintEngine);
- Q_ASSERT(isActive());
-
- if (state->compositionMode() == QPainter::CompositionMode_Destination)
- return;
-
- CGMutablePathRef path = CGPathCreateMutable();
- CGAffineTransform transform = CGAffineTransformMakeScale(r.width() / r.height(), 1);
- CGPathAddArc(path, &transform,(r.x() + (r.width() / 2)) / (r.width() / r.height()),
- r.y() + (r.height() / 2), r.height() / 2, 0, (2 * M_PI), false);
- d->drawPath(QCoreGraphicsPaintEnginePrivate::CGFill | QCoreGraphicsPaintEnginePrivate::CGStroke,
- path);
- CGPathRelease(path);
-}
-
-void
-QCoreGraphicsPaintEngine::drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode)
-{
- Q_D(QCoreGraphicsPaintEngine);
- Q_ASSERT(isActive());
-
- if (state->compositionMode() == QPainter::CompositionMode_Destination)
- return;
-
- CGMutablePathRef path = CGPathCreateMutable();
- CGPathMoveToPoint(path, 0, points[0].x(), points[0].y());
- for(int x = 1; x < pointCount; ++x)
- CGPathAddLineToPoint(path, 0, points[x].x(), points[x].y());
- if(mode != PolylineMode && points[0] != points[pointCount-1])
- CGPathAddLineToPoint(path, 0, points[0].x(), points[0].y());
- uint op = QCoreGraphicsPaintEnginePrivate::CGStroke;
- if (mode != PolylineMode)
- op |= mode == OddEvenMode ? QCoreGraphicsPaintEnginePrivate::CGEOFill
- : QCoreGraphicsPaintEnginePrivate::CGFill;
- d->drawPath(op, path);
- CGPathRelease(path);
-}
-
-void
-QCoreGraphicsPaintEngine::drawLines(const QLineF *lines, int lineCount)
-{
- Q_D(QCoreGraphicsPaintEngine);
- Q_ASSERT(isActive());
-
- if (state->compositionMode() == QPainter::CompositionMode_Destination)
- return;
-
- CGMutablePathRef path = CGPathCreateMutable();
- for(int i = 0; i < lineCount; i++) {
- const QPointF start = lines[i].p1(), end = lines[i].p2();
- CGPathMoveToPoint(path, 0, start.x(), start.y());
- CGPathAddLineToPoint(path, 0, end.x(), end.y());
- }
- d->drawPath(QCoreGraphicsPaintEnginePrivate::CGStroke, path);
- CGPathRelease(path);
-}
-
-void QCoreGraphicsPaintEngine::drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr)
-{
- Q_D(QCoreGraphicsPaintEngine);
- Q_ASSERT(isActive());
-
- if (state->compositionMode() == QPainter::CompositionMode_Destination)
- return;
-
- if(pm.isNull())
- return;
-
- bool differentSize = (QRectF(0, 0, pm.width(), pm.height()) != sr), doRestore = false;
- CGRect rect = CGRectMake(r.x(), r.y(), r.width(), r.height());
- QCFType<CGImageRef> image;
- bool isBitmap = (pm.depth() == 1);
- if (isBitmap) {
- doRestore = true;
- d->saveGraphicsState();
-
- const QColor &col = d->current.pen.color();
- CGContextSetFillColorWithColor(d->hd, cgColorForQColor(col, d->pdev));
- image = qt_mac_create_imagemask(pm, sr);
- } else if (differentSize) {
- QCFType<CGImageRef> img = pm.toMacCGImageRef();
- image = CGImageCreateWithImageInRect(img, CGRectMake(qRound(sr.x()), qRound(sr.y()), qRound(sr.width()), qRound(sr.height())));
- } else {
- image = (CGImageRef)pm.macCGHandle();
- }
- qt_mac_drawCGImage(d->hd, &rect, image);
- if (doRestore)
- d->restoreGraphicsState();
-}
-
-void QCoreGraphicsPaintEngine::drawImage(const QRectF &r, const QImage &img, const QRectF &sr,
- Qt::ImageConversionFlags flags)
-{
- Q_D(QCoreGraphicsPaintEngine);
- Q_UNUSED(flags);
- Q_ASSERT(isActive());
-
- if (img.isNull() || state->compositionMode() == QPainter::CompositionMode_Destination)
- return;
-
- const QImage *image;
- QCFType<CGImageRef> cgimage = qt_mac_createCGImageFromQImage(img, &image);
- CGRect rect = CGRectMake(r.x(), r.y(), r.width(), r.height());
- if (QRectF(0, 0, img.width(), img.height()) != sr)
- cgimage = CGImageCreateWithImageInRect(cgimage, CGRectMake(sr.x(), sr.y(),
- sr.width(), sr.height()));
- qt_mac_drawCGImage(d->hd, &rect, cgimage);
-}
-
-void QCoreGraphicsPaintEngine::initialize()
-{
-}
-
-void QCoreGraphicsPaintEngine::cleanup()
-{
-}
-
-CGContextRef
-QCoreGraphicsPaintEngine::handle() const
-{
- return d_func()->hd;
-}
-
-void
-QCoreGraphicsPaintEngine::drawTiledPixmap(const QRectF &r, const QPixmap &pixmap,
- const QPointF &p)
-{
- Q_D(QCoreGraphicsPaintEngine);
- Q_ASSERT(isActive());
-
- if (state->compositionMode() == QPainter::CompositionMode_Destination)
- return;
-
- //save the old state
- d->saveGraphicsState();
-
- //setup the pattern
- QMacPattern *qpattern = new QMacPattern;
- qpattern->data.pixmap = pixmap;
- qpattern->foreground = d->current.pen.color();
- qpattern->pdev = d->pdev;
- CGPatternCallbacks callbks;
- callbks.version = 0;
- callbks.drawPattern = qt_mac_draw_pattern;
- callbks.releaseInfo = qt_mac_dispose_pattern;
- const int width = qpattern->width(), height = qpattern->height();
- CGAffineTransform trans = CGContextGetCTM(d->hd);
- CGPatternRef pat = CGPatternCreate(qpattern, CGRectMake(0, 0, width, height),
- trans, width, height,
- kCGPatternTilingNoDistortion, true, &callbks);
- CGColorSpaceRef cs = CGColorSpaceCreatePattern(0);
- CGContextSetFillColorSpace(d->hd, cs);
- CGFloat component = 1.0; //just one
- CGContextSetFillPattern(d->hd, pat, &component);
- CGSize phase = CGSizeApplyAffineTransform(CGSizeMake(-(p.x()-r.x()), -(p.y()-r.y())), trans);
- CGContextSetPatternPhase(d->hd, phase);
-
- //fill the rectangle
- CGRect mac_rect = CGRectMake(r.x(), r.y(), r.width(), r.height());
- CGContextFillRect(d->hd, mac_rect);
-
- //restore the state
- d->restoreGraphicsState();
- //cleanup
- CGColorSpaceRelease(cs);
- CGPatternRelease(pat);
-}
-
-void QCoreGraphicsPaintEngine::drawTextItem(const QPointF &pos, const QTextItem &item)
-{
- Q_D(QCoreGraphicsPaintEngine);
- if (d->current.transform.type() == QTransform::TxProject
-#ifndef QMAC_NATIVE_GRADIENTS
- || painter()->pen().brush().gradient() //Just let the base engine "emulate" the gradient
-#endif
- ) {
- QPaintEngine::drawTextItem(pos, item);
- return;
- }
-
- if (state->compositionMode() == QPainter::CompositionMode_Destination)
- return;
-
- const QTextItemInt &ti = static_cast<const QTextItemInt &>(item);
-
- QPen oldPen = painter()->pen();
- QBrush oldBrush = painter()->brush();
- QPointF oldBrushOrigin = painter()->brushOrigin();
- updatePen(Qt::NoPen);
- updateBrush(oldPen.brush(), QPointF(0, 0));
-
- Q_ASSERT(type() == QPaintEngine::CoreGraphics);
-
- QFontEngine *fe = ti.fontEngine;
-
- const bool textAA = state->renderHints() & QPainter::TextAntialiasing && fe->fontDef.pointSize > qt_antialiasing_threshold && !(fe->fontDef.styleStrategy & QFont::NoAntialias);
- const bool lineAA = state->renderHints() & QPainter::Antialiasing;
- if(textAA != lineAA)
- CGContextSetShouldAntialias(d->hd, textAA);
-
- if (ti.glyphs.numGlyphs) {
- switch (fe->type()) {
- case QFontEngine::Mac:
- static_cast<QCoreTextFontEngine *>(fe)->draw(d->hd, pos.x(), pos.y(), ti, paintDevice()->height());
- break;
- case QFontEngine::Box:
- d->drawBoxTextItem(pos, ti);
- break;
- default:
- break;
- }
- }
-
- if(textAA != lineAA)
- CGContextSetShouldAntialias(d->hd, !textAA);
-
- updatePen(oldPen);
- updateBrush(oldBrush, oldBrushOrigin);
-}
-
-QPainter::RenderHints
-QCoreGraphicsPaintEngine::supportedRenderHints() const
-{
- return QPainter::RenderHints(QPainter::Antialiasing | QPainter::TextAntialiasing | QPainter::SmoothPixmapTransform);
-}
-enum CGCompositeMode {
- kCGCompositeModeClear = 0,
- kCGCompositeModeCopy = 1,
- kCGCompositeModeSourceOver = 2,
- kCGCompositeModeSourceIn = 3,
- kCGCompositeModeSourceOut = 4,
- kCGCompositeModeSourceAtop = 5,
- kCGCompositeModeDestinationOver = 6,
- kCGCompositeModeDestinationIn = 7,
- kCGCompositeModeDestinationOut = 8,
- kCGCompositeModeDestinationAtop = 9,
- kCGCompositeModeXOR = 10,
- kCGCompositeModePlusDarker = 11, // (max (0, (1-d) + (1-s)))
- kCGCompositeModePlusLighter = 12, // (min (1, s + d))
- };
-extern "C" {
- extern void CGContextSetCompositeOperation(CGContextRef, int);
-} // private function, but is in all versions of OS X.
-void
-QCoreGraphicsPaintEngine::updateCompositionMode(QPainter::CompositionMode mode)
-{
-#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5)
- if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_5) {
- int cg_mode = kCGBlendModeNormal;
- switch(mode) {
- case QPainter::CompositionMode_Multiply:
- cg_mode = kCGBlendModeMultiply;
- break;
- case QPainter::CompositionMode_Screen:
- cg_mode = kCGBlendModeScreen;
- break;
- case QPainter::CompositionMode_Overlay:
- cg_mode = kCGBlendModeOverlay;
- break;
- case QPainter::CompositionMode_Darken:
- cg_mode = kCGBlendModeDarken;
- break;
- case QPainter::CompositionMode_Lighten:
- cg_mode = kCGBlendModeLighten;
- break;
- case QPainter::CompositionMode_ColorDodge:
- cg_mode = kCGBlendModeColorDodge;
- break;
- case QPainter::CompositionMode_ColorBurn:
- cg_mode = kCGBlendModeColorBurn;
- break;
- case QPainter::CompositionMode_HardLight:
- cg_mode = kCGBlendModeHardLight;
- break;
- case QPainter::CompositionMode_SoftLight:
- cg_mode = kCGBlendModeSoftLight;
- break;
- case QPainter::CompositionMode_Difference:
- cg_mode = kCGBlendModeDifference;
- break;
- case QPainter::CompositionMode_Exclusion:
- cg_mode = kCGBlendModeExclusion;
- break;
- case QPainter::CompositionMode_Plus:
- cg_mode = kCGBlendModePlusLighter;
- break;
- case QPainter::CompositionMode_SourceOver:
- cg_mode = kCGBlendModeNormal;
- break;
- case QPainter::CompositionMode_DestinationOver:
- cg_mode = kCGBlendModeDestinationOver;
- break;
- case QPainter::CompositionMode_Clear:
- cg_mode = kCGBlendModeClear;
- break;
- case QPainter::CompositionMode_Source:
- cg_mode = kCGBlendModeCopy;
- break;
- case QPainter::CompositionMode_Destination:
- cg_mode = -1;
- break;
- case QPainter::CompositionMode_SourceIn:
- cg_mode = kCGBlendModeSourceIn;
- break;
- case QPainter::CompositionMode_DestinationIn:
- cg_mode = kCGCompositeModeDestinationIn;
- break;
- case QPainter::CompositionMode_SourceOut:
- cg_mode = kCGBlendModeSourceOut;
- break;
- case QPainter::CompositionMode_DestinationOut:
- cg_mode = kCGBlendModeDestinationOver;
- break;
- case QPainter::CompositionMode_SourceAtop:
- cg_mode = kCGBlendModeSourceAtop;
- break;
- case QPainter::CompositionMode_DestinationAtop:
- cg_mode = kCGBlendModeDestinationAtop;
- break;
- case QPainter::CompositionMode_Xor:
- cg_mode = kCGBlendModeXOR;
- break;
- default:
- break;
- }
- if (cg_mode > -1) {
- CGContextSetBlendMode(d_func()->hd, CGBlendMode(cg_mode));
- }
- } else
-#endif
- // The standard porter duff ops.
- if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_3
- && mode <= QPainter::CompositionMode_Xor) {
- int cg_mode = kCGCompositeModeCopy;
- switch (mode) {
- case QPainter::CompositionMode_SourceOver:
- cg_mode = kCGCompositeModeSourceOver;
- break;
- case QPainter::CompositionMode_DestinationOver:
- cg_mode = kCGCompositeModeDestinationOver;
- break;
- case QPainter::CompositionMode_Clear:
- cg_mode = kCGCompositeModeClear;
- break;
- default:
- qWarning("QCoreGraphicsPaintEngine: Unhandled composition mode %d", (int)mode);
- break;
- case QPainter::CompositionMode_Source:
- cg_mode = kCGCompositeModeCopy;
- break;
- case QPainter::CompositionMode_Destination:
- cg_mode = CGCompositeMode(-1);
- break;
- case QPainter::CompositionMode_SourceIn:
- cg_mode = kCGCompositeModeSourceIn;
- break;
- case QPainter::CompositionMode_DestinationIn:
- cg_mode = kCGCompositeModeDestinationIn;
- break;
- case QPainter::CompositionMode_SourceOut:
- cg_mode = kCGCompositeModeSourceOut;
- break;
- case QPainter::CompositionMode_DestinationOut:
- cg_mode = kCGCompositeModeDestinationOut;
- break;
- case QPainter::CompositionMode_SourceAtop:
- cg_mode = kCGCompositeModeSourceAtop;
- break;
- case QPainter::CompositionMode_DestinationAtop:
- cg_mode = kCGCompositeModeDestinationAtop;
- break;
- case QPainter::CompositionMode_Xor:
- cg_mode = kCGCompositeModeXOR;
- break;
- }
- if (cg_mode > -1)
- CGContextSetCompositeOperation(d_func()->hd, CGCompositeMode(cg_mode));
- } else {
-#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4)
- bool needPrivateAPI = false;
- if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_4) {
- int cg_mode = kCGBlendModeNormal;
- switch (mode) {
- case QPainter::CompositionMode_Multiply:
- cg_mode = kCGBlendModeMultiply;
- break;
- case QPainter::CompositionMode_Screen:
- cg_mode = kCGBlendModeScreen;
- break;
- case QPainter::CompositionMode_Overlay:
- cg_mode = kCGBlendModeOverlay;
- break;
- case QPainter::CompositionMode_Darken:
- cg_mode = kCGBlendModeDarken;
- break;
- case QPainter::CompositionMode_Lighten:
- cg_mode = kCGBlendModeLighten;
- break;
- case QPainter::CompositionMode_ColorDodge:
- cg_mode = kCGBlendModeColorDodge;
- break;
- case QPainter::CompositionMode_ColorBurn:
- cg_mode = kCGBlendModeColorBurn;
- break;
- case QPainter::CompositionMode_HardLight:
- cg_mode = kCGBlendModeHardLight;
- break;
- case QPainter::CompositionMode_SoftLight:
- cg_mode = kCGBlendModeSoftLight;
- break;
- case QPainter::CompositionMode_Difference:
- cg_mode = kCGBlendModeDifference;
- break;
- case QPainter::CompositionMode_Exclusion:
- cg_mode = kCGBlendModeExclusion;
- break;
- case QPainter::CompositionMode_Plus:
- needPrivateAPI = true;
- cg_mode = kCGCompositeModePlusLighter;
- break;
- default:
- break;
- }
- if (!needPrivateAPI)
- CGContextSetBlendMode(d_func()->hd, CGBlendMode(cg_mode));
- else
- CGContextSetCompositeOperation(d_func()->hd, CGCompositeMode(cg_mode));
- }
-#endif
- }
-}
-
-void
-QCoreGraphicsPaintEngine::updateRenderHints(QPainter::RenderHints hints)
-{
- Q_D(QCoreGraphicsPaintEngine);
- CGContextSetShouldAntialias(d->hd, hints & QPainter::Antialiasing);
- static const CGFloat ScaleFactor = qt_mac_get_scalefactor();
- if (ScaleFactor > 1.) {
- CGContextSetInterpolationQuality(d->hd, kCGInterpolationHigh);
- } else {
- CGContextSetInterpolationQuality(d->hd, (hints & QPainter::SmoothPixmapTransform) ?
- kCGInterpolationHigh : kCGInterpolationNone);
- }
- bool textAntialiasing = (hints & QPainter::TextAntialiasing) == QPainter::TextAntialiasing;
- if (!textAntialiasing || d->disabledSmoothFonts) {
- d->disabledSmoothFonts = !textAntialiasing;
- CGContextSetShouldSmoothFonts(d->hd, textAntialiasing);
- }
-}
-
-/*
- Returns the size of one device pixel in user-space coordinates.
-*/
-QPointF QCoreGraphicsPaintEnginePrivate::devicePixelSize(CGContextRef)
-{
- QPointF p1 = current.transform.inverted().map(QPointF(0, 0));
- QPointF p2 = current.transform.inverted().map(QPointF(1, 1));
- return QPointF(qAbs(p2.x() - p1.x()), qAbs(p2.y() - p1.y()));
-}
-
-/*
- Adjusts the pen width so we get correct line widths in the
- non-transformed, aliased case.
-*/
-float QCoreGraphicsPaintEnginePrivate::adjustPenWidth(float penWidth)
-{
- Q_Q(QCoreGraphicsPaintEngine);
- float ret = penWidth;
- if (!complexXForm && !(q->state->renderHints() & QPainter::Antialiasing)) {
- if (penWidth < 2)
- ret = 1;
- else if (penWidth < 3)
- ret = 1.5;
- else
- ret = penWidth -1;
- }
- return ret;
-}
-
-void
-QCoreGraphicsPaintEnginePrivate::setStrokePen(const QPen &pen)
-{
- //pencap
- CGLineCap cglinecap = kCGLineCapButt;
- if(pen.capStyle() == Qt::SquareCap)
- cglinecap = kCGLineCapSquare;
- else if(pen.capStyle() == Qt::RoundCap)
- cglinecap = kCGLineCapRound;
- CGContextSetLineCap(hd, cglinecap);
- CGContextSetLineWidth(hd, adjustPenWidth(pen.widthF()));
-
- //join
- CGLineJoin cglinejoin = kCGLineJoinMiter;
- if(pen.joinStyle() == Qt::BevelJoin)
- cglinejoin = kCGLineJoinBevel;
- else if(pen.joinStyle() == Qt::RoundJoin)
- cglinejoin = kCGLineJoinRound;
- CGContextSetLineJoin(hd, cglinejoin);
-// CGContextSetMiterLimit(hd, pen.miterLimit());
-
- //pen style
- QVector<CGFloat> linedashes;
- if(pen.style() == Qt::CustomDashLine) {
- QVector<qreal> customs = pen.dashPattern();
- for(int i = 0; i < customs.size(); ++i)
- linedashes.append(customs.at(i));
- } else if(pen.style() == Qt::DashLine) {
- linedashes.append(4);
- linedashes.append(2);
- } else if(pen.style() == Qt::DotLine) {
- linedashes.append(1);
- linedashes.append(2);
- } else if(pen.style() == Qt::DashDotLine) {
- linedashes.append(4);
- linedashes.append(2);
- linedashes.append(1);
- linedashes.append(2);
- } else if(pen.style() == Qt::DashDotDotLine) {
- linedashes.append(4);
- linedashes.append(2);
- linedashes.append(1);
- linedashes.append(2);
- linedashes.append(1);
- linedashes.append(2);
- }
- const CGFloat cglinewidth = pen.widthF() <= 0.0f ? 1.0f : float(pen.widthF());
- for(int i = 0; i < linedashes.size(); ++i) {
- linedashes[i] *= cglinewidth;
- if(cglinewidth < 3 && (cglinecap == kCGLineCapSquare || cglinecap == kCGLineCapRound)) {
- if((i%2))
- linedashes[i] += cglinewidth/2;
- else
- linedashes[i] -= cglinewidth/2;
- }
- }
- CGContextSetLineDash(hd, pen.dashOffset() * cglinewidth, linedashes.data(), linedashes.size());
-
- // color
- CGContextSetStrokeColorWithColor(hd, cgColorForQColor(pen.color(), pdev));
-}
-
-// Add our own patterns here to deal with the fact that the coordinate system
-// is flipped vertically with Quartz2D.
-static const uchar *qt_mac_patternForBrush(int brushStyle)
-{
- Q_ASSERT(brushStyle > Qt::SolidPattern && brushStyle < Qt::LinearGradientPattern);
- static const uchar dense1_pat[] = { 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x44, 0x00 };
- static const uchar dense2_pat[] = { 0x00, 0x22, 0x00, 0x88, 0x00, 0x22, 0x00, 0x88 };
- static const uchar dense3_pat[] = { 0x11, 0xaa, 0x44, 0xaa, 0x11, 0xaa, 0x44, 0xaa };
- static const uchar dense4_pat[] = { 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55 };
- static const uchar dense5_pat[] = { 0xee, 0x55, 0xbb, 0x55, 0xee, 0x55, 0xbb, 0x55 };
- static const uchar dense6_pat[] = { 0xff, 0xdd, 0xff, 0x77, 0xff, 0xdd, 0xff, 0x77 };
- static const uchar dense7_pat[] = { 0xff, 0xff, 0xbb, 0xff, 0xff, 0xff, 0xbb, 0xff };
- static const uchar hor_pat[] = { 0xff, 0xff, 0xff, 0xff, 0x00, 0xff, 0xff, 0xff };
- static const uchar ver_pat[] = { 0xef, 0xef, 0xef, 0xef, 0xef, 0xef, 0xef, 0xef };
- static const uchar cross_pat[] = { 0xef, 0xef, 0xef, 0xef, 0x00, 0xef, 0xef, 0xef };
- static const uchar fdiag_pat[] = { 0x7f, 0xbf, 0xdf, 0xef, 0xf7, 0xfb, 0xfd, 0xfe };
- static const uchar bdiag_pat[] = { 0xfe, 0xfd, 0xfb, 0xf7, 0xef, 0xdf, 0xbf, 0x7f };
- static const uchar dcross_pat[] = { 0x7e, 0xbd, 0xdb, 0xe7, 0xe7, 0xdb, 0xbd, 0x7e };
- static const uchar *const pat_tbl[] = {
- dense1_pat, dense2_pat, dense3_pat, dense4_pat, dense5_pat,
- dense6_pat, dense7_pat,
- hor_pat, ver_pat, cross_pat, bdiag_pat, fdiag_pat, dcross_pat };
- return pat_tbl[brushStyle - Qt::Dense1Pattern];
-}
-
-void QCoreGraphicsPaintEnginePrivate::setFillBrush(const QPointF &offset)
-{
- // pattern
- Qt::BrushStyle bs = current.brush.style();
-#ifdef QT_MAC_USE_NATIVE_GRADIENTS
- if (bs == Qt::LinearGradientPattern || bs == Qt::RadialGradientPattern) {
- const QGradient *grad = static_cast<const QGradient*>(current.brush.gradient());
- if (drawGradientNatively(grad)) {
- Q_ASSERT(grad->spread() == QGradient::PadSpread);
-
- static const CGFloat domain[] = { 0.0f, +1.0f };
- static const CGFunctionCallbacks callbacks = { 0, qt_mac_color_gradient_function, 0 };
- CGFunctionRef fill_func = CGFunctionCreate(reinterpret_cast<void *>(&current.brush),
- 1, domain, 4, 0, &callbacks);
-
- CGColorSpaceRef colorspace = qt_mac_colorSpaceForDeviceType(pdev);
- if (bs == Qt::LinearGradientPattern) {
- const QLinearGradient *linearGrad = static_cast<const QLinearGradient *>(grad);
- const QPointF start(linearGrad->start());
- const QPointF stop(linearGrad->finalStop());
- shading = CGShadingCreateAxial(colorspace, CGPointMake(start.x(), start.y()),
- CGPointMake(stop.x(), stop.y()), fill_func, true, true);
- } else {
- Q_ASSERT(bs == Qt::RadialGradientPattern);
- const QRadialGradient *radialGrad = static_cast<const QRadialGradient *>(grad);
- QPointF center(radialGrad->center());
- QPointF focal(radialGrad->focalPoint());
- qreal radius = radialGrad->radius();
- qreal focalRadius = radialGrad->focalRadius();
- shading = CGShadingCreateRadial(colorspace, CGPointMake(focal.x(), focal.y()),
- focalRadius, CGPointMake(center.x(), center.y()), radius, fill_func, false, true);
- }
-
- CGFunctionRelease(fill_func);
- }
- } else
-#endif
- if(bs != Qt::SolidPattern && bs != Qt::NoBrush
-#ifndef QT_MAC_USE_NATIVE_GRADIENTS
- && (bs < Qt::LinearGradientPattern || bs > Qt::ConicalGradientPattern)
-#endif
- )
- {
- QMacPattern *qpattern = new QMacPattern;
- qpattern->pdev = pdev;
- CGFloat components[4] = { 1.0, 1.0, 1.0, 1.0 };
- CGColorSpaceRef base_colorspace = 0;
- if(bs == Qt::TexturePattern) {
- qpattern->data.pixmap = current.brush.texture();
- if(qpattern->data.pixmap.isQBitmap()) {
- const QColor &col = current.brush.color();
- components[0] = qt_mac_convert_color_to_cg(col.red());
- components[1] = qt_mac_convert_color_to_cg(col.green());
- components[2] = qt_mac_convert_color_to_cg(col.blue());
- base_colorspace = QCoreGraphicsPaintEngine::macGenericColorSpace();
- }
- } else {
- qpattern->as_mask = true;
-
- qpattern->data.bytes = qt_mac_patternForBrush(bs);
- const QColor &col = current.brush.color();
- components[0] = qt_mac_convert_color_to_cg(col.red());
- components[1] = qt_mac_convert_color_to_cg(col.green());
- components[2] = qt_mac_convert_color_to_cg(col.blue());
- base_colorspace = QCoreGraphicsPaintEngine::macGenericColorSpace();
- }
- int width = qpattern->width(), height = qpattern->height();
- qpattern->foreground = current.brush.color();
-
- CGColorSpaceRef fill_colorspace = CGColorSpaceCreatePattern(base_colorspace);
- CGContextSetFillColorSpace(hd, fill_colorspace);
-
- CGAffineTransform xform = CGContextGetCTM(hd);
- xform = CGAffineTransformConcat(qt_mac_convert_transform_to_cg(current.brush.transform()), xform);
- xform = CGAffineTransformTranslate(xform, offset.x(), offset.y());
-
- CGPatternCallbacks callbks;
- callbks.version = 0;
- callbks.drawPattern = qt_mac_draw_pattern;
- callbks.releaseInfo = qt_mac_dispose_pattern;
- CGPatternRef fill_pattern = CGPatternCreate(qpattern, CGRectMake(0, 0, width, height),
- xform, width, height, kCGPatternTilingNoDistortion,
- !base_colorspace, &callbks);
- CGContextSetFillPattern(hd, fill_pattern, components);
-
- CGPatternRelease(fill_pattern);
- CGColorSpaceRelease(fill_colorspace);
- } else if(bs != Qt::NoBrush) {
- CGContextSetFillColorWithColor(hd, cgColorForQColor(current.brush.color(), pdev));
- }
-}
-
-void
-QCoreGraphicsPaintEnginePrivate::setClip(const QRegion *rgn)
-{
- Q_Q(QCoreGraphicsPaintEngine);
- if(hd) {
- resetClip();
- QRegion sysClip = q->systemClip();
- if(!sysClip.isEmpty())
- qt_mac_clip_cg(hd, sysClip, &orig_xform);
- if(rgn)
- qt_mac_clip_cg(hd, *rgn, 0);
- }
-}
-
-struct qt_mac_cg_transform_path {
- CGMutablePathRef path;
- CGAffineTransform transform;
-};
-
-void qt_mac_cg_transform_path_apply(void *info, const CGPathElement *element)
-{
- Q_ASSERT(info && element);
- qt_mac_cg_transform_path *t = (qt_mac_cg_transform_path*)info;
- switch(element->type) {
- case kCGPathElementMoveToPoint:
- CGPathMoveToPoint(t->path, &t->transform, element->points[0].x, element->points[0].y);
- break;
- case kCGPathElementAddLineToPoint:
- CGPathAddLineToPoint(t->path, &t->transform, element->points[0].x, element->points[0].y);
- break;
- case kCGPathElementAddQuadCurveToPoint:
- CGPathAddQuadCurveToPoint(t->path, &t->transform, element->points[0].x, element->points[0].y,
- element->points[1].x, element->points[1].y);
- break;
- case kCGPathElementAddCurveToPoint:
- CGPathAddCurveToPoint(t->path, &t->transform, element->points[0].x, element->points[0].y,
- element->points[1].x, element->points[1].y,
- element->points[2].x, element->points[2].y);
- break;
- case kCGPathElementCloseSubpath:
- CGPathCloseSubpath(t->path);
- break;
- default:
- qDebug() << "Unhandled path transform type: " << element->type;
- }
-}
-
-void QCoreGraphicsPaintEnginePrivate::drawPath(uchar ops, CGMutablePathRef path)
-{
- Q_Q(QCoreGraphicsPaintEngine);
- Q_ASSERT((ops & (CGFill | CGEOFill)) != (CGFill | CGEOFill)); //can't really happen
- if((ops & (CGFill | CGEOFill))) {
- if (shading) {
- Q_ASSERT(path);
- CGContextBeginPath(hd);
- CGContextAddPath(hd, path);
- saveGraphicsState();
- if (ops & CGFill)
- CGContextClip(hd);
- else if (ops & CGEOFill)
- CGContextEOClip(hd);
- if (current.brush.gradient()->coordinateMode() == QGradient::ObjectBoundingMode) {
- CGRect boundingBox = CGPathGetBoundingBox(path);
- CGContextConcatCTM(hd,
- CGAffineTransformMake(boundingBox.size.width, 0,
- 0, boundingBox.size.height,
- boundingBox.origin.x, boundingBox.origin.y));
- }
- CGContextDrawShading(hd, shading);
- restoreGraphicsState();
- ops &= ~CGFill;
- ops &= ~CGEOFill;
- } else if (current.brush.style() == Qt::NoBrush) {
- ops &= ~CGFill;
- ops &= ~CGEOFill;
- }
- }
- if((ops & CGStroke) && current.pen.style() == Qt::NoPen)
- ops &= ~CGStroke;
-
- if(ops & (CGEOFill | CGFill)) {
- CGContextBeginPath(hd);
- CGContextAddPath(hd, path);
- if (ops & CGEOFill) {
- CGContextEOFillPath(hd);
- } else {
- CGContextFillPath(hd);
- }
- }
-
- // Avoid saving and restoring the context if we can.
- const bool needContextSave = (cosmeticPen != QCoreGraphicsPaintEnginePrivate::CosmeticNone ||
- !(q->state->renderHints() & QPainter::Antialiasing));
- if(ops & CGStroke) {
- if (needContextSave)
- saveGraphicsState();
- CGContextBeginPath(hd);
-
- // Translate a fraction of a pixel size in the y direction
- // to make sure that primitives painted at pixel borders
- // fills the right pixel. This is needed since the y xais
- // in the Quartz coordinate system is inverted compared to Qt.
- if (!(q->state->renderHints() & QPainter::Antialiasing)) {
- if (current.pen.style() == Qt::SolidLine || current.pen.width() >= 3)
- CGContextTranslateCTM(hd, double(pixelSize.x()) * 0.25, double(pixelSize.y()) * 0.25);
- else if (current.pen.style() == Qt::DotLine && QSysInfo::MacintoshVersion == QSysInfo::MV_10_3)
- ; // Do nothing.
- else
- CGContextTranslateCTM(hd, 0, double(pixelSize.y()) * 0.1);
- }
-
- if (cosmeticPen != QCoreGraphicsPaintEnginePrivate::CosmeticNone) {
- // If antialiazing is enabled, use the cosmetic pen size directly.
- if (q->state->renderHints() & QPainter::Antialiasing)
- CGContextSetLineWidth(hd, cosmeticPenSize);
- else if (current.pen.widthF() <= 1)
- CGContextSetLineWidth(hd, cosmeticPenSize * 0.9f);
- else
- CGContextSetLineWidth(hd, cosmeticPenSize);
- }
- if(cosmeticPen == QCoreGraphicsPaintEnginePrivate::CosmeticTransformPath) {
- qt_mac_cg_transform_path t;
- t.transform = qt_mac_convert_transform_to_cg(current.transform);
- t.path = CGPathCreateMutable();
- CGPathApply(path, &t, qt_mac_cg_transform_path_apply); //transform the path
- setTransform(0); //unset the context transform
- CGContextSetLineWidth(hd, cosmeticPenSize);
- CGContextAddPath(hd, t.path);
- CGPathRelease(t.path);
- } else {
- CGContextAddPath(hd, path);
- }
-
- CGContextStrokePath(hd);
- if (needContextSave)
- restoreGraphicsState();
- }
-}
-
-QT_END_NAMESPACE
diff --git a/src/widgets/platforms/mac/qpaintengine_mac_p.h b/src/widgets/platforms/mac/qpaintengine_mac_p.h
deleted file mode 100644
index a8e27a808d..0000000000
--- a/src/widgets/platforms/mac/qpaintengine_mac_p.h
+++ /dev/null
@@ -1,256 +0,0 @@
-/****************************************************************************
-**
-** 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 QPAINTENGINE_MAC_P_H
-#define QPAINTENGINE_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 "QtGui/qpaintengine.h"
-#include "private/qt_mac_p.h"
-#include "private/qpaintengine_p.h"
-#include "private/qpolygonclipper_p.h"
-#include "private/qfont_p.h"
-#include "QtCore/qhash.h"
-
-typedef struct CGColorSpace *CGColorSpaceRef;
-QT_BEGIN_NAMESPACE
-
-class QCoreGraphicsPaintEnginePrivate;
-class QCoreGraphicsPaintEngine : public QPaintEngine
-{
- Q_DECLARE_PRIVATE(QCoreGraphicsPaintEngine)
-
-public:
- QCoreGraphicsPaintEngine();
- ~QCoreGraphicsPaintEngine();
-
- bool begin(QPaintDevice *pdev);
- bool end();
- static CGColorSpaceRef macGenericColorSpace();
- static CGColorSpaceRef macDisplayColorSpace(const QWidget *widget = 0);
-
- void updateState(const QPaintEngineState &state);
-
- void updatePen(const QPen &pen);
- void updateBrush(const QBrush &brush, const QPointF &pt);
- void updateFont(const QFont &font);
- void updateOpacity(qreal opacity);
- void updateMatrix(const QTransform &matrix);
- void updateTransform(const QTransform &matrix);
- void updateClipRegion(const QRegion &region, Qt::ClipOperation op);
- void updateClipPath(const QPainterPath &path, Qt::ClipOperation op);
- void updateCompositionMode(QPainter::CompositionMode mode);
- void updateRenderHints(QPainter::RenderHints hints);
-
- void drawLines(const QLineF *lines, int lineCount);
- void drawRects(const QRectF *rects, int rectCount);
- void drawPoints(const QPointF *p, int pointCount);
- void drawEllipse(const QRectF &r);
- void drawPath(const QPainterPath &path);
-
- void drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode);
- void drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr);
- void drawTiledPixmap(const QRectF &r, const QPixmap &pixmap, const QPointF &s);
-
- void drawTextItem(const QPointF &pos, const QTextItem &item);
- void drawImage(const QRectF &r, const QImage &pm, const QRectF &sr,
- Qt::ImageConversionFlags flags = Qt::AutoColor);
-
- Type type() const { return QPaintEngine::CoreGraphics; }
-
- CGContextRef handle() const;
-
- static void initialize();
- static void cleanup();
-
- QPainter::RenderHints supportedRenderHints() const;
-
- //avoid partial shadowed overload warnings...
- void drawLines(const QLine *lines, int lineCount) { QPaintEngine::drawLines(lines, lineCount); }
- void drawRects(const QRect *rects, int rectCount) { QPaintEngine::drawRects(rects, rectCount); }
- void drawPoints(const QPoint *p, int pointCount) { QPaintEngine::drawPoints(p, pointCount); }
- void drawEllipse(const QRect &r) { QPaintEngine::drawEllipse(r); }
- void drawPolygon(const QPoint *points, int pointCount, PolygonDrawMode mode)
- { QPaintEngine::drawPolygon(points, pointCount, mode); }
-
- bool supportsTransformations(qreal, const QTransform &) const { return true; };
-
-protected:
- friend class QMacPrintEngine;
- friend class QMacPrintEnginePrivate;
- friend void qt_mac_display_change_callbk(CGDirectDisplayID, CGDisplayChangeSummaryFlags, void *);
- friend void qt_color_profile_changed(CFNotificationCenterRef center, void *,
- CFStringRef , const void *, CFDictionaryRef);
- QCoreGraphicsPaintEngine(QPaintEnginePrivate &dptr);
-
-private:
- static bool m_postRoutineRegistered;
- static CGColorSpaceRef m_genericColorSpace;
- static QHash<CGDirectDisplayID, CGColorSpaceRef> m_displayColorSpaceHash;
- static void cleanUpMacColorSpaces();
- Q_DISABLE_COPY(QCoreGraphicsPaintEngine)
-};
-
-/*****************************************************************************
- Private data
- *****************************************************************************/
-class QCoreGraphicsPaintEnginePrivate : public QPaintEnginePrivate
-{
- Q_DECLARE_PUBLIC(QCoreGraphicsPaintEngine)
-public:
- QCoreGraphicsPaintEnginePrivate()
- : hd(0), shading(0), stackCount(0), complexXForm(false), disabledSmoothFonts(false)
- {
- }
-
- struct {
- QPen pen;
- QBrush brush;
- uint clipEnabled : 1;
- QRegion clip;
- QTransform transform;
- } current;
-
- //state info (shared with QD)
- CGAffineTransform orig_xform;
-
- //cg structures
- CGContextRef hd;
- CGShadingRef shading;
- int stackCount;
- bool complexXForm;
- bool disabledSmoothFonts;
- enum { CosmeticNone, CosmeticTransformPath, CosmeticSetPenWidth } cosmeticPen;
-
- // pixel and cosmetic pen size in user coordinates.
- QPointF pixelSize;
- float cosmeticPenSize;
-
- //internal functions
- enum { CGStroke=0x01, CGEOFill=0x02, CGFill=0x04 };
- void drawPath(uchar ops, CGMutablePathRef path = 0);
- void setClip(const QRegion *rgn=0);
- void resetClip();
- void setFillBrush(const QPointF &origin=QPoint());
- void setStrokePen(const QPen &pen);
- inline void saveGraphicsState();
- inline void restoreGraphicsState();
- float penOffset();
- QPointF devicePixelSize(CGContextRef context);
- float adjustPenWidth(float penWidth);
- inline void setTransform(const QTransform *matrix=0)
- {
- CGContextConcatCTM(hd, CGAffineTransformInvert(CGContextGetCTM(hd)));
- CGAffineTransform xform = orig_xform;
- if(matrix) {
- extern CGAffineTransform qt_mac_convert_transform_to_cg(const QTransform &);
- xform = CGAffineTransformConcat(qt_mac_convert_transform_to_cg(*matrix), xform);
- }
- CGContextConcatCTM(hd, xform);
- CGContextSetTextMatrix(hd, xform);
- }
-};
-
-inline void QCoreGraphicsPaintEnginePrivate::saveGraphicsState()
-{
- ++stackCount;
- CGContextSaveGState(hd);
-}
-
-inline void QCoreGraphicsPaintEnginePrivate::restoreGraphicsState()
-{
- --stackCount;
- Q_ASSERT(stackCount >= 0);
- CGContextRestoreGState(hd);
-}
-
-class QMacQuartzPaintDevice : public QPaintDevice
-{
-public:
- QMacQuartzPaintDevice(CGContextRef cg, int width, int height, int bytesPerLine)
- : mCG(cg), mWidth(width), mHeight(height), mBytesPerLine(bytesPerLine)
- { }
- int devType() const { return QInternal::MacQuartz; }
- CGContextRef cgContext() const { return mCG; }
- int metric(PaintDeviceMetric metric) const {
- switch (metric) {
- case PdmWidth:
- return mWidth;
- case PdmHeight:
- return mHeight;
- case PdmWidthMM:
- return (qt_defaultDpiX() * mWidth) / 2.54;
- case PdmHeightMM:
- return (qt_defaultDpiY() * mHeight) / 2.54;
- case PdmNumColors:
- return 0;
- case PdmDepth:
- return 32;
- case PdmDpiX:
- case PdmPhysicalDpiX:
- return qt_defaultDpiX();
- case PdmDpiY:
- case PdmPhysicalDpiY:
- return qt_defaultDpiY();
- }
- return 0;
- }
- QPaintEngine *paintEngine() const { qWarning("This function should never be called."); return 0; }
-private:
- CGContextRef mCG;
- int mWidth;
- int mHeight;
- int mBytesPerLine;
-};
-
-QT_END_NAMESPACE
-
-#endif // QPAINTENGINE_MAC_P_H
diff --git a/src/widgets/platforms/mac/qpixmap_mac.cpp b/src/widgets/platforms/mac/qpixmap_mac.cpp
deleted file mode 100644
index 3b2452c37c..0000000000
--- a/src/widgets/platforms/mac/qpixmap_mac.cpp
+++ /dev/null
@@ -1,1062 +0,0 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
-
-#include "qpixmap.h"
-#include "qimage.h"
-#include "qapplication.h"
-#include "qbitmap.h"
-#include "qmatrix.h"
-#include "qtransform.h"
-#include "qlibrary.h"
-#include "qvarlengtharray.h"
-#include "qdebug.h"
-#include <private/qdrawhelper_p.h>
-#include <private/qpixmap_mac_p.h>
-#include <private/qpixmap_raster_p.h>
-#include <private/qpaintengine_mac_p.h>
-#include <private/qt_mac_p.h>
-#include <private/qt_cocoa_helpers_mac_p.h>
-#include <private/qapplication_p.h>
-
-#include <limits.h>
-#include <string.h>
-
-QT_BEGIN_NAMESPACE
-
-/*****************************************************************************
- Externals
- *****************************************************************************/
-extern const uchar *qt_get_bitflip_array(); //qimage.cpp
-extern CGContextRef qt_mac_cg_context(const QPaintDevice *pdev); //qpaintdevice_mac.cpp
-extern RgnHandle qt_mac_get_rgn(); //qregion_mac.cpp
-extern void qt_mac_dispose_rgn(RgnHandle r); //qregion_mac.cpp
-extern QRegion qt_mac_convert_mac_region(RgnHandle rgn); //qregion_mac.cpp
-
-static int qt_pixmap_serial = 0;
-
-Q_WIDGETS_EXPORT quint32 *qt_mac_pixmap_get_base(const QPixmap *pix)
-{
- if (QApplicationPrivate::graphics_system_name == QLatin1String("raster"))
- return reinterpret_cast<quint32 *>(static_cast<QRasterPlatformPixmap*>(pix->data.data())->buffer()->bits());
- else
- return static_cast<QMacPlatformPixmap*>(pix->data.data())->pixels;
-}
-
-Q_WIDGETS_EXPORT int qt_mac_pixmap_get_bytes_per_line(const QPixmap *pix)
-{
- if (QApplicationPrivate::graphics_system_name == QLatin1String("raster"))
- return static_cast<QRasterPlatformPixmap*>(pix->data.data())->buffer()->bytesPerLine();
- else
- return static_cast<QMacPlatformPixmap*>(pix->data.data())->bytesPerRow;
-}
-
-void qt_mac_cgimage_data_free(void *info, const void *memoryToFree, size_t)
-{
- QMacPlatformPixmap *pmdata = static_cast<QMacPlatformPixmap *>(info);
- if (!pmdata) {
- free(const_cast<void *>(memoryToFree));
- } else {
- if (QMacPlatformPixmap::validDataPointers.contains(pmdata) == false) {
- free(const_cast<void *>(memoryToFree));
- return;
- }
- if (pmdata->pixels == pmdata->pixelsToFree) {
- // something we aren't expecting, just free it.
- Q_ASSERT(memoryToFree != pmdata->pixelsToFree);
- free(const_cast<void *>(memoryToFree));
- } else {
- free(pmdata->pixelsToFree);
- pmdata->pixelsToFree = static_cast<quint32 *>(const_cast<void *>(memoryToFree));
- }
- pmdata->cg_dataBeingReleased = 0;
- }
-}
-
-/*****************************************************************************
- QPixmap member functions
- *****************************************************************************/
-
-static inline QRgb qt_conv16ToRgb(ushort c) {
- static const int qt_rbits = (565/100);
- static const int qt_gbits = (565/10%10);
- static const int qt_bbits = (565%10);
- static const int qt_red_shift = qt_bbits+qt_gbits-(8-qt_rbits);
- static const int qt_green_shift = qt_bbits-(8-qt_gbits);
- static const int qt_neg_blue_shift = 8-qt_bbits;
- static const int qt_blue_mask = (1<<qt_bbits)-1;
- static const int qt_green_mask = (1<<(qt_gbits+qt_bbits))-((1<<qt_bbits)-1);
- static const int qt_red_mask = (1<<(qt_rbits+qt_gbits+qt_bbits))-(1<<(qt_gbits+qt_bbits));
-
- const int r=(c & qt_red_mask);
- const int g=(c & qt_green_mask);
- const int b=(c & qt_blue_mask);
- const int tr = r >> qt_red_shift;
- const int tg = g >> qt_green_shift;
- const int tb = b << qt_neg_blue_shift;
-
- return qRgb(tr,tg,tb);
-}
-
-QSet<QMacPlatformPixmap*> QMacPlatformPixmap::validDataPointers;
-
-QMacPlatformPixmap::QMacPlatformPixmap(PixelType type)
- : QPlatformPixmap(type, MacClass), has_alpha(0), has_mask(0),
- uninit(true), pixels(0), pixelsSize(0), pixelsToFree(0),
- bytesPerRow(0), cg_data(0), cg_dataBeingReleased(0), cg_mask(0),
- pengine(0)
-{
-}
-
-QPlatformPixmap *QMacPlatformPixmap::createCompatiblePlatformPixmap() const
-{
- return new QMacPlatformPixmap(pixelType());
-}
-
-#define BEST_BYTE_ALIGNMENT 16
-#define COMPTUE_BEST_BYTES_PER_ROW(bpr) \
- (((bpr) + (BEST_BYTE_ALIGNMENT - 1)) & ~(BEST_BYTE_ALIGNMENT - 1))
-
-void QMacPlatformPixmap::resize(int width, int height)
-{
- setSerialNumber(++qt_pixmap_serial);
-
- w = width;
- h = height;
- is_null = (w <= 0 || h <= 0);
- d = (pixelType() == BitmapType ? 1 : 32);
- bool make_null = w <= 0 || h <= 0; // create null pixmap
- if (make_null || d == 0) {
- w = 0;
- h = 0;
- is_null = true;
- d = 0;
- if (!make_null)
- qWarning("Qt: QPixmap: Invalid pixmap parameters");
- return;
- }
-
- if (w < 1 || h < 1)
- return;
-
- //create the pixels
- bytesPerRow = w * sizeof(quint32); // Minimum bytes per row.
-
- // Quartz2D likes things as a multple of 16 (for now).
- bytesPerRow = COMPTUE_BEST_BYTES_PER_ROW(bytesPerRow);
- macCreatePixels();
-}
-
-#undef COMPUTE_BEST_BYTES_PER_ROW
-
-void QMacPlatformPixmap::fromImage(const QImage &img,
- Qt::ImageConversionFlags flags)
-{
- setSerialNumber(++qt_pixmap_serial);
-
- // the conversion code only handles format >=
- // Format_ARGB32_Premultiplied at the moment..
- if (img.format() > QImage::Format_ARGB32_Premultiplied) {
- QImage image;
- if (img.hasAlphaChannel())
- image = img.convertToFormat(QImage::Format_ARGB32_Premultiplied);
- else
- image = img.convertToFormat(QImage::Format_RGB32);
- fromImage(image, flags);
- return;
- }
-
- w = img.width();
- h = img.height();
- is_null = (w <= 0 || h <= 0);
- d = (pixelType() == BitmapType ? 1 : img.depth());
-
- QImage image = img;
- int dd = QPixmap::defaultDepth();
- bool force_mono = (dd == 1 ||
- (flags & Qt::ColorMode_Mask)==Qt::MonoOnly);
- if (force_mono) { // must be monochrome
- if (d != 1) {
- image = image.convertToFormat(QImage::Format_MonoLSB, flags); // dither
- d = 1;
- }
- } else { // can be both
- bool conv8 = false;
- if(d > 8 && dd <= 8) { // convert to 8 bit
- if ((flags & Qt::DitherMode_Mask) == Qt::AutoDither)
- flags = (flags & ~Qt::DitherMode_Mask)
- | Qt::PreferDither;
- conv8 = true;
- } else if ((flags & Qt::ColorMode_Mask) == Qt::ColorOnly) {
- conv8 = d == 1; // native depth wanted
- } else if (d == 1) {
- if (image.colorCount() == 2) {
- QRgb c0 = image.color(0); // Auto: convert to best
- QRgb c1 = image.color(1);
- conv8 = qMin(c0,c1) != qRgb(0,0,0) || qMax(c0,c1) != qRgb(255,255,255);
- } else {
- // eg. 1-color monochrome images (they do exist).
- conv8 = true;
- }
- }
- if (conv8) {
- image = image.convertToFormat(QImage::Format_Indexed8, flags);
- d = 8;
- }
- }
-
- if (image.depth()==1) {
- image.setColor(0, QColor(Qt::color0).rgba());
- image.setColor(1, QColor(Qt::color1).rgba());
- }
-
- if (d == 16 || d == 24) {
- image = image.convertToFormat(QImage::Format_RGB32, flags);
- fromImage(image, flags);
- return;
- }
-
- // different size or depth, make a new pixmap
- resize(w, h);
-
- quint32 *dptr = pixels, *drow;
- const uint dbpr = bytesPerRow;
-
- const QImage::Format sfmt = image.format();
- const unsigned short sbpr = image.bytesPerLine();
-
- // use const_cast to prevent a detach
- const uchar *sptr = const_cast<const QImage &>(image).bits(), *srow;
-
- for (int y = 0; y < h; ++y) {
- drow = dptr + (y * (dbpr / 4));
- srow = sptr + (y * sbpr);
- switch(sfmt) {
- case QImage::Format_MonoLSB:
- case QImage::Format_Mono:{
- for (int x = 0; x < w; ++x) {
- char one_bit = *(srow + (x / 8));
- if (sfmt == QImage::Format_Mono)
- one_bit = one_bit >> (7 - (x % 8));
- else
- one_bit = one_bit >> (x % 8);
- if ((one_bit & 0x01))
- *(drow+x) = 0xFF000000;
- else
- *(drow+x) = 0xFFFFFFFF;
- }
- break;
- }
- case QImage::Format_Indexed8: {
- int numColors = image.numColors();
- if (numColors > 0) {
- for (int x = 0; x < w; ++x) {
- int index = *(srow + x);
- *(drow+x) = PREMUL(image.color(qMin(index, numColors)));
- }
- }
- } break;
- case QImage::Format_RGB32:
- for (int x = 0; x < w; ++x)
- *(drow+x) = *(((quint32*)srow) + x) | 0xFF000000;
- break;
- case QImage::Format_ARGB32:
- case QImage::Format_ARGB32_Premultiplied:
- for (int x = 0; x < w; ++x) {
- if(sfmt == QImage::Format_RGB32)
- *(drow+x) = 0xFF000000 | (*(((quint32*)srow) + x) & 0x00FFFFFF);
- else if(sfmt == QImage::Format_ARGB32_Premultiplied)
- *(drow+x) = *(((quint32*)srow) + x);
- else
- *(drow+x) = PREMUL(*(((quint32*)srow) + x));
- }
- break;
- default:
- qWarning("Qt: internal: Oops: Forgot a format [%d] %s:%d", sfmt,
- __FILE__, __LINE__);
- break;
- }
- }
- if (sfmt != QImage::Format_RGB32) { //setup the alpha
- bool alphamap = image.depth() == 32;
- if (sfmt == QImage::Format_Indexed8) {
- const QVector<QRgb> rgb = image.colorTable();
- for (int i = 0, count = image.colorCount(); i < count; ++i) {
- const int alpha = qAlpha(rgb[i]);
- if (alpha != 0xff) {
- alphamap = true;
- break;
- }
- }
- }
- macSetHasAlpha(alphamap);
- }
- uninit = false;
-}
-
-int get_index(QImage * qi,QRgb mycol)
-{
- int loopc;
- for(loopc=0;loopc<qi->colorCount();loopc++) {
- if(qi->color(loopc)==mycol)
- return loopc;
- }
- qi->setColorCount(qi->colorCount()+1);
- qi->setColor(qi->colorCount(),mycol);
- return qi->colorCount();
-}
-
-QImage QMacPlatformPixmap::toImage() const
-{
- QImage::Format format = QImage::Format_MonoLSB;
- if (d != 1) //Doesn't support index color modes
- format = (has_alpha ? QImage::Format_ARGB32_Premultiplied :
- QImage::Format_RGB32);
-
- QImage image(w, h, format);
- quint32 *sptr = pixels, *srow;
- const uint sbpr = bytesPerRow;
- if (format == QImage::Format_MonoLSB) {
- image.fill(0);
- image.setColorCount(2);
- image.setColor(0, QColor(Qt::color0).rgba());
- image.setColor(1, QColor(Qt::color1).rgba());
- for (int y = 0; y < h; ++y) {
- uchar *scanLine = image.scanLine(y);
- srow = sptr + (y * (sbpr/4));
- for (int x = 0; x < w; ++x) {
- if (!(*(srow + x) & RGB_MASK))
- scanLine[x >> 3] |= (1 << (x & 7));
- }
- }
- } else {
- for (int y = 0; y < h; ++y) {
- srow = sptr + (y * (sbpr / 4));
- memcpy(image.scanLine(y), srow, w * 4);
- }
-
- }
-
- return image;
-}
-
-void QMacPlatformPixmap::fill(const QColor &fillColor)
-
-{
- { //we don't know what backend to use so we cannot paint here
- quint32 *dptr = pixels;
- Q_ASSERT_X(dptr, "QPixmap::fill", "No dptr");
- const quint32 colr = PREMUL(fillColor.rgba());
- const int nbytes = bytesPerRow * h;
- if (!colr) {
- memset(dptr, 0, nbytes);
- } else {
- for (uint i = 0; i < nbytes / sizeof(quint32); ++i)
- *(dptr + i) = colr;
- }
- }
-
- // If we had an alpha channel from before, don't
- // switch it off. Only go from no alpha to alpha:
- if (fillColor.alpha() != 255)
- macSetHasAlpha(true);
-}
-
-QPixmap QMacPlatformPixmap::alphaChannel() const
-{
- if (!has_alpha)
- return QPixmap();
-
- QMacPlatformPixmap *alpha = new QMacPlatformPixmap(PixmapType);
- alpha->resize(w, h);
- macGetAlphaChannel(alpha, false);
- return QPixmap(alpha);
-}
-
-void QMacPlatformPixmap::setAlphaChannel(const QPixmap &alpha)
-{
- has_mask = true;
- QMacPlatformPixmap *alphaData = static_cast<QMacPlatformPixmap*>(alpha.data.data());
- macSetAlphaChannel(alphaData, false);
-}
-
-QBitmap QMacPlatformPixmap::mask() const
-{
- if (!has_mask && !has_alpha)
- return QBitmap();
-
- QMacPlatformPixmap *mask = new QMacPlatformPixmap(BitmapType);
- mask->resize(w, h);
- macGetAlphaChannel(mask, true);
- return QPixmap(mask);
-}
-
-void QMacPlatformPixmap::setMask(const QBitmap &mask)
-{
- if (mask.isNull()) {
- QMacPlatformPixmap opaque(PixmapType);
- opaque.resize(w, h);
- opaque.fill(QColor(255, 255, 255, 255));
- macSetAlphaChannel(&opaque, true);
- has_alpha = has_mask = false;
- return;
- }
-
- has_alpha = false;
- has_mask = true;
- QMacPlatformPixmap *maskData = static_cast<QMacPlatformPixmap*>(mask.data.data());
- macSetAlphaChannel(maskData, true);
-}
-
-int QMacPlatformPixmap::metric(QPaintDevice::PaintDeviceMetric theMetric) const
-{
- switch (theMetric) {
- case QPaintDevice::PdmWidth:
- return w;
- case QPaintDevice::PdmHeight:
- return h;
- case QPaintDevice::PdmWidthMM:
- return qRound(metric(QPaintDevice::PdmWidth) * 25.4 / qreal(metric(QPaintDevice::PdmDpiX)));
- case QPaintDevice::PdmHeightMM:
- return qRound(metric(QPaintDevice::PdmHeight) * 25.4 / qreal(metric(QPaintDevice::PdmDpiY)));
- case QPaintDevice::PdmNumColors:
- return 1 << d;
- case QPaintDevice::PdmDpiX:
- case QPaintDevice::PdmPhysicalDpiX: {
- extern float qt_mac_defaultDpi_x(); //qpaintdevice_mac.cpp
- return int(qt_mac_defaultDpi_x());
- }
- case QPaintDevice::PdmDpiY:
- case QPaintDevice::PdmPhysicalDpiY: {
- extern float qt_mac_defaultDpi_y(); //qpaintdevice_mac.cpp
- return int(qt_mac_defaultDpi_y());
- }
- case QPaintDevice::PdmDepth:
- return d;
- default:
- qWarning("QPixmap::metric: Invalid metric command");
- }
- return 0;
-}
-
-QMacPlatformPixmap::~QMacPlatformPixmap()
-{
- validDataPointers.remove(this);
- if (cg_mask) {
- CGImageRelease(cg_mask);
- cg_mask = 0;
- }
-
- delete pengine; // Make sure we aren't drawing on the context anymore.
- if (cg_data) {
- CGImageRelease(cg_data);
- } else if (!cg_dataBeingReleased && pixels != pixelsToFree) {
- free(pixels);
- }
- free(pixelsToFree);
-}
-
-void QMacPlatformPixmap::macSetAlphaChannel(const QMacPlatformPixmap *pix, bool asMask)
-{
- if (!pixels || !h || !w || pix->w != w || pix->h != h)
- return;
-
- quint32 *dptr = pixels, *drow;
- const uint dbpr = bytesPerRow;
- const unsigned short sbpr = pix->bytesPerRow;
- quint32 *sptr = pix->pixels, *srow;
- for (int y=0; y < h; ++y) {
- drow = dptr + (y * (dbpr/4));
- srow = sptr + (y * (sbpr/4));
- if(d == 1) {
- for (int x=0; x < w; ++x) {
- if((*(srow+x) & RGB_MASK))
- *(drow+x) = 0xFFFFFFFF;
- }
- } else if(d == 8) {
- for (int x=0; x < w; ++x)
- *(drow+x) = (*(drow+x) & RGB_MASK) | (*(srow+x) << 24);
- } else if(asMask) {
- for (int x=0; x < w; ++x) {
- if(*(srow+x) & RGB_MASK)
- *(drow+x) = (*(drow+x) & RGB_MASK);
- else
- *(drow+x) = (*(drow+x) & RGB_MASK) | 0xFF000000;
- *(drow+x) = PREMUL(*(drow+x));
- }
- } else {
- for (int x=0; x < w; ++x) {
- const uchar alpha = qGray(qRed(*(srow+x)), qGreen(*(srow+x)), qBlue(*(srow+x)));
- const uchar destAlpha = qt_div_255(alpha * qAlpha(*(drow+x)));
-#if 1
- *(drow+x) = (*(drow+x) & RGB_MASK) | (destAlpha << 24);
-#else
- *(drow+x) = qRgba(qt_div_255(qRed(*(drow+x) * alpha)),
- qt_div_255(qGreen(*(drow+x) * alpha)),
- qt_div_255(qBlue(*(drow+x) * alpha)), destAlpha);
-#endif
- *(drow+x) = PREMUL(*(drow+x));
- }
- }
- }
- macSetHasAlpha(true);
-}
-
-void QMacPlatformPixmap::macGetAlphaChannel(QMacPlatformPixmap *pix, bool asMask) const
-{
- quint32 *dptr = pix->pixels, *drow;
- const uint dbpr = pix->bytesPerRow;
- const unsigned short sbpr = bytesPerRow;
- quint32 *sptr = pixels, *srow;
- for(int y=0; y < h; ++y) {
- drow = dptr + (y * (dbpr/4));
- srow = sptr + (y * (sbpr/4));
- if(asMask) {
- for (int x = 0; x < w; ++x) {
- if (*(srow + x) & qRgba(0, 0, 0, 255))
- *(drow + x) = 0x00000000;
- else
- *(drow + x) = 0xFFFFFFFF;
- }
- } else {
- for (int x = 0; x < w; ++x) {
- const int alpha = qAlpha(*(srow + x));
- *(drow + x) = qRgb(alpha, alpha, alpha);
- }
- }
- }
-}
-
-void QMacPlatformPixmap::macSetHasAlpha(bool b)
-{
- has_alpha = b;
- macReleaseCGImageRef();
-}
-
-void QMacPlatformPixmap::macCreateCGImageRef()
-{
- Q_ASSERT(cg_data == 0);
- //create the cg data
- CGColorSpaceRef colorspace = QCoreGraphicsPaintEngine::macDisplayColorSpace();
- QCFType<CGDataProviderRef> provider = CGDataProviderCreateWithData(this,
- pixels, bytesPerRow * h,
- qt_mac_cgimage_data_free);
- validDataPointers.insert(this);
- uint cgflags = kCGImageAlphaPremultipliedFirst;
-#ifdef kCGBitmapByteOrder32Host //only needed because CGImage.h added symbols in the minor version
- cgflags |= kCGBitmapByteOrder32Host;
-#endif
- cg_data = CGImageCreate(w, h, 8, 32, bytesPerRow, colorspace,
- cgflags, provider, 0, 0, kCGRenderingIntentDefault);
-}
-
-void QMacPlatformPixmap::macReleaseCGImageRef()
-{
- if (!cg_data)
- return; // There's nothing we need to do
-
- cg_dataBeingReleased = cg_data;
- CGImageRelease(cg_data);
- cg_data = 0;
-
- if (pixels != pixelsToFree) {
- macCreatePixels();
- } else {
- pixelsToFree = 0;
- }
-}
-
-
-// We create our space in memory to paint on here. If we already have existing pixels
-// copy them over. This is to preserve the fact that CGImageRef's are immutable.
-void QMacPlatformPixmap::macCreatePixels()
-{
- const int numBytes = bytesPerRow * h;
- quint32 *base_pixels;
- if (pixelsToFree && pixelsToFree != pixels) {
- // Reuse unused block of memory lying around from a previous callback.
- base_pixels = pixelsToFree;
- pixelsToFree = 0;
- } else {
- // We need a block of memory to do stuff with.
- base_pixels = static_cast<quint32 *>(malloc(numBytes));
- }
-
- if (pixels)
- memcpy(base_pixels, pixels, pixelsSize);
- pixels = base_pixels;
- pixelsSize = numBytes;
-}
-
-#if 0
-QPixmap QMacPlatformPixmap::transformed(const QTransform &transform,
- Qt::TransformationMode mode) const
-{
- int w, h; // size of target pixmap
- const int ws = width();
- const int hs = height();
-
- QTransform mat(transform.m11(), transform.m12(),
- transform.m21(), transform.m22(), 0., 0.);
- if (transform.m12() == 0.0F && transform.m21() == 0.0F &&
- transform.m11() >= 0.0F && transform.m22() >= 0.0F)
- {
- h = int(qAbs(mat.m22()) * hs + 0.9999);
- w = int(qAbs(mat.m11()) * ws + 0.9999);
- h = qAbs(h);
- w = qAbs(w);
- } else { // rotation or shearing
- QPolygonF a(QRectF(0,0,ws+1,hs+1));
- a = mat.map(a);
- QRectF r = a.boundingRect().normalized();
- w = int(r.width() + 0.9999);
- h = int(r.height() + 0.9999);
- }
- mat = QPixmap::trueMatrix(mat, ws, hs);
- if (!h || !w)
- return QPixmap();
-
- // create destination
- QMacPlatformPixmap *pm = new QMacPlatformPixmap(pixelType(), w, h);
- const quint32 *sptr = pixels;
- quint32 *dptr = pm->pixels;
- memset(dptr, 0, (pm->bytesPerRow * pm->h));
-
- // do the transform
- if (mode == Qt::SmoothTransformation) {
-#warning QMacPlatformPixmap::transformed not properly implemented
- qWarning("QMacPlatformPixmap::transformed not properly implemented");
-#if 0
- QPainter p(&pm);
- p.setRenderHint(QPainter::Antialiasing);
- p.setRenderHint(QPainter::SmoothPixmapTransform);
- p.setTransform(mat);
- p.drawPixmap(0, 0, *this);
-#endif
- } else {
- bool invertible;
- mat = mat.inverted(&invertible);
- if (!invertible)
- return QPixmap();
-
- const int bpp = 32;
- const int xbpl = (w * bpp) / 8;
- if (!qt_xForm_helper(mat, 0, QT_XFORM_TYPE_MSBFIRST, bpp,
- (uchar*)dptr, xbpl, (pm->bytesPerRow) - xbpl,
- h, (uchar*)sptr, (bytesPerRow), ws, hs)) {
- qWarning("QMacPlatformPixmap::transform(): failure");
- return QPixmap();
- }
- }
-
- // update the alpha
- pm->macSetHasAlpha(true);
- return QPixmap(pm);
-}
-#endif
-
-QT_BEGIN_INCLUDE_NAMESPACE
-#include <OpenGL/OpenGL.h>
-#include <OpenGL/gl.h>
-QT_END_INCLUDE_NAMESPACE
-
-// Load and resolve the symbols we need from OpenGL manually so QtGui doesn't have to link against the OpenGL framework.
-typedef CGLError (*PtrCGLChoosePixelFormat)(const CGLPixelFormatAttribute *, CGLPixelFormatObj *, long *);
-typedef CGLError (*PtrCGLClearDrawable)(CGLContextObj);
-typedef CGLError (*PtrCGLCreateContext)(CGLPixelFormatObj, CGLContextObj, CGLContextObj *);
-typedef CGLError (*PtrCGLDestroyContext)(CGLContextObj);
-typedef CGLError (*PtrCGLDestroyPixelFormat)(CGLPixelFormatObj);
-typedef CGLError (*PtrCGLSetCurrentContext)(CGLContextObj);
-typedef CGLError (*PtrCGLSetFullScreen)(CGLContextObj);
-typedef void (*PtrglFinish)();
-typedef void (*PtrglPixelStorei)(GLenum, GLint);
-typedef void (*PtrglReadBuffer)(GLenum);
-typedef void (*PtrglReadPixels)(GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, GLvoid *);
-
-static PtrCGLChoosePixelFormat ptrCGLChoosePixelFormat = 0;
-static PtrCGLClearDrawable ptrCGLClearDrawable = 0;
-static PtrCGLCreateContext ptrCGLCreateContext = 0;
-static PtrCGLDestroyContext ptrCGLDestroyContext = 0;
-static PtrCGLDestroyPixelFormat ptrCGLDestroyPixelFormat = 0;
-static PtrCGLSetCurrentContext ptrCGLSetCurrentContext = 0;
-static PtrCGLSetFullScreen ptrCGLSetFullScreen = 0;
-static PtrglFinish ptrglFinish = 0;
-static PtrglPixelStorei ptrglPixelStorei = 0;
-static PtrglReadBuffer ptrglReadBuffer = 0;
-static PtrglReadPixels ptrglReadPixels = 0;
-
-static bool resolveOpenGLSymbols()
-{
- if (ptrCGLChoosePixelFormat == 0) {
- QLibrary library(QLatin1String("/System/Library/Frameworks/OpenGL.framework/OpenGL"));
- ptrCGLChoosePixelFormat = (PtrCGLChoosePixelFormat)(library.resolve("CGLChoosePixelFormat"));
- ptrCGLClearDrawable = (PtrCGLClearDrawable)(library.resolve("CGLClearDrawable"));
- ptrCGLCreateContext = (PtrCGLCreateContext)(library.resolve("CGLCreateContext"));
- ptrCGLDestroyContext = (PtrCGLDestroyContext)(library.resolve("CGLDestroyContext"));
- ptrCGLDestroyPixelFormat = (PtrCGLDestroyPixelFormat)(library.resolve("CGLDestroyPixelFormat"));
- ptrCGLSetCurrentContext = (PtrCGLSetCurrentContext)(library.resolve("CGLSetCurrentContext"));
- ptrCGLSetFullScreen = (PtrCGLSetFullScreen)(library.resolve("CGLSetFullScreen"));
- ptrglFinish = (PtrglFinish)(library.resolve("glFinish"));
- ptrglPixelStorei = (PtrglPixelStorei)(library.resolve("glPixelStorei"));
- ptrglReadBuffer = (PtrglReadBuffer)(library.resolve("glReadBuffer"));
- ptrglReadPixels = (PtrglReadPixels)(library.resolve("glReadPixels"));
- }
- return ptrCGLChoosePixelFormat && ptrCGLClearDrawable && ptrCGLCreateContext
- && ptrCGLDestroyContext && ptrCGLDestroyPixelFormat && ptrCGLSetCurrentContext
- && ptrCGLSetFullScreen && ptrglFinish && ptrglPixelStorei
- && ptrglReadBuffer && ptrglReadPixels;
-}
-
-// Inverts the given pixmap in the y direction.
-static void qt_mac_flipPixmap(void *data, int rowBytes, int height)
-{
- int bottom = height - 1;
- void *base = data;
- void *buffer = malloc(rowBytes);
-
- int top = 0;
- while ( top < bottom )
- {
- void *topP = (void *)((top * rowBytes) + (intptr_t)base);
- void *bottomP = (void *)((bottom * rowBytes) + (intptr_t)base);
-
- bcopy( topP, buffer, rowBytes );
- bcopy( bottomP, topP, rowBytes );
- bcopy( buffer, bottomP, rowBytes );
-
- ++top;
- --bottom;
- }
- free(buffer);
-}
-
-// Grabs displayRect from display and places it into buffer.
-static void qt_mac_grabDisplayRect(CGDirectDisplayID display, const QRect &displayRect, void *buffer)
-{
- if (display == kCGNullDirectDisplay)
- return;
-
- CGLPixelFormatAttribute attribs[] = {
- kCGLPFAFullScreen,
- kCGLPFADisplayMask,
- (CGLPixelFormatAttribute)0, /* Display mask bit goes here */
- (CGLPixelFormatAttribute)0
- };
-
- attribs[2] = (CGLPixelFormatAttribute)CGDisplayIDToOpenGLDisplayMask(display);
-
- // Build a full-screen GL context
- CGLPixelFormatObj pixelFormatObj;
- long numPixelFormats;
-
- ptrCGLChoosePixelFormat( attribs, &pixelFormatObj, &numPixelFormats );
-
- if (!pixelFormatObj) // No full screen context support
- return;
-
- CGLContextObj glContextObj;
- ptrCGLCreateContext(pixelFormatObj, 0, &glContextObj);
- ptrCGLDestroyPixelFormat(pixelFormatObj) ;
- if (!glContextObj)
- return;
-
- ptrCGLSetCurrentContext(glContextObj);
- ptrCGLSetFullScreen(glContextObj) ;
-
- ptrglReadBuffer(GL_FRONT);
-
- ptrglFinish(); // Finish all OpenGL commands
- ptrglPixelStorei(GL_PACK_ALIGNMENT, 4); // Force 4-byte alignment
- ptrglPixelStorei(GL_PACK_ROW_LENGTH, 0);
- ptrglPixelStorei(GL_PACK_SKIP_ROWS, 0);
- ptrglPixelStorei(GL_PACK_SKIP_PIXELS, 0);
-
- // Fetch the data in XRGB format, matching the bitmap context.
- ptrglReadPixels(GLint(displayRect.x()), GLint(displayRect.y()),
- GLint(displayRect.width()), GLint(displayRect.height()),
-#ifdef __BIG_ENDIAN__
- GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, buffer
-#else
- GL_BGRA, GL_UNSIGNED_INT_8_8_8_8, buffer
-#endif
- );
-
- ptrCGLSetCurrentContext(0);
- ptrCGLClearDrawable(glContextObj); // disassociate from full screen
- ptrCGLDestroyContext(glContextObj); // and destroy the context
-}
-
-// Returns a pixmap containing the screen contents at rect.
-static QPixmap qt_mac_grabScreenRect(const QRect &rect)
-{
- if (!resolveOpenGLSymbols())
- return QPixmap();
-
- const int maxDisplays = 128; // 128 displays should be enough for everyone.
- CGDirectDisplayID displays[maxDisplays];
- CGDisplayCount displayCount;
- const CGRect cgRect = CGRectMake(rect.x(), rect.y(), rect.width(), rect.height());
- const CGDisplayErr err = CGGetDisplaysWithRect(cgRect, maxDisplays, displays, &displayCount);
-
- if (err && displayCount == 0)
- return QPixmap();
-
- long bytewidth = rect.width() * 4; // Assume 4 bytes/pixel for now
- bytewidth = (bytewidth + 3) & ~3; // Align to 4 bytes
- QVarLengthArray<char> buffer(rect.height() * bytewidth);
-
- for (uint i = 0; i < displayCount; ++i) {
- const CGRect bounds = CGDisplayBounds(displays[i]);
- // Translate to display-local coordinates
- QRect displayRect = rect.translated(qRound(-bounds.origin.x), qRound(-bounds.origin.y));
- // Adjust for inverted y axis.
- displayRect.moveTop(qRound(bounds.size.height) - displayRect.y() - rect.height());
- qt_mac_grabDisplayRect(displays[i], displayRect, buffer.data());
- }
-
- qt_mac_flipPixmap(buffer.data(), bytewidth, rect.height());
- QCFType<CGContextRef> bitmap = CGBitmapContextCreate(buffer.data(), rect.width(),
- rect.height(), 8, bytewidth,
- QCoreGraphicsPaintEngine::macGenericColorSpace(),
- kCGImageAlphaNoneSkipFirst);
- QCFType<CGImageRef> image = CGBitmapContextCreateImage(bitmap);
- return QPixmap::fromMacCGImageRef(image);
-}
-
-
-QPixmap QPixmap::grabWindow(WId window, int x, int y, int w, int h)
-{
- QWidget *widget = QWidget::find(window);
- if (widget == 0)
- return QPixmap();
-
- if(w == -1)
- w = widget->width() - x;
- if(h == -1)
- h = widget->height() - y;
-
- QPoint globalCoord(0, 0);
- globalCoord = widget->mapToGlobal(globalCoord);
- QRect rect(globalCoord.x() + x, globalCoord.y() + y, w, h);
-
- return qt_mac_grabScreenRect(rect);
-}
-
-/*! \internal
-
- Returns the QuickDraw CGrafPtr of the pixmap. 0 is returned if it can't
- be obtained. Do not hold the pointer around for long as it can be
- relocated.
-
- \warning This function is only available on Mac OS X.
- \warning As of Qt 4.6, this function \e{always} returns zero.
-*/
-
-Qt::HANDLE QPixmap::macQDHandle() const
-{
- return 0;
-}
-
-/*! \internal
-
- Returns the QuickDraw CGrafPtr of the pixmap's alpha channel. 0 is
- returned if it can't be obtained. Do not hold the pointer around for
- long as it can be relocated.
-
- \warning This function is only available on Mac OS X.
- \warning As of Qt 4.6, this function \e{always} returns zero.
-*/
-
-Qt::HANDLE QPixmap::macQDAlphaHandle() const
-{
- return 0;
-}
-
-/*! \internal
-
- Returns the CoreGraphics CGContextRef of the pixmap. 0 is returned if
- it can't be obtained. It is the caller's responsiblity to
- CGContextRelease the context when finished using it.
-
- \warning This function is only available on Mac OS X.
-*/
-
-Qt::HANDLE QPixmap::macCGHandle() const
-{
- if (isNull())
- return 0;
-
- if (data->classId() == QPlatformPixmap::MacClass) {
- QMacPlatformPixmap *d = static_cast<QMacPlatformPixmap *>(data.data());
- if (!d->cg_data)
- d->macCreateCGImageRef();
- CGImageRef ret = d->cg_data;
- CGImageRetain(ret);
- return ret;
- } else if (data->classId() == QPlatformPixmap::RasterClass) {
- return qt_mac_image_to_cgimage(static_cast<QRasterPlatformPixmap *>(data.data())->image);
- }
- return 0;
-}
-
-bool QMacPlatformPixmap::hasAlphaChannel() const
-{
- return has_alpha;
-}
-
-CGImageRef qt_mac_create_imagemask(const QPixmap &pixmap, const QRectF &sr)
-{
- QMacPlatformPixmap *px = static_cast<QMacPlatformPixmap*>(pixmap.data.data());
- if (px->cg_mask) {
- if (px->cg_mask_rect == sr) {
- CGImageRetain(px->cg_mask); //reference for the caller
- return px->cg_mask;
- }
- CGImageRelease(px->cg_mask);
- px->cg_mask = 0;
- }
-
- const int sx = qRound(sr.x()), sy = qRound(sr.y()), sw = qRound(sr.width()), sh = qRound(sr.height());
- const int sbpr = px->bytesPerRow;
- const uint nbytes = sw * sh;
- // alpha is always 255 for bitmaps, ignore it in this case.
- const quint32 mask = px->depth() == 1 ? 0x00ffffff : 0xffffffff;
- quint8 *dptr = static_cast<quint8 *>(malloc(nbytes));
- quint32 *sptr = px->pixels, *srow;
- for(int y = sy, offset=0; y < sh; ++y) {
- srow = sptr + (y * (sbpr / 4));
- for(int x = sx; x < sw; ++x)
- *(dptr+(offset++)) = (*(srow+x) & mask) ? 255 : 0;
- }
- QCFType<CGDataProviderRef> provider = CGDataProviderCreateWithData(0, dptr, nbytes, qt_mac_cgimage_data_free);
- px->cg_mask = CGImageMaskCreate(sw, sh, 8, 8, nbytes / sh, provider, 0, 0);
- px->cg_mask_rect = sr;
- CGImageRetain(px->cg_mask); //reference for the caller
- return px->cg_mask;
-}
-
-
-/*! \internal */
-QPaintEngine* QMacPlatformPixmap::paintEngine() const
-{
- if (!pengine) {
- QMacPlatformPixmap *that = const_cast<QMacPlatformPixmap*>(this);
- that->pengine = new QCoreGraphicsPaintEngine();
- }
- return pengine;
-}
-
-void QMacPlatformPixmap::copy(const QPlatformPixmap *data, const QRect &rect)
-{
- if (data->pixelType() == BitmapType) {
- QBitmap::fromImage(toImage().copy(rect));
- return;
- }
-
- const QMacPlatformPixmap *macData = static_cast<const QMacPlatformPixmap*>(data);
-
- resize(rect.width(), rect.height());
-
- has_alpha = macData->has_alpha;
- has_mask = macData->has_mask;
- uninit = false;
-
- const int x = rect.x();
- const int y = rect.y();
- char *dest = reinterpret_cast<char*>(pixels);
- const char *src = reinterpret_cast<const char*>(macData->pixels + x) + y * macData->bytesPerRow;
- for (int i = 0; i < h; ++i) {
- memcpy(dest, src, w * 4);
- dest += bytesPerRow;
- src += macData->bytesPerRow;
- }
-
- has_alpha = macData->has_alpha;
- has_mask = macData->has_mask;
-}
-
-bool QMacPlatformPixmap::scroll(int dx, int dy, const QRect &rect)
-{
- Q_UNUSED(dx);
- Q_UNUSED(dy);
- Q_UNUSED(rect);
- return false;
-}
-
-/*!
- \since 4.2
-
- Creates a \c CGImageRef equivalent to the QPixmap. Returns the \c CGImageRef handle.
-
- It is the caller's responsibility to release the \c CGImageRef data
- after use.
-
- \warning This function is only available on Mac OS X.
-
- \sa fromMacCGImageRef()
-*/
-CGImageRef QPixmap::toMacCGImageRef() const
-{
- return (CGImageRef)macCGHandle();
-}
-
-/*!
- \since 4.2
-
- Returns a QPixmap that is equivalent to the given \a image.
-
- \warning This function is only available on Mac OS X.
-
- \sa toMacCGImageRef(), {QPixmap#Pixmap Conversion}{Pixmap Conversion}
-*/
-QPixmap QPixmap::fromMacCGImageRef(CGImageRef image)
-{
- const size_t w = CGImageGetWidth(image),
- h = CGImageGetHeight(image);
- QPixmap ret(w, h);
- ret.fill(Qt::transparent);
- CGRect rect = CGRectMake(0, 0, w, h);
- CGContextRef ctx = qt_mac_cg_context(&ret);
- qt_mac_drawCGImage(ctx, &rect, image);
- CGContextRelease(ctx);
- return ret;
-}
-
-QT_END_NAMESPACE
diff --git a/src/widgets/platforms/mac/qpixmap_mac_p.h b/src/widgets/platforms/mac/qpixmap_mac_p.h
deleted file mode 100644
index 582eef27b6..0000000000
--- a/src/widgets/platforms/mac/qpixmap_mac_p.h
+++ /dev/null
@@ -1,134 +0,0 @@
-/****************************************************************************
-**
-** 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 QPIXMAP_MAC_P_H
-#define QPIXMAP_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 <QtGui/qplatformpixmap_qpa.h>
-#include <QtGui/qplatformpixmapfactory_p.h>
-#include <QtGui/private/qt_mac_p.h>
-
-QT_BEGIN_NAMESPACE
-
-class QMacPlatformPixmap : public QPlatformPixmap
-{
-public:
- QMacPlatformPixmap(PixelType type);
- ~QMacPlatformPixmap();
-
- QPlatformPixmap *createCompatiblePlatformPixmap() const;
-
- void resize(int width, int height);
- void fromImage(const QImage &image, Qt::ImageConversionFlags flags);
- void copy(const QPlatformPixmap *data, const QRect &rect);
- bool scroll(int dx, int dy, const QRect &rect);
-
- int metric(QPaintDevice::PaintDeviceMetric metric) const;
- void fill(const QColor &color);
- QBitmap mask() const;
- void setMask(const QBitmap &mask);
- bool hasAlphaChannel() const;
-// QPixmap transformed(const QTransform &matrix,
-// Qt::TransformationMode mode) const;
- void setAlphaChannel(const QPixmap &alphaChannel);
- QPixmap alphaChannel() const;
- QImage toImage() const;
- QPaintEngine* paintEngine() const;
-
-private:
-
- uint has_alpha : 1, has_mask : 1, uninit : 1;
-
- void macSetHasAlpha(bool b);
- void macGetAlphaChannel(QMacPlatformPixmap *, bool asMask) const;
- void macSetAlphaChannel(const QMacPlatformPixmap *, bool asMask);
- void macCreateCGImageRef();
- void macCreatePixels();
- void macReleaseCGImageRef();
- /*
- pixels stores the pixmap data. pixelsToFree is either 0 or some memory
- block that was bound to a CGImageRef and released, and for which the
- release callback has been called. There are two uses to pixelsToFree:
-
- 1. If pixels == pixelsToFree, then we know that the CGImageRef is done\
- with the data and we can modify pixels without breaking CGImageRef's
- mutability invariant.
-
- 2. If pixels != pixelsToFree and pixelsToFree != 0, then we can reuse
- pixelsToFree later on instead of malloc'ing memory.
- */
- quint32 *pixels;
- uint pixelsSize;
- quint32 *pixelsToFree;
- uint bytesPerRow;
- QRectF cg_mask_rect;
- CGImageRef cg_data, cg_dataBeingReleased, cg_mask;
- static QSet<QMacPlatformPixmap*> validDataPointers;
-
- QPaintEngine *pengine;
-
- friend class QPixmap;
- friend class QRasterBuffer;
- friend class QRasterPaintEngine;
- friend class QCoreGraphicsPaintEngine;
- friend CGImageRef qt_mac_create_imagemask(const QPixmap&, const QRectF&);
- friend quint32 *qt_mac_pixmap_get_base(const QPixmap*);
- friend int qt_mac_pixmap_get_bytes_per_line(const QPixmap*);
- friend void qt_mac_cgimage_data_free(void *, const void*, size_t);
- friend IconRef qt_mac_create_iconref(const QPixmap&);
- friend CGContextRef qt_mac_cg_context(const QPaintDevice*);
- friend QColor qcolorForThemeTextColor(ThemeTextColor themeColor);
-};
-
-QT_END_NAMESPACE
-
-#endif // QPIXMAP_MAC_P_H
diff --git a/src/widgets/platforms/mac/qprintengine_mac.mm b/src/widgets/platforms/mac/qprintengine_mac.mm
deleted file mode 100644
index 9902b3216d..0000000000
--- a/src/widgets/platforms/mac/qprintengine_mac.mm
+++ /dev/null
@@ -1,840 +0,0 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
-
-#include <private/qprintengine_mac_p.h>
-#include <qdebug.h>
-#include <qthread.h>
-#include <QtCore/qcoreapplication.h>
-
-#ifndef QT_NO_PRINTER
-
-QT_BEGIN_NAMESPACE
-
-extern QSizeF qt_paperSizeToQSizeF(QPrinter::PaperSize size);
-
-QMacPrintEngine::QMacPrintEngine(QPrinter::PrinterMode mode) : QPaintEngine(*(new QMacPrintEnginePrivate))
-{
- Q_D(QMacPrintEngine);
- d->mode = mode;
- d->initialize();
-}
-
-bool QMacPrintEngine::begin(QPaintDevice *dev)
-{
- Q_D(QMacPrintEngine);
-
- Q_ASSERT(dev && dev->devType() == QInternal::Printer);
- if (!static_cast<QPrinter *>(dev)->isValid())
- return false;
-
- if (d->state == QPrinter::Idle && !d->isPrintSessionInitialized()) // Need to reinitialize
- d->initialize();
-
- d->paintEngine->state = state;
- d->paintEngine->begin(dev);
- Q_ASSERT_X(d->state == QPrinter::Idle, "QMacPrintEngine", "printer already active");
-
- if (PMSessionValidatePrintSettings(d->session, d->settings, kPMDontWantBoolean) != noErr
- || PMSessionValidatePageFormat(d->session, d->format, kPMDontWantBoolean) != noErr) {
- d->state = QPrinter::Error;
- return false;
- }
-
- if (!d->outputFilename.isEmpty()) {
- QCFType<CFURLRef> outFile = CFURLCreateWithFileSystemPath(kCFAllocatorSystemDefault,
- QCFString(d->outputFilename),
- kCFURLPOSIXPathStyle,
- false);
- if (PMSessionSetDestination(d->session, d->settings, kPMDestinationFile,
- kPMDocumentFormatPDF, outFile) != noErr) {
- qWarning("QMacPrintEngine::begin: Problem setting file [%s]", d->outputFilename.toUtf8().constData());
- return false;
- }
- }
- OSStatus status = noErr;
- status = PMSessionBeginCGDocumentNoDialog(d->session, d->settings, d->format);
-
- if (status != noErr) {
- d->state = QPrinter::Error;
- return false;
- }
-
- d->state = QPrinter::Active;
- setActive(true);
- d->newPage_helper();
- return true;
-}
-
-bool QMacPrintEngine::end()
-{
- Q_D(QMacPrintEngine);
- if (d->state == QPrinter::Aborted)
- return true; // I was just here a function call ago :)
- if(d->paintEngine->type() == QPaintEngine::CoreGraphics) {
- // We dont need the paint engine to call restoreGraphicsState()
- static_cast<QCoreGraphicsPaintEngine*>(d->paintEngine)->d_func()->stackCount = 0;
- static_cast<QCoreGraphicsPaintEngine*>(d->paintEngine)->d_func()->hd = 0;
- }
- d->paintEngine->end();
- if (d->state != QPrinter::Idle)
- d->releaseSession();
- d->state = QPrinter::Idle;
- return true;
-}
-
-QPaintEngine *
-QMacPrintEngine::paintEngine() const
-{
- return d_func()->paintEngine;
-}
-
-Qt::HANDLE QMacPrintEngine::handle() const
-{
- QCoreGraphicsPaintEngine *cgEngine = static_cast<QCoreGraphicsPaintEngine*>(paintEngine());
- return cgEngine->d_func()->hd;
-}
-
-QMacPrintEnginePrivate::~QMacPrintEnginePrivate()
-{
- [printInfo release];
- delete paintEngine;
-}
-
-void QMacPrintEnginePrivate::setPaperSize(QPrinter::PaperSize ps)
-{
- Q_Q(QMacPrintEngine);
- QSizeF newSize = qt_paperSizeToQSizeF(ps);
- QCFType<CFArrayRef> formats;
- PMPrinter printer;
-
- if (PMSessionGetCurrentPrinter(session, &printer) == noErr
- && PMSessionCreatePageFormatList(session, printer, &formats) == noErr) {
- CFIndex total = CFArrayGetCount(formats);
- PMPageFormat tmp;
- PMRect paper;
- for (CFIndex idx = 0; idx < total; ++idx) {
- tmp = static_cast<PMPageFormat>(
- const_cast<void *>(CFArrayGetValueAtIndex(formats, idx)));
- PMGetUnadjustedPaperRect(tmp, &paper);
- int wMM = int((paper.right - paper.left) / 72 * 25.4 + 0.5);
- int hMM = int((paper.bottom - paper.top) / 72 * 25.4 + 0.5);
- if (newSize.width() == wMM && newSize.height() == hMM) {
- PMCopyPageFormat(tmp, format);
- // reset the orientation and resolution as they are lost in the copy.
- q->setProperty(QPrintEngine::PPK_Orientation, orient);
- if (PMSessionValidatePageFormat(session, format, kPMDontWantBoolean) != noErr) {
- // Don't know, warn for the moment.
- qWarning("QMacPrintEngine, problem setting format and resolution for this page size");
- }
- break;
- }
- }
- }
-}
-
-QPrinter::PaperSize QMacPrintEnginePrivate::paperSize() const
-{
- PMRect paper;
- PMGetUnadjustedPaperRect(format, &paper);
- int wMM = int((paper.right - paper.left) / 72 * 25.4 + 0.5);
- int hMM = int((paper.bottom - paper.top) / 72 * 25.4 + 0.5);
- for (int i = QPrinter::A4; i < QPrinter::NPaperSize; ++i) {
- QSizeF s = qt_paperSizeToQSizeF(QPrinter::PaperSize(i));
- if (s.width() == wMM && s.height() == hMM)
- return (QPrinter::PaperSize)i;
- }
- return QPrinter::Custom;
-}
-
-QList<QVariant> QMacPrintEnginePrivate::supportedResolutions() const
-{
- Q_ASSERT_X(session, "QMacPrinterEngine::supportedResolutions",
- "must have a valid printer session");
- UInt32 resCount;
- QList<QVariant> resolutions;
- PMPrinter printer;
- if (PMSessionGetCurrentPrinter(session, &printer) == noErr) {
- PMResolution res;
- OSStatus status = PMPrinterGetPrinterResolutionCount(printer, &resCount);
- if (status == kPMNotImplemented) {
-#if (MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_5)
- // *Sigh* we have to use the non-indexed version.
- if (PMPrinterGetPrinterResolution(printer, kPMMinSquareResolution, &res) == noErr)
- resolutions.append(int(res.hRes));
- if (PMPrinterGetPrinterResolution(printer, kPMMaxSquareResolution, &res) == noErr) {
- QVariant var(int(res.hRes));
- if (!resolutions.contains(var))
- resolutions.append(var);
- }
- if (PMPrinterGetPrinterResolution(printer, kPMDefaultResolution, &res) == noErr) {
- QVariant var(int(res.hRes));
- if (!resolutions.contains(var))
- resolutions.append(var);
- }
-#endif
- } else if (status == noErr) {
- // According to the docs, index start at 1.
- for (UInt32 i = 1; i <= resCount; ++i) {
- if (PMPrinterGetIndexedPrinterResolution(printer, i, &res) == noErr)
- resolutions.append(QVariant(int(res.hRes)));
- }
- } else {
- qWarning("QMacPrintEngine::supportedResolutions: Unexpected error: %ld", long(status));
- }
- }
- return resolutions;
-}
-
-bool QMacPrintEnginePrivate::shouldSuppressStatus() const
-{
- if (suppressStatus == true)
- return true;
-
- // Supress displaying the automatic progress dialog if we are printing
- // from a non-gui thread.
- return (qApp->thread() != QThread::currentThread());
-}
-
-QPrinter::PrinterState QMacPrintEngine::printerState() const
-{
- return d_func()->state;
-}
-
-bool QMacPrintEngine::newPage()
-{
- Q_D(QMacPrintEngine);
- Q_ASSERT(d->state == QPrinter::Active);
- OSStatus err =
- PMSessionEndPageNoDialog(d->session);
- if (err != noErr) {
- if (err == kPMCancel) {
- // User canceled, we need to abort!
- abort();
- } else {
- // Not sure what the problem is...
- qWarning("QMacPrintEngine::newPage: Cannot end current page. %ld", long(err));
- d->state = QPrinter::Error;
- }
- return false;
- }
- return d->newPage_helper();
-}
-
-bool QMacPrintEngine::abort()
-{
- Q_D(QMacPrintEngine);
- if (d->state != QPrinter::Active)
- return false;
- bool ret = end();
- d->state = QPrinter::Aborted;
- return ret;
-}
-
-static inline int qt_get_PDMWidth(PMPageFormat pformat, bool fullPage,
- const PMResolution &resolution)
-{
- int val = 0;
- PMRect r;
- qreal hRatio = resolution.hRes / 72;
- if (fullPage) {
- if (PMGetAdjustedPaperRect(pformat, &r) == noErr)
- val = qRound((r.right - r.left) * hRatio);
- } else {
- if (PMGetAdjustedPageRect(pformat, &r) == noErr)
- val = qRound((r.right - r.left) * hRatio);
- }
- return val;
-}
-
-static inline int qt_get_PDMHeight(PMPageFormat pformat, bool fullPage,
- const PMResolution &resolution)
-{
- int val = 0;
- PMRect r;
- qreal vRatio = resolution.vRes / 72;
- if (fullPage) {
- if (PMGetAdjustedPaperRect(pformat, &r) == noErr)
- val = qRound((r.bottom - r.top) * vRatio);
- } else {
- if (PMGetAdjustedPageRect(pformat, &r) == noErr)
- val = qRound((r.bottom - r.top) * vRatio);
- }
- return val;
-}
-
-
-int QMacPrintEngine::metric(QPaintDevice::PaintDeviceMetric m) const
-{
- Q_D(const QMacPrintEngine);
- int val = 1;
- switch (m) {
- case QPaintDevice::PdmWidth:
- if (d->hasCustomPaperSize) {
- val = qRound(d->customSize.width());
- if (d->hasCustomPageMargins) {
- val -= qRound(d->leftMargin + d->rightMargin);
- } else {
- QList<QVariant> margins = property(QPrintEngine::PPK_PageMargins).toList();
- val -= qRound(margins.at(0).toDouble() + margins.at(2).toDouble());
- }
- } else {
- val = qt_get_PDMWidth(d->format, property(PPK_FullPage).toBool(), d->resolution);
- }
- break;
- case QPaintDevice::PdmHeight:
- if (d->hasCustomPaperSize) {
- val = qRound(d->customSize.height());
- if (d->hasCustomPageMargins) {
- val -= qRound(d->topMargin + d->bottomMargin);
- } else {
- QList<QVariant> margins = property(QPrintEngine::PPK_PageMargins).toList();
- val -= qRound(margins.at(1).toDouble() + margins.at(3).toDouble());
- }
- } else {
- val = qt_get_PDMHeight(d->format, property(PPK_FullPage).toBool(), d->resolution);
- }
- break;
- case QPaintDevice::PdmWidthMM:
- val = metric(QPaintDevice::PdmWidth);
- val = int((val * 254 + 5 * d->resolution.hRes) / (10 * d->resolution.hRes));
- break;
- case QPaintDevice::PdmHeightMM:
- val = metric(QPaintDevice::PdmHeight);
- val = int((val * 254 + 5 * d->resolution.vRes) / (10 * d->resolution.vRes));
- break;
- case QPaintDevice::PdmPhysicalDpiX:
- case QPaintDevice::PdmPhysicalDpiY: {
- PMPrinter printer;
- if(PMSessionGetCurrentPrinter(d->session, &printer) == noErr) {
- PMResolution resolution;
- PMPrinterGetOutputResolution(printer, d->settings, &resolution);
- val = (int)resolution.vRes;
- break;
- }
- //otherwise fall through
- }
- case QPaintDevice::PdmDpiY:
- val = (int)d->resolution.vRes;
- break;
- case QPaintDevice::PdmDpiX:
- val = (int)d->resolution.hRes;
- break;
- case QPaintDevice::PdmNumColors:
- val = (1 << metric(QPaintDevice::PdmDepth));
- break;
- case QPaintDevice::PdmDepth:
- val = 24;
- break;
- default:
- val = 0;
- qWarning("QPrinter::metric: Invalid metric command");
- }
- return val;
-}
-
-void QMacPrintEnginePrivate::initialize()
-{
- Q_Q(QMacPrintEngine);
-
- Q_ASSERT(!printInfo);
-
- if (!paintEngine)
- paintEngine = new QCoreGraphicsPaintEngine();
-
- q->gccaps = paintEngine->gccaps;
-
- fullPage = false;
-
- QMacCocoaAutoReleasePool pool;
- printInfo = [[NSPrintInfo alloc] initWithDictionary:[NSDictionary dictionary]];
- session = static_cast<PMPrintSession>([printInfo PMPrintSession]);
-
- PMPrinter printer;
- if (session && PMSessionGetCurrentPrinter(session, &printer) == noErr) {
- QList<QVariant> resolutions = supportedResolutions();
- if (!resolutions.isEmpty() && mode != QPrinter::ScreenResolution) {
- if (resolutions.count() > 1 && mode == QPrinter::HighResolution) {
- int max = 0;
- for (int i = 0; i < resolutions.count(); ++i) {
- int value = resolutions.at(i).toInt();
- if (value > max)
- max = value;
- }
- resolution.hRes = resolution.vRes = max;
- } else {
- resolution.hRes = resolution.vRes = resolutions.at(0).toInt();
- }
- if(resolution.hRes == 0)
- resolution.hRes = resolution.vRes = 600;
- } else {
- resolution.hRes = resolution.vRes = qt_defaultDpi();
- }
- }
-
- settings = static_cast<PMPrintSettings>([printInfo PMPrintSettings]);
- format = static_cast<PMPageFormat>([printInfo PMPageFormat]);
-
-
- QHash<QMacPrintEngine::PrintEnginePropertyKey, QVariant>::const_iterator propC;
- for (propC = valueCache.constBegin(); propC != valueCache.constEnd(); propC++) {
- q->setProperty(propC.key(), propC.value());
- }
-}
-
-void QMacPrintEnginePrivate::releaseSession()
-{
- PMSessionEndPageNoDialog(session);
- PMSessionEndDocumentNoDialog(session);
- [printInfo release];
- printInfo = 0;
- session = 0;
-}
-
-bool QMacPrintEnginePrivate::newPage_helper()
-{
- Q_Q(QMacPrintEngine);
- Q_ASSERT(state == QPrinter::Active);
-
- if (PMSessionError(session) != noErr) {
- q->abort();
- return false;
- }
-
- // pop the stack of saved graphic states, in case we get the same
- // context back - either way, the stack count should be 0 when we
- // get the new one
- QCoreGraphicsPaintEngine *cgEngine = static_cast<QCoreGraphicsPaintEngine*>(paintEngine);
- while (cgEngine->d_func()->stackCount > 0)
- cgEngine->d_func()->restoreGraphicsState();
-
- OSStatus status =
- PMSessionBeginPageNoDialog(session, format, 0);
- if(status != noErr) {
- state = QPrinter::Error;
- return false;
- }
-
- QRect page = q->property(QPrintEngine::PPK_PageRect).toRect();
- QRect paper = q->property(QPrintEngine::PPK_PaperRect).toRect();
-
- CGContextRef cgContext;
- OSStatus err = noErr;
- err = PMSessionGetCGGraphicsContext(session, &cgContext);
- if(err != noErr) {
- qWarning("QMacPrintEngine::newPage: Cannot retrieve CoreGraphics context: %ld", long(err));
- state = QPrinter::Error;
- return false;
- }
- cgEngine->d_func()->hd = cgContext;
-
- // Set the resolution as a scaling ration of 72 (the default).
- CGContextScaleCTM(cgContext, 72 / resolution.hRes, 72 / resolution.vRes);
-
- CGContextScaleCTM(cgContext, 1, -1);
- CGContextTranslateCTM(cgContext, 0, -paper.height());
- if (!fullPage)
- CGContextTranslateCTM(cgContext, page.x() - paper.x(), page.y() - paper.y());
- cgEngine->d_func()->orig_xform = CGContextGetCTM(cgContext);
- cgEngine->d_func()->setClip(0);
- cgEngine->state->dirtyFlags = QPaintEngine::DirtyFlag(QPaintEngine::AllDirty
- & ~(QPaintEngine::DirtyClipEnabled
- | QPaintEngine::DirtyClipRegion
- | QPaintEngine::DirtyClipPath));
- if (cgEngine->painter()->hasClipping())
- cgEngine->state->dirtyFlags |= QPaintEngine::DirtyClipEnabled;
- cgEngine->syncState();
- return true;
-}
-
-
-void QMacPrintEngine::updateState(const QPaintEngineState &state)
-{
- d_func()->paintEngine->updateState(state);
-}
-
-void QMacPrintEngine::drawRects(const QRectF *r, int num)
-{
- Q_D(QMacPrintEngine);
- Q_ASSERT(d->state == QPrinter::Active);
- d->paintEngine->drawRects(r, num);
-}
-
-void QMacPrintEngine::drawPoints(const QPointF *points, int pointCount)
-{
- Q_D(QMacPrintEngine);
- Q_ASSERT(d->state == QPrinter::Active);
- d->paintEngine->drawPoints(points, pointCount);
-}
-
-void QMacPrintEngine::drawEllipse(const QRectF &r)
-{
- Q_D(QMacPrintEngine);
- Q_ASSERT(d->state == QPrinter::Active);
- d->paintEngine->drawEllipse(r);
-}
-
-void QMacPrintEngine::drawLines(const QLineF *lines, int lineCount)
-{
- Q_D(QMacPrintEngine);
- Q_ASSERT(d->state == QPrinter::Active);
- d->paintEngine->drawLines(lines, lineCount);
-}
-
-void QMacPrintEngine::drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode)
-{
- Q_D(QMacPrintEngine);
- Q_ASSERT(d->state == QPrinter::Active);
- d->paintEngine->drawPolygon(points, pointCount, mode);
-}
-
-void QMacPrintEngine::drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr)
-{
- Q_D(QMacPrintEngine);
- Q_ASSERT(d->state == QPrinter::Active);
- d->paintEngine->drawPixmap(r, pm, sr);
-}
-
-void QMacPrintEngine::drawImage(const QRectF &r, const QImage &pm, const QRectF &sr, Qt::ImageConversionFlags flags)
-{
- Q_D(QMacPrintEngine);
- Q_ASSERT(d->state == QPrinter::Active);
- d->paintEngine->drawImage(r, pm, sr, flags);
-}
-
-void QMacPrintEngine::drawTextItem(const QPointF &p, const QTextItem &ti)
-{
- Q_D(QMacPrintEngine);
- Q_ASSERT(d->state == QPrinter::Active);
- d->paintEngine->drawTextItem(p, ti);
-}
-
-void QMacPrintEngine::drawTiledPixmap(const QRectF &dr, const QPixmap &pixmap, const QPointF &sr)
-{
- Q_D(QMacPrintEngine);
- Q_ASSERT(d->state == QPrinter::Active);
- d->paintEngine->drawTiledPixmap(dr, pixmap, sr);
-}
-
-void QMacPrintEngine::drawPath(const QPainterPath &path)
-{
- Q_D(QMacPrintEngine);
- Q_ASSERT(d->state == QPrinter::Active);
- d->paintEngine->drawPath(path);
-}
-
-
-void QMacPrintEngine::setProperty(PrintEnginePropertyKey key, const QVariant &value)
-{
- Q_D(QMacPrintEngine);
-
- d->valueCache.insert(key, value);
- if (!d->session)
- return;
-
- switch (key) {
- case PPK_CollateCopies:
- break;
- case PPK_ColorMode:
- break;
- case PPK_Creator:
- break;
- case PPK_DocumentName:
- break;
- case PPK_PageOrder:
- break;
- case PPK_PaperSource:
- break;
- case PPK_SelectionOption:
- break;
- case PPK_Resolution: {
- PMPrinter printer;
- UInt32 count;
- if (PMSessionGetCurrentPrinter(d->session, &printer) != noErr)
- break;
- if (PMPrinterGetPrinterResolutionCount(printer, &count) != noErr)
- break;
- PMResolution resolution = { 0.0, 0.0 };
- PMResolution bestResolution = { 0.0, 0.0 };
- int dpi = value.toInt();
- int bestDistance = INT_MAX;
- for (UInt32 i = 1; i <= count; ++i) { // Yes, it starts at 1
- if (PMPrinterGetIndexedPrinterResolution(printer, i, &resolution) == noErr) {
- if (dpi == int(resolution.hRes)) {
- bestResolution = resolution;
- break;
- } else {
- int distance = qAbs(dpi - int(resolution.hRes));
- if (distance < bestDistance) {
- bestDistance = distance;
- bestResolution = resolution;
- }
- }
- }
- }
- PMSessionValidatePageFormat(d->session, d->format, kPMDontWantBoolean);
- break;
- }
-
- case PPK_FullPage:
- d->fullPage = value.toBool();
- break;
- case PPK_CopyCount: // fallthrough
- case PPK_NumberOfCopies:
- PMSetCopies(d->settings, value.toInt(), false);
- break;
- case PPK_Orientation: {
- if (d->state == QPrinter::Active) {
- qWarning("QMacPrintEngine::setOrientation: Orientation cannot be changed during a print job, ignoring change");
- } else {
- QPrinter::Orientation newOrientation = QPrinter::Orientation(value.toInt());
- if (d->hasCustomPaperSize && (d->orient != newOrientation))
- d->customSize = QSizeF(d->customSize.height(), d->customSize.width());
- d->orient = newOrientation;
- PMOrientation o = d->orient == QPrinter::Portrait ? kPMPortrait : kPMLandscape;
- PMSetOrientation(d->format, o, false);
- PMSessionValidatePageFormat(d->session, d->format, kPMDontWantBoolean);
- }
- break; }
- case PPK_OutputFileName:
- d->outputFilename = value.toString();
- break;
- case PPK_PaperSize:
- d->setPaperSize(QPrinter::PaperSize(value.toInt()));
- break;
- case PPK_PrinterName: {
- bool printerNameSet = false;
- OSStatus status = noErr;
- QCFType<CFArrayRef> printerList;
- status = PMServerCreatePrinterList(kPMServerLocal, &printerList);
- if (status == noErr) {
- CFIndex count = CFArrayGetCount(printerList);
- for (CFIndex i=0; i<count; ++i) {
- PMPrinter printer = static_cast<PMPrinter>(const_cast<void *>(CFArrayGetValueAtIndex(printerList, i)));
- QString name = QCFString::toQString(PMPrinterGetName(printer));
- if (name == value.toString()) {
- status = PMSessionSetCurrentPMPrinter(d->session, printer);
- printerNameSet = true;
- break;
- }
- }
- }
- if (status != noErr)
- qWarning("QMacPrintEngine::setPrinterName: Error setting printer: %ld", long(status));
- if (!printerNameSet) {
- qWarning("QMacPrintEngine::setPrinterName: Failed to set printer named '%s'.", qPrintable(value.toString()));
- d->releaseSession();
- d->state = QPrinter::Idle;
- }
- break; }
- case PPK_SuppressSystemPrintStatus:
- d->suppressStatus = value.toBool();
- break;
- case PPK_CustomPaperSize:
- {
- PMOrientation orientation;
- PMGetOrientation(d->format, &orientation);
- d->hasCustomPaperSize = true;
- d->customSize = value.toSizeF();
- if (orientation != kPMPortrait)
- d->customSize = QSizeF(d->customSize.height(), d->customSize.width());
- break;
- }
- case PPK_PageMargins:
- {
- QList<QVariant> margins(value.toList());
- Q_ASSERT(margins.size() == 4);
- d->leftMargin = margins.at(0).toDouble();
- d->topMargin = margins.at(1).toDouble();
- d->rightMargin = margins.at(2).toDouble();
- d->bottomMargin = margins.at(3).toDouble();
- d->hasCustomPageMargins = true;
- break;
- }
-
- default:
- break;
- }
-}
-
-QVariant QMacPrintEngine::property(PrintEnginePropertyKey key) const
-{
- Q_D(const QMacPrintEngine);
- QVariant ret;
-
- if (!d->session && d->valueCache.contains(key))
- return *d->valueCache.find(key);
-
- switch (key) {
- case PPK_CollateCopies:
- ret = false;
- break;
- case PPK_ColorMode:
- ret = QPrinter::Color;
- break;
- case PPK_Creator:
- break;
- case PPK_DocumentName:
- break;
- case PPK_FullPage:
- ret = d->fullPage;
- break;
- case PPK_NumberOfCopies:
- ret = 1;
- break;
- case PPK_CopyCount: {
- UInt32 copies = 1;
- PMGetCopies(d->settings, &copies);
- ret = (uint) copies;
- break;
- }
- case PPK_SupportsMultipleCopies:
- ret = true;
- break;
- case PPK_Orientation:
- PMOrientation orientation;
- PMGetOrientation(d->format, &orientation);
- ret = orientation == kPMPortrait ? QPrinter::Portrait : QPrinter::Landscape;
- break;
- case PPK_OutputFileName:
- ret = d->outputFilename;
- break;
- case PPK_PageOrder:
- break;
- case PPK_PaperSource:
- break;
- case PPK_PageRect: {
- // PageRect is returned in device pixels
- QRect r;
- PMRect macrect, macpaper;
- qreal hRatio = d->resolution.hRes / 72;
- qreal vRatio = d->resolution.vRes / 72;
- if (d->hasCustomPaperSize) {
- r = QRect(0, 0, qRound(d->customSize.width() * hRatio), qRound(d->customSize.height() * vRatio));
- if (d->hasCustomPageMargins) {
- r.adjust(qRound(d->leftMargin * hRatio), qRound(d->topMargin * vRatio),
- -qRound(d->rightMargin * hRatio), -qRound(d->bottomMargin * vRatio));
- } else {
- QList<QVariant> margins = property(QPrintEngine::PPK_PageMargins).toList();
- r.adjust(qRound(margins.at(0).toDouble() * hRatio),
- qRound(margins.at(1).toDouble() * vRatio),
- -qRound(margins.at(2).toDouble() * hRatio),
- -qRound(margins.at(3).toDouble()) * vRatio);
- }
- } else if (PMGetAdjustedPageRect(d->format, &macrect) == noErr
- && PMGetAdjustedPaperRect(d->format, &macpaper) == noErr)
- {
- if (d->fullPage || d->hasCustomPageMargins) {
- r.setCoords(int(macpaper.left * hRatio), int(macpaper.top * vRatio),
- int(macpaper.right * hRatio), int(macpaper.bottom * vRatio));
- r.translate(-r.x(), -r.y());
- if (d->hasCustomPageMargins) {
- r.adjust(qRound(d->leftMargin * hRatio), qRound(d->topMargin * vRatio),
- -qRound(d->rightMargin * hRatio), -qRound(d->bottomMargin * vRatio));
- }
- } else {
- r.setCoords(int(macrect.left * hRatio), int(macrect.top * vRatio),
- int(macrect.right * hRatio), int(macrect.bottom * vRatio));
- r.translate(int(-macpaper.left * hRatio), int(-macpaper.top * vRatio));
- }
- }
- ret = r;
- break; }
- case PPK_PaperSize:
- ret = d->paperSize();
- break;
- case PPK_PaperRect: {
- QRect r;
- PMRect macrect;
- if (d->hasCustomPaperSize) {
- r = QRect(0, 0, qRound(d->customSize.width()), qRound(d->customSize.height()));
- } else if (PMGetAdjustedPaperRect(d->format, &macrect) == noErr) {
- qreal hRatio = d->resolution.hRes / 72;
- qreal vRatio = d->resolution.vRes / 72;
- r.setCoords(int(macrect.left * hRatio), int(macrect.top * vRatio),
- int(macrect.right * hRatio), int(macrect.bottom * vRatio));
- r.translate(-r.x(), -r.y());
- }
- ret = r;
- break; }
- case PPK_PrinterName: {
- PMPrinter printer;
- OSStatus status = PMSessionGetCurrentPrinter(d->session, &printer);
- if (status != noErr)
- qWarning("QMacPrintEngine::printerName: Failed getting current PMPrinter: %ld", long(status));
- if (printer)
- ret = QCFString::toQString(PMPrinterGetName(printer));
- break; }
- case PPK_Resolution: {
- ret = d->resolution.hRes;
- break;
- }
- case PPK_SupportedResolutions:
- ret = d->supportedResolutions();
- break;
- case PPK_CustomPaperSize:
- ret = d->customSize;
- break;
- case PPK_PageMargins:
- {
- QList<QVariant> margins;
- if (d->hasCustomPageMargins) {
- margins << d->leftMargin << d->topMargin
- << d->rightMargin << d->bottomMargin;
- } else {
- PMPaperMargins paperMargins;
- PMPaper paper;
- PMGetPageFormatPaper(d->format, &paper);
- PMPaperGetMargins(paper, &paperMargins);
- margins << paperMargins.left << paperMargins.top
- << paperMargins.right << paperMargins.bottom;
- }
- ret = margins;
- break;
- }
- default:
- break;
- }
- return ret;
-}
-
-QT_END_NAMESPACE
-
-#endif // QT_NO_PRINTER
diff --git a/src/widgets/platforms/mac/qprintengine_mac_p.h b/src/widgets/platforms/mac/qprintengine_mac_p.h
deleted file mode 100644
index 349dfd10f2..0000000000
--- a/src/widgets/platforms/mac/qprintengine_mac_p.h
+++ /dev/null
@@ -1,162 +0,0 @@
-/****************************************************************************
-**
-** 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 QPRINTENGINE_MAC_P_H
-#define QPRINTENGINE_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.
-//
-
-#ifndef QT_NO_PRINTER
-
-#include "QtGui/qprinter.h"
-#include "QtGui/qprintengine.h"
-#include "private/qpaintengine_mac_p.h"
-#include "private/qpainter_p.h"
-
-#ifdef __OBJC__
-@class NSPrintInfo;
-#else
-typedef void NSPrintInfo;
-#endif
-
-QT_BEGIN_NAMESPACE
-
-class QPrinterPrivate;
-class QMacPrintEnginePrivate;
-class QMacPrintEngine : public QPaintEngine, public QPrintEngine
-{
- Q_DECLARE_PRIVATE(QMacPrintEngine)
-public:
- QMacPrintEngine(QPrinter::PrinterMode mode);
-
- Qt::HANDLE handle() const;
-
- bool begin(QPaintDevice *dev);
- bool end();
- virtual QPaintEngine::Type type() const { return QPaintEngine::MacPrinter; }
-
- QPaintEngine *paintEngine() const;
-
- void setProperty(PrintEnginePropertyKey key, const QVariant &value);
- QVariant property(PrintEnginePropertyKey key) const;
-
- QPrinter::PrinterState printerState() const;
-
- bool newPage();
- bool abort();
- int metric(QPaintDevice::PaintDeviceMetric) const;
-
- //forwarded functions
-
- void updateState(const QPaintEngineState &state);
-
- virtual void drawLines(const QLineF *lines, int lineCount);
- virtual void drawRects(const QRectF *r, int num);
- virtual void drawPoints(const QPointF *p, int pointCount);
- virtual void drawEllipse(const QRectF &r);
- virtual void drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode);
- 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 &p, const QTextItem &ti);
- virtual void drawTiledPixmap(const QRectF &r, const QPixmap &pixmap, const QPointF &s);
- virtual void drawPath(const QPainterPath &);
-
-private:
- friend class QPrintDialog;
- friend class QPageSetupDialog;
-};
-
-class QMacPrintEnginePrivate : public QPaintEnginePrivate
-{
- Q_DECLARE_PUBLIC(QMacPrintEngine)
-public:
- QPrinter::PrinterMode mode;
- QPrinter::PrinterState state;
- QPrinter::Orientation orient;
- NSPrintInfo *printInfo;
- PMPageFormat format;
- PMPrintSettings settings;
- PMPrintSession session;
- PMResolution resolution;
- QString outputFilename;
- bool fullPage;
- QPaintEngine *paintEngine;
- bool suppressStatus;
- bool hasCustomPaperSize;
- QSizeF customSize;
- bool hasCustomPageMargins;
- qreal leftMargin;
- qreal topMargin;
- qreal rightMargin;
- qreal bottomMargin;
- QHash<QMacPrintEngine::PrintEnginePropertyKey, QVariant> valueCache;
- QMacPrintEnginePrivate() : mode(QPrinter::ScreenResolution), state(QPrinter::Idle),
- orient(QPrinter::Portrait), printInfo(0), format(0), settings(0),
- session(0), paintEngine(0), suppressStatus(false),
- hasCustomPaperSize(false), hasCustomPageMargins(false) {}
- ~QMacPrintEnginePrivate();
- void initialize();
- void releaseSession();
- bool newPage_helper();
- void setPaperSize(QPrinter::PaperSize ps);
- QPrinter::PaperSize paperSize() const;
- QList<QVariant> supportedResolutions() const;
- inline bool isPrintSessionInitialized() const
- {
- return printInfo != 0;
- }
- bool shouldSuppressStatus() const;
-};
-
-QT_END_NAMESPACE
-
-#endif // QT_NO_PRINTER
-
-#endif // QPRINTENGINE_WIN_P_H
diff --git a/src/widgets/platforms/mac/qprinterinfo_mac.cpp b/src/widgets/platforms/mac/qprinterinfo_mac.cpp
deleted file mode 100644
index 98492a5af6..0000000000
--- a/src/widgets/platforms/mac/qprinterinfo_mac.cpp
+++ /dev/null
@@ -1,120 +0,0 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
-
-#include "qprinterinfo.h"
-#include "qprinterinfo_p.h"
-
-#include "private/qt_mac_p.h"
-
-QT_BEGIN_NAMESPACE
-
-#ifndef QT_NO_PRINTER
-
-extern QPrinter::PaperSize qSizeFTopaperSize(const QSizeF &size);
-
-QList<QPrinterInfo> QPrinterInfo::availablePrinters()
-{
- QList<QPrinterInfo> printers;
-
- QCFType<CFArrayRef> array;
- if (PMServerCreatePrinterList(kPMServerLocal, &array) == noErr) {
- CFIndex count = CFArrayGetCount(array);
- for (int i = 0; i < count; ++i) {
- PMPrinter printer = static_cast<PMPrinter>(const_cast<void *>(CFArrayGetValueAtIndex(array, i)));
- QString printerName = QCFString::toQString(PMPrinterGetName(printer));
-
- QPrinterInfo printerInfo(printerName);
- if (PMPrinterIsDefault(printer))
- printerInfo.d_ptr->isDefault = true;
- printers.append(printerInfo);
- }
- }
-
- return printers;
-}
-
-QPrinterInfo QPrinterInfo::defaultPrinter()
-{
- QList<QPrinterInfo> printers = availablePrinters();
- foreach (const QPrinterInfo &printerInfo, printers) {
- if (printerInfo.isDefault())
- return printerInfo;
- }
-
- return printers.value(0);
-}
-
-QList<QPrinter::PaperSize> QPrinterInfo::supportedPaperSizes() const
-{
- const Q_D(QPrinterInfo);
-
- QList<QPrinter::PaperSize> paperSizes;
- if (isNull())
- return paperSizes;
-
- PMPrinter cfPrn = PMPrinterCreateFromPrinterID(QCFString::toCFStringRef(d->name));
- if (!cfPrn)
- return paperSizes;
-
- CFArrayRef array;
- if (PMPrinterGetPaperList(cfPrn, &array) != noErr) {
- PMRelease(cfPrn);
- return paperSizes;
- }
-
- int count = CFArrayGetCount(array);
- for (int i = 0; i < count; ++i) {
- PMPaper paper = static_cast<PMPaper>(const_cast<void *>(CFArrayGetValueAtIndex(array, i)));
- double width, height;
- if (PMPaperGetWidth(paper, &width) == noErr && PMPaperGetHeight(paper, &height) == noErr) {
- QSizeF size(width * 0.3527, height * 0.3527);
- paperSizes.append(qSizeFTopaperSize(size));
- }
- }
-
- PMRelease(cfPrn);
-
- return paperSizes;
-}
-
-#endif // QT_NO_PRINTER
-
-QT_END_NAMESPACE
diff --git a/src/widgets/platforms/mac/qregion_mac.cpp b/src/widgets/platforms/mac/qregion_mac.cpp
deleted file mode 100644
index 71e7a3b44b..0000000000
--- a/src/widgets/platforms/mac/qregion_mac.cpp
+++ /dev/null
@@ -1,50 +0,0 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
-
-#include <private/qt_mac_p.h>
-#include "qcoreapplication.h"
-#include <qlibrary.h>
-
-QT_BEGIN_NAMESPACE
-
-QRegion::QRegionData QRegion::shared_empty = { Q_BASIC_ATOMIC_INITIALIZER(1), 0 };
-
-QT_END_NAMESPACE
diff --git a/src/widgets/platforms/mac/qt_cocoa_helpers_mac.mm b/src/widgets/platforms/mac/qt_cocoa_helpers_mac.mm
deleted file mode 100644
index 348b989ec6..0000000000
--- a/src/widgets/platforms/mac/qt_cocoa_helpers_mac.mm
+++ /dev/null
@@ -1,1438 +0,0 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
-
-/****************************************************************************
-**
-** Copyright (c) 2007-2008, Apple, Inc.
-**
-** All rights reserved.
-**
-** Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are met:
-**
-** * Redistributions of source code must retain the above copyright notice,
-** this list of conditions and the following disclaimer.
-**
-** * Redistributions in binary form must reproduce the above copyright notice,
-** this list of conditions and the following disclaimer in the documentation
-** and/or other materials provided with the distribution.
-**
-** * Neither the name of Apple, Inc. nor the names of its contributors
-** may be used to endorse or promote products derived from this software
-** without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-** CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-** EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-** PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-** PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-** LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-** NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-** SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-**
-****************************************************************************/
-
-#include <private/qcore_mac_p.h>
-#include <qaction.h>
-#include <qwidget.h>
-#include <qdesktopwidget.h>
-#include <qevent.h>
-#include <qpixmapcache.h>
-#include <qvarlengtharray.h>
-#include <private/qevent_p.h>
-#include <private/qt_cocoa_helpers_mac_p.h>
-#include <private/qt_mac_p.h>
-#include <private/qapplication_p.h>
-#include <private/qcocoaapplication_mac_p.h>
-#include <private/qcocoawindow_mac_p.h>
-#include <private/qcocoaview_mac_p.h>
-#include <private/qkeymapper_p.h>
-#include <private/qwidget_p.h>
-#include <private/qcocoawindow_mac_p.h>
-
-QT_BEGIN_NAMESPACE
-
-// Cmd + left mousebutton should produce a right button
-// press (mainly for mac users with one-button mice):
-static bool qt_leftButtonIsRightButton = false;
-
-Q_GLOBAL_STATIC(QMacWindowFader, macwindowFader);
-
-QMacWindowFader::QMacWindowFader()
- : m_duration(0.250)
-{
-}
-
-QMacWindowFader *QMacWindowFader::currentFader()
-{
- return macwindowFader();
-}
-
-void QMacWindowFader::registerWindowToFade(QWidget *window)
-{
- m_windowsToFade.append(window);
-}
-
-void QMacWindowFader::performFade()
-{
- const QWidgetList myWidgetsToFade = m_windowsToFade;
- const int widgetCount = myWidgetsToFade.count();
- QMacCocoaAutoReleasePool pool;
- [NSAnimationContext beginGrouping];
- [[NSAnimationContext currentContext] setDuration:NSTimeInterval(m_duration)];
-
- for (int i = 0; i < widgetCount; ++i) {
- QWidget *widget = m_windowsToFade.at(i);
- OSWindowRef window = qt_mac_window_for(widget);
- [[window animator] setAlphaValue:0.0];
- QTimer::singleShot(qRound(m_duration * 1000), widget, SLOT(hide()));
- }
- [NSAnimationContext endGrouping];
- m_duration = 0.250;
- m_windowsToFade.clear();
-}
-
-extern bool qt_sendSpontaneousEvent(QObject *receiver, QEvent *event); // qapplication.cpp;
-extern QWidget * mac_mouse_grabber;
-extern QWidget *qt_button_down; //qapplication_mac.cpp
-extern QPointer<QWidget> qt_last_mouse_receiver;
-extern OSViewRef qt_mac_effectiveview_for(const QWidget *w);
-extern void qt_mac_updateCursorWithWidgetUnderMouse(QWidget *widgetUnderMouse); // qcursor_mac.mm
-
-void macWindowFade(void * /*OSWindowRef*/ window, float durationSeconds)
-{
- QMacCocoaAutoReleasePool pool;
- OSWindowRef wnd = static_cast<OSWindowRef>(window);
- if (wnd) {
- QWidget *widget;
- widget = [wnd QT_MANGLE_NAMESPACE(qt_qwidget)];
- if (widget) {
- QMacWindowFader::currentFader()->setFadeDuration(durationSeconds);
- QMacWindowFader::currentFader()->registerWindowToFade(widget);
- QMacWindowFader::currentFader()->performFade();
- }
- }
-}
-struct dndenum_mapper
-{
- NSDragOperation mac_code;
- Qt::DropAction qt_code;
- bool Qt2Mac;
-};
-
-#ifdef __OBJC__
-
-static dndenum_mapper dnd_enums[] = {
- { NSDragOperationLink, Qt::LinkAction, true },
- { NSDragOperationMove, Qt::MoveAction, true },
- { NSDragOperationCopy, Qt::CopyAction, true },
- { NSDragOperationGeneric, Qt::CopyAction, false },
- { NSDragOperationEvery, Qt::ActionMask, false },
- { NSDragOperationNone, Qt::IgnoreAction, false }
-};
-
-NSDragOperation qt_mac_mapDropAction(Qt::DropAction action)
-{
- for (int i=0; dnd_enums[i].qt_code; i++) {
- if (dnd_enums[i].Qt2Mac && (action & dnd_enums[i].qt_code)) {
- return dnd_enums[i].mac_code;
- }
- }
- return NSDragOperationNone;
-}
-
-NSDragOperation qt_mac_mapDropActions(Qt::DropActions actions)
-{
- NSDragOperation nsActions = NSDragOperationNone;
- for (int i=0; dnd_enums[i].qt_code; i++) {
- if (dnd_enums[i].Qt2Mac && (actions & dnd_enums[i].qt_code))
- nsActions |= dnd_enums[i].mac_code;
- }
- return nsActions;
-}
-
-Qt::DropAction qt_mac_mapNSDragOperation(NSDragOperation nsActions)
-{
- Qt::DropAction action = Qt::IgnoreAction;
- for (int i=0; dnd_enums[i].mac_code; i++) {
- if (nsActions & dnd_enums[i].mac_code)
- return dnd_enums[i].qt_code;
- }
- return action;
-}
-
-Qt::DropActions qt_mac_mapNSDragOperations(NSDragOperation nsActions)
-{
- Qt::DropActions actions = Qt::IgnoreAction;
- for (int i=0; dnd_enums[i].mac_code; i++) {
- if (nsActions & dnd_enums[i].mac_code)
- actions |= dnd_enums[i].qt_code;
- }
- return actions;
-}
-
-Q_GLOBAL_STATIC(DnDParams, currentDnDParameters);
-DnDParams *macCurrentDnDParameters()
-{
- return currentDnDParameters();
-}
-#endif
-
-void macWindowToolbarShow(const QWidget *widget, bool show )
-{
- OSWindowRef wnd = qt_mac_window_for(widget);
- if (NSToolbar *toolbar = [wnd toolbar]) {
- QMacCocoaAutoReleasePool pool;
- if (show != [toolbar isVisible]) {
- [toolbar setVisible:show];
- } else {
- // The toolbar may be in sync, but we are not, update our framestrut.
- qt_widget_private(const_cast<QWidget *>(widget))->updateFrameStrut();
- }
- }
-}
-
-
-void macWindowToolbarSet( void * /*OSWindowRef*/ window, void *toolbarRef )
-{
- OSWindowRef wnd = static_cast<OSWindowRef>(window);
- [wnd setToolbar:static_cast<NSToolbar *>(toolbarRef)];
-}
-
-bool macWindowToolbarIsVisible( void * /*OSWindowRef*/ window )
-{
- OSWindowRef wnd = static_cast<OSWindowRef>(window);
- if (NSToolbar *toolbar = [wnd toolbar])
- return [toolbar isVisible];
- return false;
-}
-
-void macWindowSetHasShadow( void * /*OSWindowRef*/ window, bool hasShadow )
-{
- OSWindowRef wnd = static_cast<OSWindowRef>(window);
- [wnd setHasShadow:BOOL(hasShadow)];
-}
-
-void macWindowFlush(void * /*OSWindowRef*/ window)
-{
- OSWindowRef wnd = static_cast<OSWindowRef>(window);
- [wnd flushWindowIfNeeded];
-}
-
-void qt_mac_update_mouseTracking(QWidget *widget)
-{
- [qt_mac_nativeview_for(widget) updateTrackingAreas];
-}
-
-OSStatus qt_mac_drawCGImage(CGContextRef inContext, const CGRect *inBounds, CGImageRef inImage)
-{
- // Verbatim copy if HIViewDrawCGImage (as shown on Carbon-Dev)
- OSStatus err = noErr;
-
- require_action(inContext != NULL, InvalidContext, err = paramErr);
- require_action(inBounds != NULL, InvalidBounds, err = paramErr);
- require_action(inImage != NULL, InvalidImage, err = paramErr);
-
- CGContextSaveGState( inContext );
- CGContextTranslateCTM (inContext, 0, inBounds->origin.y + CGRectGetMaxY(*inBounds));
- CGContextScaleCTM(inContext, 1, -1);
-
- CGContextDrawImage(inContext, *inBounds, inImage);
-
- CGContextRestoreGState(inContext);
-InvalidImage:
-InvalidBounds:
-InvalidContext:
- return err;
-}
-
-bool qt_mac_checkForNativeSizeGrip(const QWidget *widget)
-{
- return [[reinterpret_cast<NSView *>(widget->effectiveWinId()) window] showsResizeIndicator];
-}
-struct qt_mac_enum_mapper
-{
- int mac_code;
- int qt_code;
-#if defined(DEBUG_MOUSE_MAPS)
-# define QT_MAC_MAP_ENUM(x) x, #x
- const char *desc;
-#else
-# define QT_MAC_MAP_ENUM(x) x
-#endif
-};
-
-//mouse buttons
-static qt_mac_enum_mapper qt_mac_mouse_symbols[] = {
-{ kEventMouseButtonPrimary, QT_MAC_MAP_ENUM(Qt::LeftButton) },
-{ kEventMouseButtonSecondary, QT_MAC_MAP_ENUM(Qt::RightButton) },
-{ kEventMouseButtonTertiary, QT_MAC_MAP_ENUM(Qt::MidButton) },
-{ 4, QT_MAC_MAP_ENUM(Qt::XButton1) },
-{ 5, QT_MAC_MAP_ENUM(Qt::XButton2) },
-{ 0, QT_MAC_MAP_ENUM(0) }
-};
-Qt::MouseButtons qt_mac_get_buttons(int buttons)
-{
-#ifdef DEBUG_MOUSE_MAPS
- qDebug("Qt: internal: **Mapping buttons: %d (0x%04x)", buttons, buttons);
-#endif
- Qt::MouseButtons ret = Qt::NoButton;
- for(int i = 0; qt_mac_mouse_symbols[i].qt_code; i++) {
- if (buttons & (0x01<<(qt_mac_mouse_symbols[i].mac_code-1))) {
-#ifdef DEBUG_MOUSE_MAPS
- qDebug("Qt: internal: got button: %s", qt_mac_mouse_symbols[i].desc);
-#endif
- ret |= Qt::MouseButtons(qt_mac_mouse_symbols[i].qt_code);
- }
- }
- return ret;
-}
-Qt::MouseButton qt_mac_get_button(EventMouseButton button)
-{
-#ifdef DEBUG_MOUSE_MAPS
- qDebug("Qt: internal: **Mapping button: %d (0x%04x)", button, button);
-#endif
- Qt::MouseButtons ret = 0;
- for(int i = 0; qt_mac_mouse_symbols[i].qt_code; i++) {
- if (button == qt_mac_mouse_symbols[i].mac_code) {
-#ifdef DEBUG_MOUSE_MAPS
- qDebug("Qt: internal: got button: %s", qt_mac_mouse_symbols[i].desc);
-#endif
- return Qt::MouseButton(qt_mac_mouse_symbols[i].qt_code);
- }
- }
- return Qt::NoButton;
-}
-
-void macSendToolbarChangeEvent(QWidget *widget)
-{
- QToolBarChangeEvent ev(!(GetCurrentKeyModifiers() & cmdKey));
- qt_sendSpontaneousEvent(widget, &ev);
-}
-
-Q_GLOBAL_STATIC(QMacTabletHash, tablet_hash)
-QMacTabletHash *qt_mac_tablet_hash()
-{
- return tablet_hash();
-}
-
-
-// Clears the QWidget pointer that each QCocoaView holds.
-void qt_mac_clearCocoaViewQWidgetPointers(QWidget *widget)
-{
- QT_MANGLE_NAMESPACE(QCocoaView) *cocoaView = reinterpret_cast<QT_MANGLE_NAMESPACE(QCocoaView) *>(qt_mac_nativeview_for(widget));
- if (cocoaView && [cocoaView respondsToSelector:@selector(qt_qwidget)]) {
- [cocoaView qt_clearQWidget];
- }
-}
-
-void qt_dispatchTabletProximityEvent(void * /*NSEvent * */ tabletEvent)
-{
- NSEvent *proximityEvent = static_cast<NSEvent *>(tabletEvent);
- // simply construct a Carbon proximity record and handle it all in one spot.
- TabletProximityRec carbonProximityRec = { [proximityEvent vendorID],
- [proximityEvent tabletID],
- [proximityEvent pointingDeviceID],
- [proximityEvent deviceID],
- [proximityEvent systemTabletID],
- [proximityEvent vendorPointingDeviceType],
- [proximityEvent pointingDeviceSerialNumber],
- [proximityEvent uniqueID],
- [proximityEvent capabilityMask],
- [proximityEvent pointingDeviceType],
- [proximityEvent isEnteringProximity] };
- qt_dispatchTabletProximityEvent(carbonProximityRec);
-}
-
-void qt_dispatchTabletProximityEvent(const ::TabletProximityRec &proxRec)
-{
- QTabletDeviceData proximityDevice;
- proximityDevice.tabletUniqueID = proxRec.uniqueID;
- proximityDevice.capabilityMask = proxRec.capabilityMask;
-
- switch (proxRec.pointerType) {
- case NSUnknownPointingDevice:
- default:
- proximityDevice.tabletPointerType = QTabletEvent::UnknownPointer;
- break;
- case NSPenPointingDevice:
- proximityDevice.tabletPointerType = QTabletEvent::Pen;
- break;
- case NSCursorPointingDevice:
- proximityDevice.tabletPointerType = QTabletEvent::Cursor;
- break;
- case NSEraserPointingDevice:
- proximityDevice.tabletPointerType = QTabletEvent::Eraser;
- break;
- }
- uint bits = proxRec.vendorPointerType;
- if (bits == 0 && proximityDevice.tabletUniqueID != 0) {
- // Fallback. It seems that the driver doesn't always include all the information.
- // High-End Wacom devices store their "type" in the uper bits of the Unique ID.
- // I'm not sure how to handle it for consumer devices, but I'll test that in a bit.
- bits = proximityDevice.tabletUniqueID >> 32;
- }
- // Defined in the "EN0056-NxtGenImpGuideX"
- // on Wacom's Developer Website (www.wacomeng.com)
- if (((bits & 0x0006) == 0x0002) && ((bits & 0x0F06) != 0x0902)) {
- proximityDevice.tabletDeviceType = QTabletEvent::Stylus;
- } else {
- switch (bits & 0x0F06) {
- case 0x0802:
- proximityDevice.tabletDeviceType = QTabletEvent::Stylus;
- break;
- case 0x0902:
- proximityDevice.tabletDeviceType = QTabletEvent::Airbrush;
- break;
- case 0x0004:
- proximityDevice.tabletDeviceType = QTabletEvent::FourDMouse;
- break;
- case 0x0006:
- proximityDevice.tabletDeviceType = QTabletEvent::Puck;
- break;
- case 0x0804:
- proximityDevice.tabletDeviceType = QTabletEvent::RotationStylus;
- break;
- default:
- proximityDevice.tabletDeviceType = QTabletEvent::NoDevice;
- }
- }
- // The deviceID is "unique" while in the proximity, it's a key that we can use for
- // linking up TabletDeviceData to an event (especially if there are two devices in action).
- bool entering = proxRec.enterProximity;
- if (entering) {
- qt_mac_tablet_hash()->insert(proxRec.deviceID, proximityDevice);
- } else {
- qt_mac_tablet_hash()->remove(proxRec.deviceID);
- }
-
- QTabletEvent qtabletProximity(entering ? QEvent::TabletEnterProximity
- : QEvent::TabletLeaveProximity,
- QPoint(), QPoint(), QPointF(), proximityDevice.tabletDeviceType,
- proximityDevice.tabletPointerType, 0., 0, 0, 0., 0., 0, 0,
- proximityDevice.tabletUniqueID);
-
- qt_sendSpontaneousEvent(qApp, &qtabletProximity);
-}
-
-
-Qt::KeyboardModifiers qt_cocoaModifiers2QtModifiers(ulong modifierFlags)
-{
- Qt::KeyboardModifiers qtMods =Qt::NoModifier;
- if (modifierFlags & NSShiftKeyMask)
- qtMods |= Qt::ShiftModifier;
- if (modifierFlags & NSControlKeyMask)
- qtMods |= Qt::MetaModifier;
- if (modifierFlags & NSAlternateKeyMask)
- qtMods |= Qt::AltModifier;
- if (modifierFlags & NSCommandKeyMask)
- qtMods |= Qt::ControlModifier;
- if (modifierFlags & NSNumericPadKeyMask)
- qtMods |= Qt::KeypadModifier;
- return qtMods;
-}
-
-Qt::KeyboardModifiers qt_cocoaDragOperation2QtModifiers(uint dragOperations)
-{
- Qt::KeyboardModifiers qtMods =Qt::NoModifier;
- if (dragOperations & NSDragOperationLink)
- qtMods |= Qt::MetaModifier;
- if (dragOperations & NSDragOperationGeneric)
- qtMods |= Qt::ControlModifier;
- if (dragOperations & NSDragOperationCopy)
- qtMods |= Qt::AltModifier;
- return qtMods;
-}
-
-static inline QEvent::Type cocoaEvent2QtEvent(NSUInteger eventType)
-{
- // Handle the trivial cases that can be determined from the type.
- switch (eventType) {
- case NSKeyDown:
- return QEvent::KeyPress;
- case NSKeyUp:
- return QEvent::KeyRelease;
- case NSLeftMouseDown:
- case NSRightMouseDown:
- case NSOtherMouseDown:
- return QEvent::MouseButtonPress;
- case NSLeftMouseUp:
- case NSRightMouseUp:
- case NSOtherMouseUp:
- return QEvent::MouseButtonRelease;
- case NSMouseMoved:
- case NSLeftMouseDragged:
- case NSRightMouseDragged:
- case NSOtherMouseDragged:
- return QEvent::MouseMove;
- case NSScrollWheel:
- return QEvent::Wheel;
- }
- return QEvent::None;
-}
-
-static bool mustUseCocoaKeyEvent()
-{
- QCFType<TISInputSourceRef> source = TISCopyCurrentKeyboardInputSource();
- return TISGetInputSourceProperty(source, kTISPropertyUnicodeKeyLayoutData) == 0;
-}
-
-bool qt_dispatchKeyEventWithCocoa(void * /*NSEvent * */ keyEvent, QWidget *widgetToGetEvent)
-{
- NSEvent *event = static_cast<NSEvent *>(keyEvent);
- NSString *keyChars = [event charactersIgnoringModifiers];
- int keyLength = [keyChars length];
- if (keyLength == 0)
- return false; // Dead Key, nothing to do!
- bool ignoreText = false;
- Qt::Key qtKey = Qt::Key_unknown;
- if (keyLength == 1) {
- QChar ch([keyChars characterAtIndex:0]);
- if (ch.isLower())
- ch = ch.toUpper();
- qtKey = cocoaKey2QtKey(ch);
- // Do not set the text for Function-Key Unicodes characters (0xF700–0xF8FF).
- ignoreText = (ch.unicode() >= 0xF700 && ch.unicode() <= 0xF8FF);
- }
- Qt::KeyboardModifiers keyMods = qt_cocoaModifiers2QtModifiers([event modifierFlags]);
- QString text;
-
- // To quote from the Carbon port: This is actually wrong--but it is the best that
- // can be done for now because of the Control/Meta mapping issues
- // (we always get text on the Mac)
- if (!ignoreText && !(keyMods & (Qt::ControlModifier | Qt::MetaModifier)))
- text = QCFString::toQString(reinterpret_cast<CFStringRef>(keyChars));
-
- UInt32 macScanCode = 1;
- QKeyEventEx ke(cocoaEvent2QtEvent([event type]), qtKey, keyMods, text, [event isARepeat], qMax(1, keyLength),
- macScanCode, [event keyCode], [event modifierFlags]);
- return qt_sendSpontaneousEvent(widgetToGetEvent, &ke) && ke.isAccepted();
-}
-
-Qt::MouseButton cocoaButton2QtButton(NSInteger buttonNum)
-{
- if (buttonNum == 0)
- return Qt::LeftButton;
- if (buttonNum == 1)
- return Qt::RightButton;
- if (buttonNum == 2)
- return Qt::MidButton;
- if (buttonNum == 3)
- return Qt::XButton1;
- if (buttonNum == 4)
- return Qt::XButton2;
- return Qt::NoButton;
-}
-
-bool qt_dispatchKeyEvent(void * /*NSEvent * */ keyEvent, QWidget *widgetToGetEvent)
-{
- NSEvent *event = static_cast<NSEvent *>(keyEvent);
- EventRef key_event = static_cast<EventRef>(const_cast<void *>([event eventRef]));
- Q_ASSERT(key_event);
- unsigned int info = 0;
-
- if ([event type] == NSKeyDown) {
- NSString *characters = [event characters];
- if ([characters length]) {
- unichar value = [characters characterAtIndex:0];
- qt_keymapper_private()->updateKeyMap(0, key_event, (void *)&value);
- info = value;
- }
- }
-
- if (qt_mac_sendMacEventToWidget(widgetToGetEvent, key_event))
- return true;
-
- if (mustUseCocoaKeyEvent())
- return qt_dispatchKeyEventWithCocoa(keyEvent, widgetToGetEvent);
-
- bool consumed = qt_keymapper_private()->translateKeyEvent(widgetToGetEvent, 0, key_event, &info, true);
- return consumed && (info != 0);
-}
-
-void qt_dispatchModifiersChanged(void * /*NSEvent * */flagsChangedEvent, QWidget *widgetToGetEvent)
-{
- UInt32 modifiers = 0;
- // Sync modifiers with Qt
- NSEvent *event = static_cast<NSEvent *>(flagsChangedEvent);
- EventRef key_event = static_cast<EventRef>(const_cast<void *>([event eventRef]));
- Q_ASSERT(key_event);
- GetEventParameter(key_event, kEventParamKeyModifiers, typeUInt32, 0,
- sizeof(modifiers), 0, &modifiers);
- extern void qt_mac_send_modifiers_changed(quint32 modifiers, QObject *object);
- qt_mac_send_modifiers_changed(modifiers, widgetToGetEvent);
-}
-
-QPointF flipPoint(const NSPoint &p)
-{
- return QPointF(p.x, flipYCoordinate(p.y));
-}
-
-NSPoint flipPoint(const QPoint &p)
-{
- return NSMakePoint(p.x(), flipYCoordinate(p.y()));
-}
-
-NSPoint flipPoint(const QPointF &p)
-{
- return NSMakePoint(p.x(), flipYCoordinate(p.y()));
-}
-
-#ifdef __OBJC__
-
-void qt_mac_handleNonClientAreaMouseEvent(NSWindow *window, NSEvent *event)
-{
- QWidget *widgetToGetEvent = [window QT_MANGLE_NAMESPACE(qt_qwidget)];
- if (widgetToGetEvent == 0)
- return;
-
- NSEventType evtType = [event type];
- QPoint qlocalPoint;
- QPoint qglobalPoint;
- bool processThisEvent = false;
- bool fakeNCEvents = false;
- bool fakeMouseEvents = false;
-
- // Check if this is a mouse event.
- if (evtType == NSLeftMouseDown || evtType == NSLeftMouseUp
- || evtType == NSRightMouseDown || evtType == NSRightMouseUp
- || evtType == NSOtherMouseDown || evtType == NSOtherMouseUp
- || evtType == NSMouseMoved || evtType == NSLeftMouseDragged
- || evtType == NSRightMouseDragged || evtType == NSOtherMouseDragged) {
- // Check if we want to pass this message to another window
- if (mac_mouse_grabber && mac_mouse_grabber != widgetToGetEvent) {
- NSWindow *grabWindow = static_cast<NSWindow *>(qt_mac_window_for(mac_mouse_grabber));
- if (window != grabWindow) {
- window = grabWindow;
- widgetToGetEvent = mac_mouse_grabber;
- fakeNCEvents = true;
- }
- }
- // Dont generate normal NC mouse events for Left Button dragged
- if(evtType != NSLeftMouseDragged || fakeNCEvents) {
- NSPoint windowPoint = [event locationInWindow];
- NSPoint globalPoint = [[event window] convertBaseToScreen:windowPoint];
- NSRect frameRect = [window frame];
- if (fakeNCEvents || NSMouseInRect(globalPoint, frameRect, NO)) {
- NSRect contentRect = [window contentRectForFrameRect:frameRect];
- qglobalPoint = QPoint(flipPoint(globalPoint).toPoint());
- QWidget *w = widgetToGetEvent->childAt(widgetToGetEvent->mapFromGlobal(qglobalPoint));
- // check that the mouse pointer is on the non-client area and
- // there are not widgets in it.
- if (fakeNCEvents || (!NSMouseInRect(globalPoint, contentRect, NO) && !w)) {
- qglobalPoint = QPoint(flipPoint(globalPoint).toPoint());
- qlocalPoint = widgetToGetEvent->mapFromGlobal(qglobalPoint);
- processThisEvent = true;
- }
- }
- }
- }
- // This is not an NC area mouse message.
- if (!processThisEvent)
- return;
-
- // If the window is frame less, generate fake mouse events instead. (floating QToolBar)
- // or if someone already got an explicit or implicit grab
- if (mac_mouse_grabber || qt_button_down ||
- (fakeNCEvents && (widgetToGetEvent->window()->windowFlags() & Qt::FramelessWindowHint)))
- fakeMouseEvents = true;
-
- Qt::MouseButton button;
- QEvent::Type eventType;
- // Convert to Qt::Event type
- switch (evtType) {
- case NSLeftMouseDown:
- button = Qt::LeftButton;
- eventType = (!fakeMouseEvents) ? QEvent::NonClientAreaMouseButtonPress
- : QEvent::MouseButtonPress;
- break;
- case NSLeftMouseUp:
- button = Qt::LeftButton;
- eventType = (!fakeMouseEvents) ? QEvent::NonClientAreaMouseButtonRelease
- : QEvent::MouseButtonRelease;
- break;
- case NSRightMouseDown:
- button = Qt::RightButton;
- eventType = (!fakeMouseEvents) ? QEvent::NonClientAreaMouseButtonPress
- : QEvent::MouseButtonPress;
- break;
- case NSRightMouseUp:
- button = Qt::RightButton;
- eventType = (!fakeMouseEvents) ? QEvent::NonClientAreaMouseButtonRelease
- : QEvent::MouseButtonRelease;
- break;
- case NSOtherMouseDown:
- button = cocoaButton2QtButton([event buttonNumber]);
- eventType = (!fakeMouseEvents) ? QEvent::NonClientAreaMouseButtonPress
- : QEvent::MouseButtonPress;
- break;
- case NSOtherMouseUp:
- button = cocoaButton2QtButton([event buttonNumber]);
- eventType = (!fakeMouseEvents) ? QEvent::NonClientAreaMouseButtonRelease
- : QEvent::MouseButtonRelease;
- break;
- case NSMouseMoved:
- button = Qt::NoButton;
- eventType = (!fakeMouseEvents) ? QEvent::NonClientAreaMouseMove
- : QEvent::MouseMove;
- break;
- case NSLeftMouseDragged:
- button = Qt::LeftButton;
- eventType = (!fakeMouseEvents) ? QEvent::NonClientAreaMouseMove
- : QEvent::MouseMove;
- break;
- case NSRightMouseDragged:
- button = Qt::RightButton;
- eventType = (!fakeMouseEvents) ? QEvent::NonClientAreaMouseMove
- : QEvent::MouseMove;
- break;
- case NSOtherMouseDragged:
- button = cocoaButton2QtButton([event buttonNumber]);
- eventType = (!fakeMouseEvents) ? QEvent::NonClientAreaMouseMove
- : QEvent::MouseMove;
- break;
- default:
- qWarning("not handled! Non client area mouse message");
- return;
- }
-
- Qt::KeyboardModifiers keyMods = qt_cocoaModifiers2QtModifiers([event modifierFlags]);
- if (eventType == QEvent::NonClientAreaMouseButtonPress || eventType == QEvent::MouseButtonPress) {
- NSInteger clickCount = [event clickCount];
- if (clickCount % 2 == 0)
- eventType = (!fakeMouseEvents) ? QEvent::NonClientAreaMouseButtonDblClick
- : QEvent::MouseButtonDblClick;
- if (button == Qt::LeftButton && (keyMods & Qt::MetaModifier)) {
- button = Qt::RightButton;
- qt_leftButtonIsRightButton = true;
- }
- } else if (eventType == QEvent::NonClientAreaMouseButtonRelease || eventType == QEvent::MouseButtonRelease) {
- if (button == Qt::LeftButton && qt_leftButtonIsRightButton) {
- button = Qt::RightButton;
- qt_leftButtonIsRightButton = false;
- }
- }
-
- Qt::MouseButtons buttons = 0;
- {
- UInt32 mac_buttons;
- if (GetEventParameter((EventRef)[event eventRef], kEventParamMouseChord, typeUInt32, 0,
- sizeof(mac_buttons), 0, &mac_buttons) == noErr)
- buttons = qt_mac_get_buttons(mac_buttons);
- }
-
- QMouseEvent qme(eventType, qlocalPoint, qglobalPoint, button, buttons, keyMods);
- qt_sendSpontaneousEvent(widgetToGetEvent, &qme);
-
- // We don't need to set the implicit grab widget here because we won't
- // reach this point if then event type is Press over a Qt widget.
- // However we might need to unset it if the event is Release.
- if (eventType == QEvent::MouseButtonRelease)
- qt_button_down = 0;
-}
-
-QWidget *qt_mac_getTargetForKeyEvent(QWidget *widgetThatReceivedEvent)
-{
- if (QWidget *popup = QApplication::activePopupWidget()) {
- QWidget *focusInPopup = popup->focusWidget();
- return focusInPopup ? focusInPopup : popup;
- }
-
- QWidget *widgetToGetKey = qApp->focusWidget();
- if (!widgetToGetKey)
- widgetToGetKey = widgetThatReceivedEvent;
-
- return widgetToGetKey;
-}
-
-// This function will find the widget that should receive the
-// mouse event. Because of explicit/implicit mouse grabs, popups,
-// etc, this might not end up being the same as the widget under
-// the mouse (which is more interresting when handling enter/leave
-// events
-QWidget *qt_mac_getTargetForMouseEvent(
- // You can call this function without providing an event.
- NSEvent *event,
- QEvent::Type eventType,
- QPoint &returnLocalPoint,
- QPoint &returnGlobalPoint,
- QWidget *nativeWidget,
- QWidget **returnWidgetUnderMouse)
-{
- Q_UNUSED(event);
- NSPoint nsglobalpoint = event ? [[event window] convertBaseToScreen:[event locationInWindow]] : [NSEvent mouseLocation];
- returnGlobalPoint = flipPoint(nsglobalpoint).toPoint();
- QWidget *mouseGrabber = QWidget::mouseGrabber();
- bool buttonDownNotBlockedByModal = qt_button_down && !QApplicationPrivate::isBlockedByModal(qt_button_down);
- QWidget *popup = QApplication::activePopupWidget();
-
- // Resolve the widget under the mouse:
- QWidget *widgetUnderMouse = 0;
- if (popup || qt_button_down || !nativeWidget || !nativeWidget->isVisible()) {
- // Using QApplication::widgetAt for finding the widget under the mouse
- // is most safe, since it ignores cocoas own mouse down redirections (which
- // we need to be prepared for when using nativeWidget as starting point).
- // (the only exception is for QMacNativeWidget, where QApplication::widgetAt fails).
- // But it is also slower (I guess), so we try to avoid it and use nativeWidget if we can:
- widgetUnderMouse = QApplication::widgetAt(returnGlobalPoint);
- }
-
- if (!widgetUnderMouse && nativeWidget) {
- // Entering here should be the common case. We
- // also handle the QMacNativeWidget fallback case.
- QPoint p = nativeWidget->mapFromGlobal(returnGlobalPoint);
- widgetUnderMouse = nativeWidget->childAt(p);
- if (!widgetUnderMouse && nativeWidget->rect().contains(p))
- widgetUnderMouse = nativeWidget;
- }
-
- if (widgetUnderMouse) {
- // Check if widgetUnderMouse is blocked by a modal
- // window, or the mouse if over the frame strut:
- if (widgetUnderMouse == qt_button_down) {
- // Small optimization to avoid an extra call to isBlockedByModal:
- if (buttonDownNotBlockedByModal == false)
- widgetUnderMouse = 0;
- } else if (QApplicationPrivate::isBlockedByModal(widgetUnderMouse)) {
- widgetUnderMouse = 0;
- }
-
- if (widgetUnderMouse && widgetUnderMouse->isWindow()) {
- // Exclude the titlebar (and frame strut) when finding widget under mouse:
- QPoint p = widgetUnderMouse->mapFromGlobal(returnGlobalPoint);
- if (!widgetUnderMouse->rect().contains(p))
- widgetUnderMouse = 0;
- }
- }
- if (returnWidgetUnderMouse)
- *returnWidgetUnderMouse = widgetUnderMouse;
-
- // Resolve the target for the mouse event. Default will be
- // widgetUnderMouse, except if there is a grab (popup/mouse/button-down):
- if (popup && !mouseGrabber) {
- // We special case handling of popups, since they have an implicitt mouse grab.
- QWidget *candidate = buttonDownNotBlockedByModal ? qt_button_down : widgetUnderMouse;
- if (!popup->isAncestorOf(candidate)) {
- // INVARIANT: we have a popup, but the candidate is not
- // in it. But the popup will grab the mouse anyway,
- // except if the user scrolls:
- if (eventType == QEvent::Wheel)
- return 0;
- returnLocalPoint = popup->mapFromGlobal(returnGlobalPoint);
- return popup;
- } else if (popup == candidate) {
- // INVARIANT: The candidate is the popup itself, and not a child:
- returnLocalPoint = popup->mapFromGlobal(returnGlobalPoint);
- return popup;
- } else {
- // INVARIANT: The candidate is a child inside the popup:
- returnLocalPoint = candidate->mapFromGlobal(returnGlobalPoint);
- return candidate;
- }
- }
-
- QWidget *target = mouseGrabber;
- if (!target && buttonDownNotBlockedByModal)
- target = qt_button_down;
- if (!target)
- target = widgetUnderMouse;
- if (!target)
- return 0;
-
- returnLocalPoint = target->mapFromGlobal(returnGlobalPoint);
- return target;
-}
-
-QPointer<QWidget> qt_last_native_mouse_receiver = 0;
-
-static inline void qt_mac_checkEnterLeaveForNativeWidgets(QWidget *maybeEnterWidget)
-{
- // Dispatch enter/leave for the cases where QApplicationPrivate::sendMouseEvent do
- // not. This will in general be the cases when alien widgets are not involved:
- // 1. from a native widget to another native widget or
- // 2. from a native widget to no widget
- // 3. from no widget to a native or alien widget
-
- if (qt_button_down || QWidget::mouseGrabber())
- return;
-
- if ((maybeEnterWidget == qt_last_native_mouse_receiver) && qt_last_native_mouse_receiver)
- return;
- if (maybeEnterWidget) {
- if (!qt_last_native_mouse_receiver) {
- // case 3
- QApplicationPrivate::dispatchEnterLeave(maybeEnterWidget, 0);
- qt_last_native_mouse_receiver = maybeEnterWidget->internalWinId() ? maybeEnterWidget : maybeEnterWidget->nativeParentWidget();
- } else if (maybeEnterWidget->internalWinId()) {
- // case 1
- QApplicationPrivate::dispatchEnterLeave(maybeEnterWidget, qt_last_native_mouse_receiver);
- qt_last_native_mouse_receiver = maybeEnterWidget->internalWinId() ? maybeEnterWidget : maybeEnterWidget->nativeParentWidget();
- } // else at lest one of the widgets are alien, so enter/leave will be handled in QApplicationPrivate
- } else {
- if (qt_last_native_mouse_receiver) {
- // case 2
- QApplicationPrivate::dispatchEnterLeave(0, qt_last_native_mouse_receiver);
- qt_last_mouse_receiver = 0;
- qt_last_native_mouse_receiver = 0;
- }
- }
-}
-
-bool qt_mac_handleMouseEvent(NSEvent *event, QEvent::Type eventType, Qt::MouseButton button, QWidget *nativeWidget)
-{
- // Give the Input Manager a chance to process the mouse events.
- NSInputManager *currentIManager = [NSInputManager currentInputManager];
- if (currentIManager && [currentIManager wantsToHandleMouseEvents]) {
- [currentIManager handleMouseEvent:event];
- }
-
- // Find the widget that should receive the event, and the widget under the mouse. Those
- // can differ if an implicit or explicit mouse grab is active:
- QWidget *widgetUnderMouse = 0;
- QPoint localPoint, globalPoint;
- QWidget *widgetToGetMouse = qt_mac_getTargetForMouseEvent(event, eventType, localPoint, globalPoint, nativeWidget, &widgetUnderMouse);
- if (!widgetToGetMouse)
- return false;
-
- // From here on, we let nativeWidget actually be the native widget under widgetUnderMouse. The reason
- // for this, is that qt_mac_getTargetForMouseEvent will set cocoa's mouse event redirection aside when
- // determining which widget is under the mouse (in other words, it will usually ignore nativeWidget).
- // nativeWidget will be used in QApplicationPrivate::sendMouseEvent to correctly dispatch enter/leave events.
- if (widgetUnderMouse)
- nativeWidget = widgetUnderMouse->internalWinId() ? widgetUnderMouse : widgetUnderMouse->nativeParentWidget();
- if (!nativeWidget)
- return false;
- NSView *view = qt_mac_effectiveview_for(nativeWidget);
-
- // Handle tablet events (if any) first.
- if (qt_mac_handleTabletEvent(view, event)) {
- // Tablet event was handled. In Qt we aren't supposed to send the mouse event.
- return true;
- }
-
- EventRef carbonEvent = static_cast<EventRef>(const_cast<void *>([event eventRef]));
- if (qt_mac_sendMacEventToWidget(widgetToGetMouse, carbonEvent))
- return true;
-
- // Keep previousButton to make sure we don't send double click
- // events when the user double clicks using two different buttons:
- static Qt::MouseButton previousButton = Qt::NoButton;
-
- Qt::KeyboardModifiers keyMods = qt_cocoaModifiers2QtModifiers([event modifierFlags]);
- NSInteger clickCount = [event clickCount];
- Qt::MouseButtons buttons = 0;
- {
- UInt32 mac_buttons;
- if (GetEventParameter(carbonEvent, kEventParamMouseChord, typeUInt32, 0,
- sizeof(mac_buttons), 0, &mac_buttons) == noErr)
- buttons = qt_mac_get_buttons(mac_buttons);
- }
-
- // Send enter/leave events for the cases when QApplicationPrivate::sendMouseEvent do not:
- qt_mac_checkEnterLeaveForNativeWidgets(widgetUnderMouse);
-
- switch (eventType) {
- default:
- qWarning("not handled! %d", eventType);
- break;
- case QEvent::MouseMove:
- if (button == Qt::LeftButton && qt_leftButtonIsRightButton)
- button = Qt::RightButton;
- break;
- case QEvent::MouseButtonPress:
- qt_button_down = widgetUnderMouse;
- if (clickCount % 2 == 0 && (previousButton == Qt::NoButton || previousButton == button))
- eventType = QEvent::MouseButtonDblClick;
- if (button == Qt::LeftButton && (keyMods & Qt::MetaModifier)) {
- button = Qt::RightButton;
- qt_leftButtonIsRightButton = true;
- }
- break;
- case QEvent::MouseButtonRelease:
- if (button == Qt::LeftButton && qt_leftButtonIsRightButton) {
- button = Qt::RightButton;
- qt_leftButtonIsRightButton = false;
- }
- qt_button_down = 0;
- break;
- }
-
- qt_mac_updateCursorWithWidgetUnderMouse(widgetUnderMouse);
-
- DnDParams *dndParams = currentDnDParameters();
- dndParams->view = view;
- dndParams->theEvent = event;
- dndParams->globalPoint = globalPoint;
-
- // Send the mouse event:
- QMouseEvent qme(eventType, localPoint, globalPoint, button, buttons, keyMods);
- QApplicationPrivate::sendMouseEvent(
- widgetToGetMouse, &qme, widgetUnderMouse, nativeWidget,
- &qt_button_down, qt_last_mouse_receiver, true);
-
- if (eventType == QEvent::MouseButtonPress && button == Qt::RightButton) {
- QContextMenuEvent qcme(QContextMenuEvent::Mouse, localPoint, globalPoint, keyMods);
- qt_sendSpontaneousEvent(widgetToGetMouse, &qcme);
- }
-
- if (eventType == QEvent::MouseButtonRelease) {
- // A mouse button was released, which means that the implicit grab was
- // released. We therefore need to re-check if should send (delayed) enter leave events:
- // qt_button_down has now become NULL since the call at the top of the function. Also, since
- // the relase might have closed a window, we dont give the nativeWidget hint
- qt_mac_getTargetForMouseEvent(0, QEvent::None, localPoint, globalPoint, nativeWidget, &widgetUnderMouse);
- qt_mac_checkEnterLeaveForNativeWidgets(widgetUnderMouse);
- }
-
- previousButton = button;
- return true;
-}
-#endif
-
-bool qt_mac_handleTabletEvent(void * /*QCocoaView * */view, void * /*NSEvent * */tabletEvent)
-{
- QT_MANGLE_NAMESPACE(QCocoaView) *theView = static_cast<QT_MANGLE_NAMESPACE(QCocoaView) *>(view);
- NSView *theNSView = static_cast<NSView *>(view);
- NSEvent *theTabletEvent = static_cast<NSEvent *>(tabletEvent);
-
- NSEventType eventType = [theTabletEvent type];
- if (eventType != NSTabletPoint && [theTabletEvent subtype] != NSTabletPointEventSubtype)
- return false; // Not a tablet event.
-
- NSPoint windowPoint = [theTabletEvent locationInWindow];
- NSPoint globalPoint = [[theTabletEvent window] convertBaseToScreen:windowPoint];
-
- QWidget *qwidget = [theView qt_qwidget];
- QWidget *widgetToGetMouse = qwidget;
- QWidget *popup = qAppInstance()->activePopupWidget();
- if (popup && popup != qwidget->window())
- widgetToGetMouse = popup;
-
- if (qt_mac_sendMacEventToWidget(widgetToGetMouse,
- static_cast<EventRef>(const_cast<void *>([theTabletEvent eventRef]))))
- return true;
- if (widgetToGetMouse != qwidget) {
- theNSView = qt_mac_nativeview_for(widgetToGetMouse);
- windowPoint = [[theNSView window] convertScreenToBase:globalPoint];
- }
- NSPoint localPoint = [theNSView convertPoint:windowPoint fromView:nil];
- // Tablet events do not handle WA_TransparentForMouseEvents ATM
- // In theory, people who set the WA_TransparentForMouseEvents attribute won't handle
- // tablet events either in which case they will fall into the mouse event case and get
- // them passed on. This will NOT handle the raw events, but that might not be a big problem.
-
- const QMacTabletHash *tabletHash = qt_mac_tablet_hash();
- if (!tabletHash->contains([theTabletEvent deviceID])) {
- qWarning("QCocoaView handleTabletEvent: This tablet device is unknown"
- " (received no proximity event for it). Discarding event.");
- return false;
- }
- const QTabletDeviceData &deviceData = tabletHash->value([theTabletEvent deviceID]);
-
-
- QEvent::Type qType;
- switch (eventType) {
- case NSLeftMouseDown:
- case NSRightMouseDown:
- qType = QEvent::TabletPress;
- break;
- case NSLeftMouseUp:
- case NSRightMouseUp:
- qType = QEvent::TabletRelease;
- break;
- case NSMouseMoved:
- case NSTabletPoint:
- case NSLeftMouseDragged:
- case NSRightMouseDragged:
- default:
- qType = QEvent::TabletMove;
- break;
- }
-
- qreal pressure;
- if (eventType != NSMouseMoved) {
- pressure = [theTabletEvent pressure];
- } else {
- pressure = 0.0;
- }
-
- NSPoint tilt = [theTabletEvent tilt];
- int xTilt = qRound(tilt.x * 60.0);
- int yTilt = qRound(tilt.y * -60.0);
- qreal tangentialPressure = 0;
- qreal rotation = 0;
- int z = 0;
- if (deviceData.capabilityMask & 0x0200)
- z = [theTabletEvent absoluteZ];
-
- if (deviceData.capabilityMask & 0x0800)
- tangentialPressure = [theTabletEvent tangentialPressure];
-
- rotation = [theTabletEvent rotation];
- QPointF hiRes = flipPoint(globalPoint);
- QTabletEvent qtabletEvent(qType, QPoint(localPoint.x, localPoint.y),
- hiRes.toPoint(), hiRes,
- deviceData.tabletDeviceType, deviceData.tabletPointerType,
- pressure, xTilt, yTilt, tangentialPressure, rotation, z,
- qt_cocoaModifiers2QtModifiers([theTabletEvent modifierFlags]),
- deviceData.tabletUniqueID);
-
- qt_sendSpontaneousEvent(widgetToGetMouse, &qtabletEvent);
- return qtabletEvent.isAccepted();
-}
-
-void qt_mac_updateContentBorderMetricts(void * /*OSWindowRef */window, const ::HIContentBorderMetrics &metrics)
-{
- OSWindowRef theWindow = static_cast<OSWindowRef>(window);
- if ([theWindow styleMask] & NSTexturedBackgroundWindowMask)
- [theWindow setContentBorderThickness:metrics.top forEdge:NSMaxYEdge];
- [theWindow setContentBorderThickness:metrics.bottom forEdge:NSMinYEdge];
-}
-
-void qt_mac_replaceDrawRect(void * /*OSWindowRef */window, QWidgetPrivate *widget)
-{
- QMacCocoaAutoReleasePool pool;
- OSWindowRef theWindow = static_cast<OSWindowRef>(window);
- if(!theWindow)
- return;
- id theClass = [[[theWindow contentView] superview] class];
- // What we do here is basically to add a new selector to NSThemeFrame called
- // "drawRectOriginal:" which will contain the original implementation of
- // "drawRect:". After that we get the new implementation from QCocoaWindow
- // and exchange them. The new implementation is called drawRectSpecial.
- // We cannot just add the method because it might have been added before and since
- // we cannot remove a method once it has been added we need to ask QCocoaWindow if
- // we did the swap or not.
- if(!widget->drawRectOriginalAdded) {
- Method m2 = class_getInstanceMethod(theClass, @selector(drawRect:));
- if(!m2) {
- // This case is pretty extreme, no drawRect means no drawing!
- return;
- }
- class_addMethod(theClass, @selector(drawRectOriginal:), method_getImplementation(m2), method_getTypeEncoding(m2));
- widget->drawRectOriginalAdded = true;
- }
- if(widget->originalDrawMethod) {
- Method m0 = class_getInstanceMethod([theWindow class], @selector(drawRectSpecial:));
- if(!m0) {
- // Ok, this means the methods were never swapped. Just ignore
- return;
- }
- Method m1 = class_getInstanceMethod(theClass, @selector(drawRect:));
- if(!m1) {
- // Ok, this means the methods were never swapped. Just ignore
- return;
- }
- // We have the original method here. Proceed and swap the methods.
- method_exchangeImplementations(m1, m0);
- widget->originalDrawMethod = false;
- [theWindow display];
- }
-}
-
-void qt_mac_replaceDrawRectOriginal(void * /*OSWindowRef */window, QWidgetPrivate *widget)
-{
- QMacCocoaAutoReleasePool pool;
- OSWindowRef theWindow = static_cast<OSWindowRef>(window);
- id theClass = [[[theWindow contentView] superview] class];
- // Now we need to revert the methods to their original state.
- // We cannot remove the method, so we just keep track of it in QCocoaWindow.
- Method m0 = class_getInstanceMethod([theWindow class], @selector(drawRectSpecial:));
- if(!m0) {
- // Ok, this means the methods were never swapped. Just ignore
- return;
- }
- Method m1 = class_getInstanceMethod(theClass, @selector(drawRect:));
- if(!m1) {
- // Ok, this means the methods were never swapped. Just ignore
- return;
- }
- method_exchangeImplementations(m1, m0);
- widget->originalDrawMethod = true;
- [theWindow display];
-}
-
-void qt_mac_showBaseLineSeparator(void * /*OSWindowRef */window, bool show)
-{
- if(!window)
- return;
- QMacCocoaAutoReleasePool pool;
- OSWindowRef theWindow = static_cast<OSWindowRef>(window);
- NSToolbar *macToolbar = [theWindow toolbar];
- [macToolbar setShowsBaselineSeparator:show];
-}
-
-QStringList qt_mac_NSArrayToQStringList(void *nsarray)
-{
- QStringList result;
- NSArray *array = static_cast<NSArray *>(nsarray);
- for (NSUInteger i=0; i<[array count]; ++i)
- result << qt_mac_NSStringToQString([array objectAtIndex:i]);
- return result;
-}
-
-void *qt_mac_QStringListToNSMutableArrayVoid(const QStringList &list)
-{
- NSMutableArray *result = [NSMutableArray arrayWithCapacity:list.size()];
- for (int i=0; i<list.size(); ++i){
- [result addObject:reinterpret_cast<const NSString *>(QCFString::toCFStringRef(list[i]))];
- }
- return result;
-}
-
-void qt_syncCocoaTitleBarButtons(OSWindowRef window, QWidget *widgetForWindow)
-{
- if (!widgetForWindow)
- return;
-
- Qt::WindowFlags flags = widgetForWindow->windowFlags();
- bool customize = flags & Qt::CustomizeWindowHint;
-
- NSButton *btn = [window standardWindowButton:NSWindowZoomButton];
- // BOOL is not an int, so the bitwise AND doesn't work.
- bool go = uint(customize && !(flags & Qt::WindowMaximizeButtonHint)) == 0;
- [btn setEnabled:go];
-
- btn = [window standardWindowButton:NSWindowMiniaturizeButton];
- go = uint(customize && !(flags & Qt::WindowMinimizeButtonHint)) == 0;
- [btn setEnabled:go];
-
- btn = [window standardWindowButton:NSWindowCloseButton];
- go = uint(customize && !(flags & Qt::WindowSystemMenuHint
- || flags & Qt::WindowCloseButtonHint)) == 0;
- [btn setEnabled:go];
-
- [window setShowsToolbarButton:uint(flags & Qt::MacWindowToolBarButtonHint) != 0];
-}
-
-// Carbon: Make sure you call QDEndContext on the context when done with it.
-CGContextRef qt_mac_graphicsContextFor(QWidget *widget)
-{
- if (!widget)
- return 0;
-
- CGContextRef context = (CGContextRef)[[NSGraphicsContext graphicsContextWithWindow:qt_mac_window_for(widget)] graphicsPort];
- return context;
-}
-
-void qt_mac_dispatchPendingUpdateRequests(QWidget *widget)
-{
- if (!widget)
- return;
- [qt_mac_nativeview_for(widget) displayIfNeeded];
-}
-
-CGFloat qt_mac_get_scalefactor()
-{
- return [[NSScreen mainScreen] userSpaceScaleFactor];
-}
-
-QString qt_mac_get_pasteboardString(OSPasteboardRef paste)
-{
- QMacCocoaAutoReleasePool pool;
- NSPasteboard *pb = nil;
- CFStringRef pbname;
- if (PasteboardCopyName(paste, &pbname) == noErr) {
- pb = [NSPasteboard pasteboardWithName:const_cast<NSString *>(reinterpret_cast<const NSString *>(pbname))];
- CFRelease(pbname);
- } else {
- pb = [NSPasteboard generalPasteboard];
- }
- if (pb) {
- NSString *text = [pb stringForType:NSStringPboardType];
- if (text)
- return qt_mac_NSStringToQString(text);
- }
- return QString();
-}
-
-QPixmap qt_mac_convert_iconref(const IconRef icon, int width, int height)
-{
- QPixmap ret(width, height);
- ret.fill(QColor(0, 0, 0, 0));
-
- CGRect rect = CGRectMake(0, 0, width, height);
-
- CGContextRef ctx = qt_mac_cg_context(&ret);
- CGAffineTransform old_xform = CGContextGetCTM(ctx);
- CGContextConcatCTM(ctx, CGAffineTransformInvert(old_xform));
- CGContextConcatCTM(ctx, CGAffineTransformIdentity);
-
- ::RGBColor b;
- b.blue = b.green = b.red = 255*255;
- PlotIconRefInContext(ctx, &rect, kAlignNone, kTransformNone, &b, kPlotIconRefNormalFlags, icon);
- CGContextRelease(ctx);
- return ret;
-}
-
-void qt_mac_constructQIconFromIconRef(const IconRef icon, const IconRef overlayIcon, QIcon *retIcon, QStyle::StandardPixmap standardIcon)
-{
- int size = 16;
- while (size <= 128) {
-
- const QString cacheKey = QLatin1String("qt_mac_constructQIconFromIconRef") + QString::number(standardIcon) + QString::number(size);
- QPixmap mainIcon;
- if (standardIcon >= QStyle::SP_CustomBase) {
- mainIcon = qt_mac_convert_iconref(icon, size, size);
- } else if (QPixmapCache::find(cacheKey, mainIcon) == false) {
- mainIcon = qt_mac_convert_iconref(icon, size, size);
- QPixmapCache::insert(cacheKey, mainIcon);
- }
-
- if (overlayIcon) {
- int littleSize = size / 2;
- QPixmap overlayPix = qt_mac_convert_iconref(overlayIcon, littleSize, littleSize);
- QPainter painter(&mainIcon);
- painter.drawPixmap(size - littleSize, size - littleSize, overlayPix);
- }
-
- retIcon->addPixmap(mainIcon);
- size += size; // 16 -> 32 -> 64 -> 128
- }
-}
-
-void qt_mac_post_retranslateAppMenu()
-{
- QMacCocoaAutoReleasePool pool;
- qt_cocoaPostMessage([NSApp QT_MANGLE_NAMESPACE(qt_qcocoamenuLoader)], @selector(qtTranslateApplicationMenu));
-}
-
-QWidgetPrivate *QMacScrollOptimization::_target = 0;
-bool QMacScrollOptimization::_inWheelEvent = false;
-int QMacScrollOptimization::_dx = 0;
-int QMacScrollOptimization::_dy = 0;
-QRect QMacScrollOptimization::_scrollRect = QRect(0, 0, -1, -1);
-
-// This method implements the magic for the drawRectSpecial method.
-// We draw a line at the upper edge of the content view in order to
-// override the title baseline.
-void macDrawRectOnTop(void * /*OSWindowRef */window)
-{
- OSWindowRef theWindow = static_cast<OSWindowRef>(window);
- NSView *contentView = [theWindow contentView];
- if(!contentView)
- return;
- // Get coordinates of the content view
- NSRect contentRect = [contentView frame];
- // Draw a line on top of the already drawn line.
- // We need to check if we are active or not to use the proper color.
- if([theWindow isKeyWindow] || [theWindow isMainWindow]) {
- [[NSColor colorWithCalibratedRed:1.0 green:1.0 blue:1.0 alpha:1.0] set];
- } else {
- [[NSColor colorWithCalibratedRed:1.0 green:1.0 blue:1.0 alpha:1.0] set];
- }
- NSPoint origin = NSMakePoint(0, contentRect.size.height);
- NSPoint end = NSMakePoint(contentRect.size.width, contentRect.size.height);
- [NSBezierPath strokeLineFromPoint:origin toPoint:end];
-}
-
-// This method will (or at least should) get called only once.
-// Its mission is to find out if we are active or not. If we are active
-// we assume that we were launched via finder, otherwise we assume
-// we were called from the command line. The distinction is important,
-// since in the first case we don't need to trigger a paintEvent, while
-// in the second case we do.
-void macSyncDrawingOnFirstInvocation(void * /*OSWindowRef */window)
-{
- OSWindowRef theWindow = static_cast<OSWindowRef>(window);
- NSApplication *application = [NSApplication sharedApplication];
- NSToolbar *toolbar = [theWindow toolbar];
- if([application isActive]) {
- // Launched from finder
- [toolbar setShowsBaselineSeparator:NO];
- } else {
- // Launched from commandline
- [toolbar setVisible:false];
- [toolbar setShowsBaselineSeparator:NO];
- [toolbar setVisible:true];
- [theWindow display];
- }
-}
-
-void qt_cocoaStackChildWindowOnTopOfOtherChildren(QWidget *childWidget)
-{
- if (!childWidget)
- return;
-
- QWidget *parent = childWidget->parentWidget();
- if (childWidget->isWindow() && parent) {
- if ([[qt_mac_window_for(parent) childWindows] containsObject:qt_mac_window_for(childWidget)]) {
- QWidgetPrivate *d = qt_widget_private(childWidget);
- d->setSubWindowStacking(false);
- d->setSubWindowStacking(true);
- }
- }
-}
-
-void qt_mac_display(QWidget *widget)
-{
- NSView *theNSView = qt_mac_nativeview_for(widget);
- [theNSView display];
-}
-
-void qt_mac_setNeedsDisplay(QWidget *widget)
-{
- NSView *theNSView = qt_mac_nativeview_for(widget);
- [theNSView setNeedsDisplay:YES];
-}
-
-void qt_mac_setNeedsDisplayInRect(QWidget *widget, QRegion region)
-{
- NSView *theNSView = qt_mac_nativeview_for(widget);
- if (region.isEmpty()) {
- [theNSView setNeedsDisplay:YES];
- return;
- }
-
- QVector<QRect> rects = region.rects();
- for (int i = 0; i < rects.count(); ++i) {
- const QRect &rect = rects.at(i);
- NSRect nsrect = NSMakeRect(rect.x(), rect.y(), rect.width(), rect.height());
- [theNSView setNeedsDisplayInRect:nsrect];
- }
-
-}
-
-
-QT_END_NAMESPACE
diff --git a/src/widgets/platforms/mac/qt_cocoa_helpers_mac_p.h b/src/widgets/platforms/mac/qt_cocoa_helpers_mac_p.h
deleted file mode 100644
index bae479ec6a..0000000000
--- a/src/widgets/platforms/mac/qt_cocoa_helpers_mac_p.h
+++ /dev/null
@@ -1,308 +0,0 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
-
-/****************************************************************************
-**
-** Copyright (c) 2007-2008, Apple, Inc.
-**
-** All rights reserved.
-**
-** Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are met:
-**
-** * Redistributions of source code must retain the above copyright notice,
-** this list of conditions and the following disclaimer.
-**
-** * Redistributions in binary form must reproduce the above copyright notice,
-** this list of conditions and the following disclaimer in the documentation
-** and/or other materials provided with the distribution.
-**
-** * Neither the name of Apple, Inc. nor the names of its contributors
-** may be used to endorse or promote products derived from this software
-** without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-** CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-** EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-** PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-** PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-** LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-** NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-** SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-**
-****************************************************************************/
-
-#ifndef QT_COCOA_HELPERS_MAC_P_H
-#define QT_COCOA_HELPERS_MAC_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of qapplication_*.cpp, qwidget*.cpp, qcolor_x11.cpp, qfiledialog.cpp
-// and many other. This header file may change from version to version
-// without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <private/qt_mac_p.h>
-
-#include <qapplication.h>
-#include <qdesktopwidget.h>
-#include <qwidget.h>
-#include <qevent.h>
-#include <qhash.h>
-#include <qlabel.h>
-#include <qpointer.h>
-#include <qstyle.h>
-#include <qstyleoption.h>
-#include <qstylepainter.h>
-#include <qtimer.h>
-#include <qtooltip.h>
-#include <private/qeffects_p.h>
-#include <private/qwidget_p.h>
-#include <qtextdocument.h>
-#include <qdebug.h>
-#include <qpoint.h>
-#include "private/qt_mac_p.h"
-
-struct HIContentBorderMetrics;
-
-#ifdef __OBJC__
- // If the source file including this file also includes e.g. Cocoa/Cocoa.h, typedef-ing NSPoint will
- // fail since NSPoint will already be a type. So we try to detect this. If the build fails, ensure
- // that the inclusion of cocoa headers happends before the inclusion of this file.
- #include <Foundation/NSGeometry.h>
-#else
- #ifdef Q_WS_MAC32
- typedef struct _NSPoint NSPoint; // Just redefine here so I don't have to pull in all of Cocoa.
- #else
- typedef struct CGPoint NSPoint;
- #endif
-#endif
-
-QT_BEGIN_NAMESPACE
-
-Qt::MouseButtons qt_mac_get_buttons(int buttons);
-Qt::MouseButton qt_mac_get_button(EventMouseButton button);
-void macWindowFade(void * /*OSWindowRef*/ window, float durationSeconds = 0.15);
-void macWindowToolbarShow(const QWidget *widget, bool show );
-void macWindowToolbarSet( void * /*OSWindowRef*/ window, void* toolbarRef );
-bool macWindowToolbarIsVisible( void * /*OSWindowRef*/ window );
-void macWindowSetHasShadow( void * /*OSWindowRef*/ window, bool hasShadow );
-void macWindowFlush(void * /*OSWindowRef*/ window);
-void macSendToolbarChangeEvent(QWidget *widget);
-void qt_mac_updateContentBorderMetricts(void * /*OSWindowRef */window, const ::HIContentBorderMetrics &metrics);
-void qt_mac_replaceDrawRect(void * /*OSWindowRef */window, QWidgetPrivate *widget);
-void qt_mac_replaceDrawRectOriginal(void * /*OSWindowRef */window, QWidgetPrivate *widget);
-void qt_mac_showBaseLineSeparator(void * /*OSWindowRef */window, bool show);
-void qt_mac_update_mouseTracking(QWidget *widget);
-OSStatus qt_mac_drawCGImage(CGContextRef cg, const CGRect *inbounds, CGImageRef);
-bool qt_mac_checkForNativeSizeGrip(const QWidget *widget);
-void qt_dispatchTabletProximityEvent(void * /*NSEvent * */ tabletEvent);
-bool qt_dispatchKeyEventWithCocoa(void * /*NSEvent * */ keyEvent, QWidget *widgetToGetEvent);
-// These methods exists only for supporting unified mode.
-void macDrawRectOnTop(void * /*OSWindowRef */ window);
-void macSyncDrawingOnFirstInvocation(void * /*OSWindowRef */window);
-void qt_cocoaStackChildWindowOnTopOfOtherChildren(QWidget *widget);
-bool qt_dispatchKeyEvent(void * /*NSEvent * */ keyEvent, QWidget *widgetToGetEvent);
-void qt_dispatchModifiersChanged(void * /*NSEvent * */flagsChangedEvent, QWidget *widgetToGetEvent);
-bool qt_mac_handleTabletEvent(void * /*QCocoaView * */view, void * /*NSEvent * */event);
-inline QApplication *qAppInstance() { return static_cast<QApplication *>(QCoreApplication::instance()); }
-struct ::TabletProximityRec;
-void qt_dispatchTabletProximityEvent(const ::TabletProximityRec &proxRec);
-Qt::KeyboardModifiers qt_cocoaModifiers2QtModifiers(ulong modifierFlags);
-Qt::KeyboardModifiers qt_cocoaDragOperation2QtModifiers(uint dragOperations);
-QPixmap qt_mac_convert_iconref(const IconRef icon, int width, int height);
-void qt_mac_constructQIconFromIconRef(const IconRef icon, const IconRef overlayIcon, QIcon *retIcon,
- QStyle::StandardPixmap standardIcon = QStyle::SP_CustomBase);
-
-#ifdef __OBJC__
-struct DnDParams
-{
- NSView *view;
- NSEvent *theEvent;
- QPoint globalPoint;
- NSDragOperation performedAction;
-};
-
-DnDParams *macCurrentDnDParameters();
-NSDragOperation qt_mac_mapDropAction(Qt::DropAction action);
-NSDragOperation qt_mac_mapDropActions(Qt::DropActions actions);
-Qt::DropAction qt_mac_mapNSDragOperation(NSDragOperation nsActions);
-Qt::DropActions qt_mac_mapNSDragOperations(NSDragOperation nsActions);
-
-QWidget *qt_mac_getTargetForKeyEvent(QWidget *widgetThatReceivedEvent);
-QWidget *qt_mac_getTargetForMouseEvent(NSEvent *event, QEvent::Type eventType,
- QPoint &returnLocalPoint, QPoint &returnGlobalPoint, QWidget *nativeWidget, QWidget **returnWidgetUnderMouse);
-bool qt_mac_handleMouseEvent(NSEvent *event, QEvent::Type eventType, Qt::MouseButton button, QWidget *nativeWidget);
-void qt_mac_handleNonClientAreaMouseEvent(NSWindow *window, NSEvent *event);
-#endif
-
-inline int flipYCoordinate(int y)
-{
- return QApplication::desktop()->screenGeometry(0).height() - y;
-}
-
-inline qreal flipYCoordinate(qreal y)
-{
- return QApplication::desktop()->screenGeometry(0).height() - y;
-}
-
-QPointF flipPoint(const NSPoint &p);
-NSPoint flipPoint(const QPoint &p);
-NSPoint flipPoint(const QPointF &p);
-
-QStringList qt_mac_NSArrayToQStringList(void *nsarray);
-void *qt_mac_QStringListToNSMutableArrayVoid(const QStringList &list);
-
-void qt_syncCocoaTitleBarButtons(OSWindowRef window, QWidget *widgetForWindow);
-
-CGFloat qt_mac_get_scalefactor();
-QString qt_mac_get_pasteboardString(OSPasteboardRef paste);
-
-#ifdef __OBJC__
-inline NSMutableArray *qt_mac_QStringListToNSMutableArray(const QStringList &qstrlist)
-{ return reinterpret_cast<NSMutableArray *>(qt_mac_QStringListToNSMutableArrayVoid(qstrlist)); }
-
-inline QString qt_mac_NSStringToQString(const NSString *nsstr)
-{ return QCFString::toQString(reinterpret_cast<const CFStringRef>(nsstr)); }
-
-inline NSString *qt_mac_QStringToNSString(const QString &qstr)
-{ return [const_cast<NSString *>(reinterpret_cast<const NSString *>(QCFString::toCFStringRef(qstr))) autorelease]; }
-
-#endif
-
-class QMacScrollOptimization {
- // This class is made to optimize for the case when the user
- // scrolls both horizontally and vertically at the same
- // time. This will result in two QWheelEvents (one for each
- // direction), which will typically result in two calls to
- // QWidget::_scroll_sys. Rather than copying pixels twize on
- // screen because of this, we add this helper class to try to
- // get away with only one blit.
- static QWidgetPrivate *_target;
- static bool _inWheelEvent;
- static int _dx;
- static int _dy;
- static QRect _scrollRect;
-
-public:
- static void initDelayedScroll()
- {
- _inWheelEvent = true;
- }
-
- static bool delayScroll(QWidgetPrivate *target, int dx, int dy, const QRect &scrollRect)
- {
- if (!_inWheelEvent)
- return false;
- if (_target && _target != target)
- return false;
- if (_scrollRect.width() != -1 && _scrollRect != scrollRect)
- return false;
-
- _target = target;
- _dx += dx;
- _dy += dy;
- _scrollRect = scrollRect;
- return true;
- }
-
- static void performDelayedScroll()
- {
- if (!_inWheelEvent)
- return;
- _inWheelEvent = false;
- if (!_target)
- return;
-
- _target->scroll_sys(_dx, _dy, _scrollRect);
-
- _target = 0;
- _dx = 0;
- _dy = 0;
- _scrollRect = QRect(0, 0, -1, -1);
- }
-};
-
-void qt_mac_post_retranslateAppMenu();
-
-void qt_mac_display(QWidget *widget);
-void qt_mac_setNeedsDisplay(QWidget *widget);
-void qt_mac_setNeedsDisplayInRect(QWidget *widget, QRegion region);
-
-
-// Utility functions to ease the use of Core Graphics contexts.
-
-inline void qt_mac_retain_graphics_context(CGContextRef context)
-{
- CGContextRetain(context);
- CGContextSaveGState(context);
-}
-
-inline void qt_mac_release_graphics_context(CGContextRef context)
-{
- CGContextRestoreGState(context);
- CGContextRelease(context);
-}
-
-inline void qt_mac_draw_image(CGContextRef context, CGContextRef imageContext, CGRect area, CGRect drawingArea)
-{
- CGImageRef image = CGBitmapContextCreateImage(imageContext);
- CGImageRef subImage = CGImageCreateWithImageInRect(image, area);
-
- CGContextTranslateCTM (context, 0, drawingArea.origin.y + CGRectGetMaxY(drawingArea));
- CGContextScaleCTM(context, 1, -1);
- CGContextDrawImage(context, drawingArea, subImage);
-
- CGImageRelease(subImage);
- CGImageRelease(image);
-}
-
-QT_END_NAMESPACE
-
-#endif // QT_COCOA_HELPERS_MAC_P_H
diff --git a/src/widgets/platforms/mac/qt_mac.cpp b/src/widgets/platforms/mac/qt_mac.cpp
deleted file mode 100644
index adf8f70cab..0000000000
--- a/src/widgets/platforms/mac/qt_mac.cpp
+++ /dev/null
@@ -1,129 +0,0 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
-
-#include <private/qt_mac_p.h>
-#include <private/qpixmap_mac_p.h>
-#include <private/qnativeimage_p.h>
-#include <qdebug.h>
-
-QT_BEGIN_NAMESPACE
-static CTFontRef CopyCTThemeFont(ThemeFontID themeID)
-{
- CTFontUIFontType ctID = HIThemeGetUIFontType(themeID);
- return CTFontCreateUIFontForLanguage(ctID, 0, 0);
-}
-
-QFont qfontForThemeFont(ThemeFontID themeID)
-{
- QCFType<CTFontRef> ctfont = CopyCTThemeFont(themeID);
- QString familyName = QCFString(CTFontCopyFamilyName(ctfont));
- QCFType<CFDictionaryRef> dict = CTFontCopyTraits(ctfont);
- CFNumberRef num = static_cast<CFNumberRef>(CFDictionaryGetValue(dict, kCTFontWeightTrait));
- float fW;
- CFNumberGetValue(num, kCFNumberFloat32Type, &fW);
- QFont::Weight wght = fW > 0. ? QFont::Bold : QFont::Normal;
- num = static_cast<CFNumberRef>(CFDictionaryGetValue(dict, kCTFontSlantTrait));
- CFNumberGetValue(num, kCFNumberFloatType, &fW);
- bool italic = (fW != 0.0);
- return QFont(familyName, CTFontGetSize(ctfont), wght, italic);
-}
-
-#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5)
-
-static inline QColor leopardBrush(ThemeBrush brush)
-{
- QCFType<CGColorRef> cgClr = 0;
- HIThemeBrushCreateCGColor(brush, &cgClr);
- return qcolorFromCGColor(cgClr);
-}
-#endif
-
-QColor qcolorForTheme(ThemeBrush brush)
-{
- return leopardBrush(brush);
-}
-
-QColor qcolorForThemeTextColor(ThemeTextColor themeColor)
-{
-#ifdef Q_OS_MAC32
- RGBColor c;
- GetThemeTextColor(themeColor, 32, true, &c);
- QColor color = QColor(c.red / 256, c.green / 256, c.blue / 256);
- return color;
-#else
- // There is no equivalent to GetThemeTextColor in 64-bit and it was rather bad that
- // I didn't file a request to implement this for Snow Leopard. So, in the meantime
- // I've encoded the values from the GetThemeTextColor. This is not exactly ideal
- // as if someone really wants to mess with themeing, these colors will be wrong.
- // It also means that we need to make sure the values for differences between
- // OS releases (and it will be likely that we are a step behind.)
- switch (themeColor) {
- case kThemeTextColorAlertActive:
- case kThemeTextColorTabFrontActive:
- case kThemeTextColorBevelButtonActive:
- case kThemeTextColorListView:
- case kThemeTextColorPlacardActive:
- case kThemeTextColorPopupButtonActive:
- case kThemeTextColorPopupLabelActive:
- case kThemeTextColorPushButtonActive:
- return Qt::black;
- case kThemeTextColorAlertInactive:
- case kThemeTextColorDialogInactive:
- case kThemeTextColorPlacardInactive:
- return QColor(69, 69, 69, 255);
- case kThemeTextColorPopupButtonInactive:
- case kThemeTextColorPopupLabelInactive:
- case kThemeTextColorPushButtonInactive:
- case kThemeTextColorTabFrontInactive:
- case kThemeTextColorBevelButtonInactive:
- return QColor(127, 127, 127, 255);
- default: {
- QNativeImage nativeImage(16,16, QNativeImage::systemFormat());
- CGRect cgrect = CGRectMake(0, 0, 16, 16);
- HIThemeSetTextFill(themeColor, 0, nativeImage.cg, kHIThemeOrientationNormal);
- CGContextFillRect(nativeImage.cg, cgrect);
- QColor color = nativeImage.image.pixel(0,0);
- return QColor(nativeImage.image.pixel(0 , 0));
- }
- }
-#endif
-}
-QT_END_NAMESPACE
diff --git a/src/widgets/platforms/mac/qt_mac_p.h b/src/widgets/platforms/mac/qt_mac_p.h
deleted file mode 100644
index 3b679c32ec..0000000000
--- a/src/widgets/platforms/mac/qt_mac_p.h
+++ /dev/null
@@ -1,284 +0,0 @@
-/****************************************************************************
-**
-** 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 QT_MAC_P_H
-#define QT_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 "qmacdefines_mac.h"
-
-#ifdef __OBJC__
-#include <Cocoa/Cocoa.h>
-#include <objc/runtime.h>
-#endif
-
-#include <CoreServices/CoreServices.h>
-
-#include "QtCore/qglobal.h"
-#include "QtCore/qvariant.h"
-#include "QtCore/qmimedata.h"
-#include "QtCore/qpointer.h"
-#include "private/qcore_mac_p.h"
-
-
-#include "QtGui/qpainter.h"
-
-#include <Carbon/Carbon.h>
-
-QT_BEGIN_NAMESPACE
-class QWidget;
-class QDragMoveEvent;
-
-/* Event masks */
-// internal Qt types
-
- // Event class for our own Carbon events.
-#if defined(QT_NAMESPACE) && defined(QT_NAMESPACE_MAC_CRC)
-// Take the CRC we generated at configure time. This *may* result in a
-// collision with another value If that is the case, please change the value
-// here to something other than 'Cute'.
-const UInt32 kEventClassQt = QT_NAMESPACE_MAC_CRC;
-#else
-const UInt32 kEventClassQt = 'Cute';
-#endif
-
-enum {
- //AE types
- typeAEClipboardChanged = 1,
- //types
- typeQWidget = 1, /* QWidget * */
- //params
- kEventParamQWidget = 'qwid', /* typeQWidget */
- //events
- kEventQtRequestContext = 13,
- kEventQtRequestMenubarUpdate = 14,
- kEventQtRequestShowSheet = 17,
- kEventQtRequestActivate = 18,
- kEventQtRequestWindowChange = 20
-};
-
-// Simple class to manage short-lived regions
-class QMacSmartQuickDrawRegion
-{
- RgnHandle qdRgn;
- Q_DISABLE_COPY(QMacSmartQuickDrawRegion)
-public:
- explicit QMacSmartQuickDrawRegion(RgnHandle rgn) : qdRgn(rgn) {}
- ~QMacSmartQuickDrawRegion() {
- extern void qt_mac_dispose_rgn(RgnHandle); // qregion_mac.cpp
- qt_mac_dispose_rgn(qdRgn);
- }
- operator RgnHandle() {
- return qdRgn;
- }
-};
-
-// Class for chaining to gether a bunch of fades. It pretty much is only used for qmenu fading.
-class QMacWindowFader
-{
- QWidgetList m_windowsToFade;
- float m_duration;
- Q_DISABLE_COPY(QMacWindowFader)
-public:
- QMacWindowFader(); // PLEASE DON'T CALL THIS.
- static QMacWindowFader *currentFader();
- void registerWindowToFade(QWidget *window);
- void setFadeDuration(float durationInSecs) { m_duration = durationInSecs; }
- float fadeDuration() const { return m_duration; }
- void performFade();
-};
-
-class Q_WIDGETS_EXPORT QMacCocoaAutoReleasePool
-{
-private:
- void *pool;
-public:
- QMacCocoaAutoReleasePool();
- ~QMacCocoaAutoReleasePool();
-
- inline void *handle() const { return pool; }
-};
-
-QString qt_mac_removeMnemonics(const QString &original); //implemented in qmacstyle_mac.cpp
-
-class Q_WIDGETS_EXPORT QMacWindowChangeEvent
-{
-private:
- static QList<QMacWindowChangeEvent*> *change_events;
-public:
- QMacWindowChangeEvent() {
- }
- virtual ~QMacWindowChangeEvent() {
- }
- static inline void exec(bool ) {
- }
-protected:
- virtual void windowChanged() = 0;
- virtual void flushWindowChanged() = 0;
-};
-
-class QMacCGContext
-{
- CGContextRef context;
-public:
- QMacCGContext(QPainter *p); //qpaintengine_mac.cpp
- inline QMacCGContext() { context = 0; }
- inline QMacCGContext(const QPaintDevice *pdev) {
- extern CGContextRef qt_mac_cg_context(const QPaintDevice *);
- context = qt_mac_cg_context(pdev);
- }
- inline QMacCGContext(CGContextRef cg, bool takeOwnership=false) {
- context = cg;
- if(!takeOwnership)
- CGContextRetain(context);
- }
- inline QMacCGContext(const QMacCGContext &copy) : context(0) { *this = copy; }
- inline ~QMacCGContext() {
- if(context)
- CGContextRelease(context);
- }
- inline bool isNull() const { return context; }
- inline operator CGContextRef() { return context; }
- inline QMacCGContext &operator=(const QMacCGContext &copy) {
- if(context)
- CGContextRelease(context);
- context = copy.context;
- CGContextRetain(context);
- return *this;
- }
- inline QMacCGContext &operator=(CGContextRef cg) {
- if(context)
- CGContextRelease(context);
- context = cg;
- CGContextRetain(context); //we do not take ownership
- return *this;
- }
-};
-
-class QMacPasteboardMime;
-class QMimeData;
-
-class QMacPasteboard
-{
- struct Promise {
- Promise() : itemId(0), convertor(0) { }
- Promise(int itemId, QMacPasteboardMime *c, QString m, QVariant d, int o=0) : itemId(itemId), offset(o), convertor(c), mime(m), data(d) { }
- int itemId, offset;
- QMacPasteboardMime *convertor;
- QString mime;
- QVariant data;
- };
- QList<Promise> promises;
-
- OSPasteboardRef paste;
- uchar mime_type;
- mutable QPointer<QMimeData> mime;
- mutable bool mac_mime_source;
- static OSStatus promiseKeeper(OSPasteboardRef, PasteboardItemID, CFStringRef, void *);
- void clear_helper();
-public:
- QMacPasteboard(OSPasteboardRef p, uchar mime_type=0);
- QMacPasteboard(uchar mime_type);
- QMacPasteboard(CFStringRef name=0, uchar mime_type=0);
- ~QMacPasteboard();
-
- bool hasFlavor(QString flavor) const;
- bool hasOSType(int c_flavor) const;
-
- OSPasteboardRef pasteBoard() const;
- QMimeData *mimeData() const;
- void setMimeData(QMimeData *mime);
-
- QStringList formats() const;
- bool hasFormat(const QString &format) const;
- QVariant retrieveData(const QString &format, QVariant::Type) const;
-
- void clear();
- bool sync() const;
-};
-
-extern QPaintDevice *qt_mac_safe_pdev; //qapplication_mac.cpp
-
-extern OSWindowRef qt_mac_window_for(const QWidget*); //qwidget_mac.mm
-extern OSViewRef qt_mac_nativeview_for(const QWidget *); //qwidget_mac.mm
-extern QPoint qt_mac_nativeMapFromParent(const QWidget *child, const QPoint &pt); //qwidget_mac.mm
-
-#ifdef check
-# undef check
-#endif
-
-QFont qfontForThemeFont(ThemeFontID themeID);
-
-QColor qcolorForTheme(ThemeBrush brush);
-
-QColor qcolorForThemeTextColor(ThemeTextColor themeColor);
-
-struct QMacDndAnswerRecord {
- QRect rect;
- Qt::KeyboardModifiers modifiers;
- Qt::MouseButtons buttons;
- Qt::DropAction lastAction;
- unsigned int lastOperation;
- void clear() {
- rect = QRect();
- modifiers = Qt::NoModifier;
- buttons = Qt::NoButton;
- lastAction = Qt::IgnoreAction;
- lastOperation = 0;
- }
-};
-extern QMacDndAnswerRecord qt_mac_dnd_answer_rec;
-void qt_mac_copy_answer_rect(const QDragMoveEvent &event);
-bool qt_mac_mouse_inside_answer_rect(QPoint mouse);
-
-QT_END_NAMESPACE
-
-#endif // QT_MAC_P_H
diff --git a/src/widgets/platforms/mac/qwidget_mac.mm b/src/widgets/platforms/mac/qwidget_mac.mm
deleted file mode 100644
index 6c8413e42e..0000000000
--- a/src/widgets/platforms/mac/qwidget_mac.mm
+++ /dev/null
@@ -1,3089 +0,0 @@
-/****************************************************************************
-**
-** 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$
-**
-****************************************************************************/
-
-/****************************************************************************
-**
-** Copyright (c) 2007-2008, Apple, Inc.
-**
-** All rights reserved.
-**
-** Redistribution and use in source and binary forms, with or without
-** modification, are permitted provided that the following conditions are met:
-**
-** * Redistributions of source code must retain the above copyright notice,
-** this list of conditions and the following disclaimer.
-**
-** * Redistributions in binary form must reproduce the above copyright notice,
-** this list of conditions and the following disclaimer in the documentation
-** and/or other materials provided with the distribution.
-**
-** * Neither the name of Apple, Inc. nor the names of its contributors
-** may be used to endorse or promote products derived from this software
-** without specific prior written permission.
-**
-** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-** CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-** EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-** PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-** PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-** LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-** NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-** SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-**
-****************************************************************************/
-
-#include <private/qt_mac_p.h>
-#include <private/qeventdispatcher_mac_p.h>
-
-#include "qapplication.h"
-#include "qapplication_p.h"
-#include "qbitmap.h"
-#include "qcursor.h"
-#include "qdesktopwidget.h"
-#include "qevent.h"
-#include "qfileinfo.h"
-#include "qimage.h"
-#include "qlayout.h"
-#include "qmenubar.h"
-#include <private/qbackingstore_p.h>
-#include <private/qwindowsurface_mac_p.h>
-#include <private/qpaintengine_mac_p.h>
-#include "qpainter.h"
-#include "qstyle.h"
-#include "qtimer.h"
-#include "qfocusframe.h"
-#include "qdebug.h"
-#include <private/qmainwindowlayout_p.h>
-
-#include <private/qabstractscrollarea_p.h>
-#include <qabstractscrollarea.h>
-#include <ApplicationServices/ApplicationServices.h>
-#include <limits.h>
-#include <private/qt_cocoa_helpers_mac_p.h>
-#include <private/qcocoaview_mac_p.h>
-#include <private/qcocoawindow_mac_p.h>
-#include <private/qcocoawindowdelegate_mac_p.h>
-#include <private/qcocoapanel_mac_p.h>
-
-#include "qwidget_p.h"
-#include "qevent_p.h"
-#include "qdnd_p.h"
-#include <QtGui/qgraphicsproxywidget.h>
-#include "qmainwindow.h"
-
-QT_BEGIN_NAMESPACE
-
-// qmainwindow.cpp
-extern QMainWindowLayout *qt_mainwindow_layout(const QMainWindow *window);
-
-#define XCOORD_MAX 16383
-#define WRECT_MAX 8191
-
-
-
-/*****************************************************************************
- QWidget debug facilities
- *****************************************************************************/
-//#define DEBUG_WINDOW_RGNS
-//#define DEBUG_WINDOW_CREATE
-//#define DEBUG_WINDOW_STATE
-//#define DEBUG_WIDGET_PAINT
-
-/*****************************************************************************
- QWidget globals
- *****************************************************************************/
-
-static bool qt_mac_raise_process = true;
-static OSWindowRef qt_root_win = 0;
-QWidget *mac_mouse_grabber = 0;
-QWidget *mac_keyboard_grabber = 0;
-
-
-/*****************************************************************************
- Externals
- *****************************************************************************/
-extern QPointer<QWidget> qt_button_down; //qapplication_mac.cpp
-extern QWidget *qt_mac_modal_blocked(QWidget *); //qapplication_mac.mm
-extern void qt_event_request_activate(QWidget *); //qapplication_mac.mm
-extern bool qt_event_remove_activate(); //qapplication_mac.mm
-extern void qt_mac_event_release(QWidget *w); //qapplication_mac.mm
-extern void qt_event_request_showsheet(QWidget *); //qapplication_mac.mm
-extern void qt_event_request_window_change(QWidget *); //qapplication_mac.mm
-extern QPointer<QWidget> qt_last_mouse_receiver; //qapplication_mac.mm
-extern QPointer<QWidget> qt_last_native_mouse_receiver; //qt_cocoa_helpers_mac.mm
-extern IconRef qt_mac_create_iconref(const QPixmap &); //qpixmap_mac.cpp
-extern void qt_mac_set_cursor(const QCursor *, const QPoint &); //qcursor_mac.mm
-extern void qt_mac_update_cursor(); //qcursor_mac.mm
-extern bool qt_nograb();
-extern CGImageRef qt_mac_create_cgimage(const QPixmap &, bool); //qpixmap_mac.cpp
-extern RgnHandle qt_mac_get_rgn(); //qregion_mac.cpp
-extern QRegion qt_mac_convert_mac_region(RgnHandle rgn); //qregion_mac.cpp
-extern void qt_mac_setMouseGrabCursor(bool set, QCursor *cursor = 0); // qcursor_mac.mm
-extern QPointer<QWidget> topLevelAt_cache; // qapplication_mac.mm
-/*****************************************************************************
- QWidget utility functions
- *****************************************************************************/
-void Q_GUI_EXPORT qt_mac_set_raise_process(bool b) { qt_mac_raise_process = b; }
-static QSize qt_mac_desktopSize()
-{
- int w = 0, h = 0;
- CGDisplayCount cg_count;
- CGGetActiveDisplayList(0, 0, &cg_count);
- QVector<CGDirectDisplayID> displays(cg_count);
- CGGetActiveDisplayList(cg_count, displays.data(), &cg_count);
- Q_ASSERT(cg_count == (CGDisplayCount)displays.size());
- for(int i = 0; i < (int)cg_count; ++i) {
- CGRect r = CGDisplayBounds(displays.at(i));
- w = qMax<int>(w, qRound(r.origin.x + r.size.width));
- h = qMax<int>(h, qRound(r.origin.y + r.size.height));
- }
- return QSize(w, h);
-}
-
-static NSDrawer *qt_mac_drawer_for(const QWidget *widget)
-{
- NSView *widgetView = reinterpret_cast<NSView *>(widget->window()->effectiveWinId());
- NSArray *windows = [NSApp windows];
- for (NSWindow *window in windows) {
- NSArray *drawers = [window drawers];
- for (NSDrawer *drawer in drawers) {
- if ([drawer contentView] == widgetView)
- return drawer;
- }
- }
- return 0;
-}
-
-static void qt_mac_destructView(OSViewRef view)
-{
- NSWindow *window = [view window];
- if ([window contentView] == view)
- [window setContentView:[[NSView alloc] initWithFrame:[view bounds]]];
- [view removeFromSuperview];
- [view release];
-}
-
-static void qt_mac_destructWindow(OSWindowRef window)
-{
- if ([window isVisible] && [window isSheet]){
- [NSApp endSheet:window];
- [window orderOut:window];
- }
-
- [[QT_MANGLE_NAMESPACE(QCocoaWindowDelegate) sharedDelegate] resignDelegateForWindow:window];
- [window release];
-}
-
-static void qt_mac_destructDrawer(NSDrawer *drawer)
-{
- [[QT_MANGLE_NAMESPACE(QCocoaWindowDelegate) sharedDelegate] resignDelegateForDrawer:drawer];
- [drawer release];
-}
-
-bool qt_mac_can_clickThrough(const QWidget *w)
-{
- static int qt_mac_carbon_clickthrough = -1;
- if (qt_mac_carbon_clickthrough < 0)
- qt_mac_carbon_clickthrough = !qgetenv("QT_MAC_NO_COCOA_CLICKTHROUGH").isEmpty();
- bool ret = !qt_mac_carbon_clickthrough;
- for ( ; w; w = w->parentWidget()) {
- if (w->testAttribute(Qt::WA_MacNoClickThrough)) {
- ret = false;
- break;
- }
- }
- return ret;
-}
-
-bool qt_mac_is_macsheet(const QWidget *w)
-{
- if (!w)
- return false;
-
- Qt::WindowModality modality = w->windowModality();
- if (modality == Qt::ApplicationModal)
- return false;
- return w->parentWidget() && (modality == Qt::WindowModal || w->windowType() == Qt::Sheet);
-}
-
-bool qt_mac_is_macdrawer(const QWidget *w)
-{
- return (w && w->parentWidget() && w->windowType() == Qt::Drawer);
-}
-
-bool qt_mac_insideKeyWindow(const QWidget *w)
-{
- return [[reinterpret_cast<NSView *>(w->effectiveWinId()) window] isKeyWindow];
- return false;
-}
-
-bool qt_mac_set_drawer_preferred_edge(QWidget *w, Qt::DockWidgetArea where) //users of Qt for Mac OS X can use this..
-{
- if(!qt_mac_is_macdrawer(w))
- return false;
-
- NSDrawer *drawer = qt_mac_drawer_for(w);
- if (!drawer)
- return false;
- NSRectEdge edge;
- if (where & Qt::LeftDockWidgetArea)
- edge = NSMinXEdge;
- else if (where & Qt::RightDockWidgetArea)
- edge = NSMaxXEdge;
- else if (where & Qt::TopDockWidgetArea)
- edge = NSMaxYEdge;
- else if (where & Qt::BottomDockWidgetArea)
- edge = NSMinYEdge;
- else
- return false;
-
- if (edge == [drawer preferredEdge]) //no-op
- return false;
-
- if (w->isVisible()) {
- [drawer close];
- [drawer openOnEdge:edge];
- }
- [drawer setPreferredEdge:edge];
- return true;
-}
-
-QPoint qt_mac_posInWindow(const QWidget *w)
-{
- QPoint ret = w->data->wrect.topLeft();
- while(w && !w->isWindow()) {
- ret += w->pos();
- w = w->parentWidget();
- }
- return ret;
-}
-
-//find a QWidget from a OSWindowRef
-QWidget *qt_mac_find_window(OSWindowRef window)
-{
- return [window QT_MANGLE_NAMESPACE(qt_qwidget)];
-}
-
-inline static void qt_mac_set_fullscreen_mode(bool b)
-{
- extern bool qt_mac_app_fullscreen; //qapplication_mac.mm
- if(qt_mac_app_fullscreen == b)
- return;
- qt_mac_app_fullscreen = b;
- if (b) {
- SetSystemUIMode(kUIModeAllHidden, kUIOptionAutoShowMenuBar);
- } else {
- SetSystemUIMode(kUIModeNormal, 0);
- }
-}
-
-Q_GUI_EXPORT OSViewRef qt_mac_nativeview_for(const QWidget *w)
-{
- return reinterpret_cast<OSViewRef>(w->internalWinId());
-}
-
-Q_GUI_EXPORT OSViewRef qt_mac_effectiveview_for(const QWidget *w)
-{
- // Get the first non-alien (parent) widget for
- // w, and return its NSView (if it has one):
- return reinterpret_cast<OSViewRef>(w->effectiveWinId());
-}
-
-Q_GUI_EXPORT OSViewRef qt_mac_get_contentview_for(OSWindowRef w)
-{
- return [w contentView];
-}
-
-bool qt_mac_sendMacEventToWidget(QWidget *widget, EventRef ref)
-{
- return widget->macEvent(0, ref);
-}
-
-Q_GUI_EXPORT OSWindowRef qt_mac_window_for(OSViewRef view)
-{
- if (view)
- return [view window];
- return 0;
-}
-
-static bool qt_isGenuineQWidget(OSViewRef ref)
-{
- return [ref isKindOfClass:[QT_MANGLE_NAMESPACE(QCocoaView) class]];
-}
-
-bool qt_isGenuineQWidget(const QWidget *window)
-{
- if (!window)
- return false;
-
- if (!window->internalWinId())
- return true; //alien
-
- return qt_isGenuineQWidget(OSViewRef(window->internalWinId()));
-}
-
-Q_GUI_EXPORT OSWindowRef qt_mac_window_for(const QWidget *w)
-{
- if (OSViewRef hiview = qt_mac_effectiveview_for(w)) {
- OSWindowRef window = qt_mac_window_for(hiview);
- if (window)
- return window;
-
- if (qt_isGenuineQWidget(hiview)) {
- // This is a workaround for NSToolbar. When a widget is hidden
- // by clicking the toolbar button, Cocoa reparents the widgets
- // to another window (but Qt doesn't know about it).
- // When we start showing them, it reparents back,
- // but at this point it's window is nil, but the window it's being brought
- // into (the Qt one) is for sure created.
- // This stops the hierarchy moving under our feet.
- QWidget *toplevel = w->window();
- if (toplevel != w) {
- hiview = qt_mac_nativeview_for(toplevel);
- if (OSWindowRef w = qt_mac_window_for(hiview))
- return w;
- }
-
- toplevel->d_func()->createWindow_sys();
- // Reget the hiview since "create window" could potentially move the view (I guess).
- hiview = qt_mac_nativeview_for(toplevel);
- return qt_mac_window_for(hiview);
- }
- }
- return 0;
-}
-
-
-
-inline static bool updateRedirectedToGraphicsProxyWidget(QWidget *widget, const QRect &rect)
-{
- if (!widget)
- return false;
-
-#ifndef QT_NO_GRAPHICSVIEW
- QWidget *tlw = widget->window();
- QWExtra *extra = qt_widget_private(tlw)->extra;
- if (extra && extra->proxyWidget) {
- extra->proxyWidget->update(rect.translated(widget->mapTo(tlw, QPoint())));
- return true;
- }
-#endif
-
- return false;
-}
-
-inline static bool updateRedirectedToGraphicsProxyWidget(QWidget *widget, const QRegion &rgn)
-{
- if (!widget)
- return false;
-
-#ifndef QT_NO_GRAPHICSVIEW
- QWidget *tlw = widget->window();
- QWExtra *extra = qt_widget_private(tlw)->extra;
- if (extra && extra->proxyWidget) {
- const QPoint offset(widget->mapTo(tlw, QPoint()));
- const QVector<QRect> rects = rgn.rects();
- for (int i = 0; i < rects.size(); ++i)
- extra->proxyWidget->update(rects.at(i).translated(offset));
- return true;
- }
-#endif
-
- return false;
-}
-
-void QWidgetPrivate::macSetNeedsDisplay(QRegion region)
-{
- Q_Q(QWidget);
- if (NSView *nativeView = qt_mac_nativeview_for(q)) {
- // INVARIANT: q is _not_ alien. So we can optimize a little:
- if (region.isEmpty()) {
- [nativeView setNeedsDisplay:YES];
- } else {
- QVector<QRect> rects = region.rects();
- for (int i = 0; i<rects.count(); ++i) {
- const QRect &rect = rects.at(i);
- NSRect nsrect = NSMakeRect(rect.x(), rect.y(), rect.width(), rect.height());
- [nativeView setNeedsDisplayInRect:nsrect];
- }
- }
- } else if (QWidget *effectiveWidget = q->nativeParentWidget()) {
- // INVARIANT: q is alien, and effectiveWidget is native.
- if (NSView *effectiveView = qt_mac_nativeview_for(effectiveWidget)) {
- if (region.isEmpty()) {
- const QRect &rect = q->rect();
- QPoint p = q->mapTo(effectiveWidget, rect.topLeft());
- NSRect nsrect = NSMakeRect(p.x(), p.y(), rect.width(), rect.height());
- [effectiveView setNeedsDisplayInRect:nsrect];
- } else {
- QVector<QRect> rects = region.rects();
- for (int i = 0; i<rects.count(); ++i) {
- const QRect &rect = rects.at(i);
- QPoint p = q->mapTo(effectiveWidget, rect.topLeft());
- NSRect nsrect = NSMakeRect(p.x(), p.y(), rect.width(), rect.height());
- [effectiveView setNeedsDisplayInRect:nsrect];
- }
- }
- }
- }
-}
-
-void QWidgetPrivate::macUpdateIsOpaque()
-{
- Q_Q(QWidget);
- if (!q->testAttribute(Qt::WA_WState_Created))
- return;
- if (isRealWindow() && !q->testAttribute(Qt::WA_MacBrushedMetal)) {
- bool opaque = isOpaque;
- if (extra && extra->imageMask)
- opaque = false; // we are never opaque when we have a mask.
- [qt_mac_window_for(q) setOpaque:opaque];
- }
-}
-static OSWindowRef qt_mac_create_window(QWidget *widget, WindowClass wclass,
- NSUInteger wattr, const QRect &crect)
-{
- // Determine if we need to add in our "custom window" attribute. Cocoa is rather clever
- // in deciding if we need the maximize button or not (i.e., it's resizeable, so you
- // must need a maximize button). So, the only buttons we have control over are the
- // close and minimize buttons. If someone wants to customize and NOT have the maximize
- // button, then we have to do our hack. We only do it for these cases because otherwise
- // the window looks different when activated. This "QtMacCustomizeWindow" attribute is
- // intruding on a public space and WILL BREAK in the future.
- // One can hope that there is a more public API available by that time.
- Qt::WindowFlags flags = widget ? widget->windowFlags() : Qt::WindowFlags(0);
- if ((flags & Qt::CustomizeWindowHint)) {
- if ((flags & (Qt::WindowCloseButtonHint | Qt::WindowSystemMenuHint
- | Qt::WindowMinimizeButtonHint | Qt::WindowTitleHint))
- && !(flags & Qt::WindowMaximizeButtonHint))
- wattr |= QtMacCustomizeWindow;
- }
-
- // If we haven't created the desktop widget, you have to pass the rectangle
- // in "cocoa coordinates" (i.e., top points to the lower left coordinate).
- // Otherwise, we do the conversion for you. Since we are the only ones that
- // create the desktop widget, this is OK (but confusing).
- NSRect geo = NSMakeRect(crect.left(),
- (qt_root_win != 0) ? flipYCoordinate(crect.bottom() + 1) : crect.top(),
- crect.width(), crect.height());
- QMacCocoaAutoReleasePool pool;
- OSWindowRef window;
- switch (wclass) {
- case kMovableModalWindowClass:
- case kModalWindowClass:
- case kSheetWindowClass:
- case kFloatingWindowClass:
- case kOverlayWindowClass:
- case kHelpWindowClass: {
- NSPanel *panel;
- BOOL needFloating = NO;
- BOOL worksWhenModal = widget && (widget->windowType() == Qt::Popup);
- // Add in the extra flags if necessary.
- switch (wclass) {
- case kSheetWindowClass:
- wattr |= NSDocModalWindowMask;
- break;
- case kFloatingWindowClass:
- case kHelpWindowClass:
- needFloating = YES;
- wattr |= NSUtilityWindowMask;
- break;
- default:
- break;
- }
- panel = [[QT_MANGLE_NAMESPACE(QCocoaPanel) alloc] QT_MANGLE_NAMESPACE(qt_initWithQWidget):widget contentRect:geo styleMask:wattr];
- [panel setFloatingPanel:needFloating];
- [panel setWorksWhenModal:worksWhenModal];
- window = panel;
- break;
- }
- case kDrawerWindowClass: {
- NSDrawer *drawer = [[NSDrawer alloc] initWithContentSize:geo.size preferredEdge:NSMinXEdge];
- [[QT_MANGLE_NAMESPACE(QCocoaWindowDelegate) sharedDelegate] becomeDelegateForDrawer:drawer widget:widget];
- QWidget *parentWidget = widget->parentWidget();
- if (parentWidget)
- [drawer setParentWindow:qt_mac_window_for(parentWidget)];
- [drawer setLeadingOffset:0.0];
- [drawer setTrailingOffset:25.0];
- window = [[drawer contentView] window]; // Just to make sure we actually return a window
- break;
- }
- default:
- window = [[QT_MANGLE_NAMESPACE(QCocoaWindow) alloc] QT_MANGLE_NAMESPACE(qt_initWithQWidget):widget contentRect:geo styleMask:wattr];
- break;
- }
- qt_syncCocoaTitleBarButtons(window, widget);
- return window;
-}
-
-OSViewRef qt_mac_create_widget(QWidget *widget, QWidgetPrivate *widgetPrivate, OSViewRef parent)
-{
- QMacCocoaAutoReleasePool pool;
- QT_MANGLE_NAMESPACE(QCocoaView) *view = [[QT_MANGLE_NAMESPACE(QCocoaView) alloc] initWithQWidget:widget widgetPrivate:widgetPrivate];
-
-#ifdef ALIEN_DEBUG
- qDebug() << "Creating NSView for" << widget;
-#endif
-
- if (view && parent)
- [parent addSubview:view];
- return view;
-}
-
-void qt_mac_unregister_widget()
-{
-}
-
-void QWidgetPrivate::toggleDrawers(bool visible)
-{
- for (int i = 0; i < children.size(); ++i) {
- register QObject *object = children.at(i);
- if (!object->isWidgetType())
- continue;
- QWidget *widget = static_cast<QWidget*>(object);
- if(qt_mac_is_macdrawer(widget)) {
- bool oldState = widget->testAttribute(Qt::WA_WState_ExplicitShowHide);
- if(visible) {
- if (!widget->testAttribute(Qt::WA_WState_ExplicitShowHide))
- widget->show();
- } else {
- widget->hide();
- if(!oldState)
- widget->setAttribute(Qt::WA_WState_ExplicitShowHide, false);
- }
- }
- }
-}
-
-/*****************************************************************************
- QWidgetPrivate member functions
- *****************************************************************************/
-bool QWidgetPrivate::qt_mac_update_sizer(QWidget *w, int up)
-{
- // I'm not sure what "up" is
- if(!w || !w->isWindow())
- return false;
-
- QTLWExtra *topData = w->d_func()->topData();
- QWExtra *extraData = w->d_func()->extraData();
- // topData->resizer is only 4 bits, so subtracting -1 from zero causes bad stuff
- // to happen, prevent that here (you really want the thing hidden).
- if (up >= 0 || topData->resizer != 0)
- topData->resizer += up;
- OSWindowRef windowRef = qt_mac_window_for(OSViewRef(w->effectiveWinId()));
- {
- }
- bool remove_grip = (topData->resizer || (w->windowFlags() & Qt::FramelessWindowHint)
- || (extraData->maxw && extraData->maxh &&
- extraData->maxw == extraData->minw && extraData->maxh == extraData->minh));
- [windowRef setShowsResizeIndicator:!remove_grip];
- return true;
-}
-
-void QWidgetPrivate::qt_clean_root_win()
-{
- QMacCocoaAutoReleasePool pool;
- [qt_root_win release];
- qt_root_win = 0;
-}
-
-bool QWidgetPrivate::qt_create_root_win()
-{
- if(qt_root_win)
- return false;
- const QSize desktopSize = qt_mac_desktopSize();
- QRect desktopRect(QPoint(0, 0), desktopSize);
- qt_root_win = qt_mac_create_window(0, kOverlayWindowClass, NSBorderlessWindowMask, desktopRect);
- if(!qt_root_win)
- return false;
- qAddPostRoutine(qt_clean_root_win);
- return true;
-}
-
-bool QWidgetPrivate::qt_widget_rgn(QWidget *widget, short wcode, RgnHandle rgn, bool force = false)
-{
- bool ret = false;
- Q_UNUSED(widget);
- Q_UNUSED(wcode);
- Q_UNUSED(rgn);
- Q_UNUSED(force);
- return ret;
-}
-
-/*****************************************************************************
- QWidget member functions
- *****************************************************************************/
-void QWidgetPrivate::determineWindowClass()
-{
- Q_Q(QWidget);
-#if !defined(QT_NO_MAINWINDOW) && !defined(QT_NO_TOOLBAR)
- // Make sure that QMainWindow has the MacWindowToolBarButtonHint when the
- // unifiedTitleAndToolBarOnMac property is ON. This is to avoid reentry of
- // setParent() triggered by the QToolBar::event(QEvent::ParentChange).
- QMainWindow *mainWindow = qobject_cast<QMainWindow *>(q);
- if (mainWindow && mainWindow->unifiedTitleAndToolBarOnMac()) {
- data.window_flags |= Qt::MacWindowToolBarButtonHint;
- }
-#endif
-
- const Qt::WindowType type = q->windowType();
- Qt::WindowFlags &flags = data.window_flags;
- const bool popup = (type == Qt::Popup);
- if (type == Qt::ToolTip || type == Qt::SplashScreen || popup)
- flags |= Qt::FramelessWindowHint;
-
- WindowClass wclass = kSheetWindowClass;
- if(qt_mac_is_macdrawer(q))
- wclass = kDrawerWindowClass;
- else if (q->testAttribute(Qt::WA_ShowModal) && flags & Qt::CustomizeWindowHint)
- wclass = kDocumentWindowClass;
- else if(popup || (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_5 && type == Qt::SplashScreen))
- wclass = kModalWindowClass;
- else if(type == Qt::Dialog)
- wclass = kMovableModalWindowClass;
- else if(type == Qt::ToolTip)
- wclass = kHelpWindowClass;
- else if(type == Qt::Tool || (QSysInfo::MacintoshVersion < QSysInfo::MV_10_5
- && type == Qt::SplashScreen))
- wclass = kFloatingWindowClass;
- else if(q->testAttribute(Qt::WA_ShowModal))
- wclass = kMovableModalWindowClass;
- else
- wclass = kDocumentWindowClass;
-
- WindowAttributes wattr = NSBorderlessWindowMask;
- if(qt_mac_is_macsheet(q)) {
- //grp = GetWindowGroupOfClass(kMovableModalWindowClass);
- wclass = kSheetWindowClass;
- wattr = NSTitledWindowMask | NSResizableWindowMask;
- } else {
- // Shift things around a bit to get the correct window class based on the presence
- // (or lack) of the border.
- bool customize = flags & Qt::CustomizeWindowHint;
- bool framelessWindow = (flags & Qt::FramelessWindowHint || (customize && !(flags & Qt::WindowTitleHint)));
- if (framelessWindow) {
- if (wclass == kDocumentWindowClass) {
- wclass = kSimpleWindowClass;
- } else if (wclass == kFloatingWindowClass) {
- wclass = kToolbarWindowClass;
- } else if (wclass == kMovableModalWindowClass) {
- wclass = kModalWindowClass;
- }
- } else {
- wattr |= NSTitledWindowMask;
- if (wclass != kModalWindowClass)
- wattr |= NSResizableWindowMask;
- }
- // Only add extra decorations (well, buttons) for widgets that can have them
- // and have an actual border we can put them on.
- if (wclass != kModalWindowClass
- && wclass != kSheetWindowClass && wclass != kPlainWindowClass
- && !framelessWindow && wclass != kDrawerWindowClass
- && wclass != kHelpWindowClass) {
- if (flags & Qt::WindowMinimizeButtonHint)
- wattr |= NSMiniaturizableWindowMask;
- if (flags & Qt::WindowSystemMenuHint || flags & Qt::WindowCloseButtonHint)
- wattr |= NSClosableWindowMask;
- } else {
- // Clear these hints so that we aren't call them on invalid windows
- flags &= ~(Qt::WindowMaximizeButtonHint | Qt::WindowMinimizeButtonHint
- | Qt::WindowCloseButtonHint | Qt::WindowSystemMenuHint);
- }
- }
- if (q->testAttribute(Qt::WA_MacBrushedMetal))
- wattr |= NSTexturedBackgroundWindowMask;
-
-#ifdef DEBUG_WINDOW_CREATE
-#define ADD_DEBUG_WINDOW_NAME(x) { x, #x }
- struct {
- UInt32 tag;
- const char *name;
- } known_attribs[] = {
- ADD_DEBUG_WINDOW_NAME(kWindowCompositingAttribute),
- ADD_DEBUG_WINDOW_NAME(kWindowStandardHandlerAttribute),
- ADD_DEBUG_WINDOW_NAME(kWindowMetalAttribute),
- ADD_DEBUG_WINDOW_NAME(kWindowHideOnSuspendAttribute),
- ADD_DEBUG_WINDOW_NAME(kWindowStandardHandlerAttribute),
- ADD_DEBUG_WINDOW_NAME(kWindowCollapseBoxAttribute),
- ADD_DEBUG_WINDOW_NAME(kWindowHorizontalZoomAttribute),
- ADD_DEBUG_WINDOW_NAME(kWindowVerticalZoomAttribute),
- ADD_DEBUG_WINDOW_NAME(kWindowResizableAttribute),
- ADD_DEBUG_WINDOW_NAME(kWindowNoActivatesAttribute),
- ADD_DEBUG_WINDOW_NAME(kWindowNoUpdatesAttribute),
- ADD_DEBUG_WINDOW_NAME(kWindowOpaqueForEventsAttribute),
- ADD_DEBUG_WINDOW_NAME(kWindowLiveResizeAttribute),
- ADD_DEBUG_WINDOW_NAME(kWindowCloseBoxAttribute),
- ADD_DEBUG_WINDOW_NAME(kWindowHideOnSuspendAttribute),
- { 0, 0 }
- }, known_classes[] = {
- ADD_DEBUG_WINDOW_NAME(kHelpWindowClass),
- ADD_DEBUG_WINDOW_NAME(kPlainWindowClass),
- ADD_DEBUG_WINDOW_NAME(kDrawerWindowClass),
- ADD_DEBUG_WINDOW_NAME(kUtilityWindowClass),
- ADD_DEBUG_WINDOW_NAME(kToolbarWindowClass),
- ADD_DEBUG_WINDOW_NAME(kSheetWindowClass),
- ADD_DEBUG_WINDOW_NAME(kFloatingWindowClass),
- ADD_DEBUG_WINDOW_NAME(kUtilityWindowClass),
- ADD_DEBUG_WINDOW_NAME(kDocumentWindowClass),
- ADD_DEBUG_WINDOW_NAME(kToolbarWindowClass),
- ADD_DEBUG_WINDOW_NAME(kMovableModalWindowClass),
- ADD_DEBUG_WINDOW_NAME(kModalWindowClass),
- { 0, 0 }
- };
- qDebug("Qt: internal: ************* Creating new window %p (%s::%s)", q, q->metaObject()->className(),
- q->objectName().toLocal8Bit().constData());
- bool found_class = false;
- for(int i = 0; known_classes[i].name; i++) {
- if(wclass == known_classes[i].tag) {
- found_class = true;
- qDebug("Qt: internal: ** Class: %s", known_classes[i].name);
- break;
- }
- }
- if(!found_class)
- qDebug("Qt: internal: !! Class: Unknown! (%d)", (int)wclass);
- if(wattr) {
- WindowAttributes tmp_wattr = wattr;
- qDebug("Qt: internal: ** Attributes:");
- for(int i = 0; tmp_wattr && known_attribs[i].name; i++) {
- if((tmp_wattr & known_attribs[i].tag) == known_attribs[i].tag) {
- tmp_wattr ^= known_attribs[i].tag;
- }
- }
- if(tmp_wattr)
- qDebug("Qt: internal: !! Attributes: Unknown (%d)", (int)tmp_wattr);
- }
-#endif
-
- topData()->wclass = wclass;
- topData()->wattr = wattr;
-}
-
-#undef ADD_DEBUG_WINDOW_NAME
-
-void QWidgetPrivate::setWindowLevel()
-{
- Q_Q(QWidget);
- const QWidget * const windowParent = q->window()->parentWidget();
- const QWidget * const primaryWindow = windowParent ? windowParent->window() : 0;
- NSInteger winLevel = -1;
-
- if (q->windowType() == Qt::Popup) {
- winLevel = NSPopUpMenuWindowLevel;
- // Popup should be in at least the same level as its parent.
- if (primaryWindow) {
- OSWindowRef parentRef = qt_mac_window_for(primaryWindow);
- winLevel = qMax([parentRef level], winLevel);
- }
- } else if (q->windowType() == Qt::Tool) {
- winLevel = NSFloatingWindowLevel;
- } else if (q->windowType() == Qt::Dialog) {
- // Correct modality level (NSModalPanelWindowLevel) will be
- // set by cocoa when creating a modal session later.
- winLevel = NSNormalWindowLevel;
- }
-
- // StayOnTop window should appear above Tool windows.
- if (data.window_flags & Qt::WindowStaysOnTopHint)
- winLevel = NSPopUpMenuWindowLevel;
- // Tooltips should appear above StayOnTop windows.
- if (q->windowType() == Qt::ToolTip)
- winLevel = NSScreenSaverWindowLevel;
- // All other types are Normal level.
- if (winLevel == -1)
- winLevel = NSNormalWindowLevel;
- [qt_mac_window_for(q) setLevel:winLevel];
-}
-
-void QWidgetPrivate::finishCreateWindow_sys_Cocoa(void * /*NSWindow * */ voidWindowRef)
-{
- Q_Q(QWidget);
- QMacCocoaAutoReleasePool pool;
- NSWindow *windowRef = static_cast<NSWindow *>(voidWindowRef);
- const Qt::WindowType type = q->windowType();
- Qt::WindowFlags &flags = data.window_flags;
- QWidget *parentWidget = q->parentWidget();
-
- const bool popup = (type == Qt::Popup);
- const bool dialog = (type == Qt::Dialog
- || type == Qt::Sheet
- || type == Qt::Drawer
- || (flags & Qt::MSWindowsFixedSizeDialogHint));
- QTLWExtra *topExtra = topData();
-
- if ((popup || type == Qt::Tool || type == Qt::ToolTip) && !q->isModal()) {
- [windowRef setHidesOnDeactivate:YES];
- } else {
- [windowRef setHidesOnDeactivate:NO];
- }
- if (q->testAttribute(Qt::WA_MacNoShadow))
- [windowRef setHasShadow:NO];
- else
- [windowRef setHasShadow:YES];
- Q_UNUSED(parentWidget);
- Q_UNUSED(dialog);
-
- data.fstrut_dirty = true; // when we create a toplevel widget, the frame strut should be dirty
-
- OSViewRef nsview = (OSViewRef)data.winid;
- if (!nsview) {
- nsview = qt_mac_create_widget(q, this, 0);
- setWinId(WId(nsview));
- }
- [windowRef setContentView:nsview];
- [nsview setHidden:NO];
- transferChildren();
-
- // Tell Cocoa explicit that we wan't the view to receive key events
- // (regardless of focus policy) because this is how it works on other
- // platforms (and in the carbon port):
- [windowRef makeFirstResponder:nsview];
-
- if (topExtra->posFromMove) {
- updateFrameStrut();
-
- const QRect &fStrut = frameStrut();
- const QRect &crect = data.crect;
- const QRect frameRect(QPoint(crect.left(), crect.top()),
- QSize(fStrut.left() + fStrut.right() + crect.width(),
- fStrut.top() + fStrut.bottom() + crect.height()));
- NSRect cocoaFrameRect = NSMakeRect(frameRect.x(), flipYCoordinate(frameRect.bottom() + 1),
- frameRect.width(), frameRect.height());
- [windowRef setFrame:cocoaFrameRect display:NO];
- topExtra->posFromMove = false;
- }
-
- if (q->testAttribute(Qt::WA_WState_WindowOpacitySet)){
- q->setWindowOpacity(topExtra->opacity / 255.0f);
- } else if (qt_mac_is_macsheet(q)){
- CGFloat alpha = [qt_mac_window_for(q) alphaValue];
- if (alpha >= 1.0) {
- q->setWindowOpacity(0.95f);
- q->setAttribute(Qt::WA_WState_WindowOpacitySet, false);
- }
- } else{
- // If the window has been recreated after beeing e.g. a sheet,
- // make sure that we don't report a faulty opacity:
- q->setWindowOpacity(1.0f);
- q->setAttribute(Qt::WA_WState_WindowOpacitySet, false);
- }
-
- // Its more performant to handle the mouse cursor
- // ourselves, expecially when using alien widgets:
- [windowRef disableCursorRects];
-
- setWindowLevel();
- macUpdateHideOnSuspend();
- macUpdateOpaqueSizeGrip();
- macUpdateIgnoreMouseEvents();
- setWindowTitle_helper(extra->topextra->caption);
- setWindowIconText_helper(extra->topextra->iconText);
- setWindowModified_sys(q->isWindowModified());
- updateFrameStrut();
- syncCocoaMask();
- macUpdateIsOpaque();
- qt_mac_update_sizer(q);
- applyMaxAndMinSizeOnWindow();
-}
-
-
-/*
- Recreates widget window. Useful if immutable
- properties for it has changed.
- */
-void QWidgetPrivate::recreateMacWindow()
-{
- Q_Q(QWidget);
- OSViewRef myView = qt_mac_nativeview_for(q);
- OSWindowRef oldWindow = qt_mac_window_for(myView);
- QMacCocoaAutoReleasePool pool;
- [myView removeFromSuperview];
- determineWindowClass();
- createWindow_sys();
- if (NSToolbar *toolbar = [oldWindow toolbar]) {
- OSWindowRef newWindow = qt_mac_window_for(myView);
- [newWindow setToolbar:toolbar];
- [toolbar setVisible:[toolbar isVisible]];
- }
- if ([oldWindow isVisible]){
- if ([oldWindow isSheet])
- [NSApp endSheet:oldWindow];
- [oldWindow orderOut:oldWindow];
- show_sys();
- }
-
- // Release the window after creating the new window, because releasing it early
- // may cause the app to quit ("close on last window closed attribute")
- qt_mac_destructWindow(oldWindow);
-}
-
-void QWidgetPrivate::createWindow_sys()
-{
- Q_Q(QWidget);
- Qt::WindowFlags &flags = data.window_flags;
- QWidget *parentWidget = q->parentWidget();
-
- QTLWExtra *topExtra = topData();
- if (topExtra->embedded)
- return; // Simply return because this view "is" the top window.
- quint32 wattr = topExtra->wattr;
-
- if(parentWidget && (parentWidget->window()->windowFlags() & Qt::WindowStaysOnTopHint)) // If our parent has Qt::WStyle_StaysOnTop, so must we
- flags |= Qt::WindowStaysOnTopHint;
-
- data.fstrut_dirty = true;
-
- OSWindowRef windowRef = qt_mac_create_window(q, topExtra->wclass, wattr, data.crect);
- if (windowRef == 0)
- qWarning("QWidget: Internal error: %s:%d: If you reach this error please contact Qt Support and include the\n"
- " WidgetFlags used in creating the widget.", __FILE__, __LINE__);
- finishCreateWindow_sys_Cocoa(windowRef);
-}
-
-void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyOldWindow)
-{
- Q_Q(QWidget);
- QMacCocoaAutoReleasePool pool;
-
- OSViewRef destroyid = 0;
-
- Qt::WindowType type = q->windowType();
- Qt::WindowFlags flags = data.window_flags;
- QWidget *parentWidget = q->parentWidget();
-
- bool topLevel = (flags & Qt::Window);
- bool popup = (type == Qt::Popup);
- bool dialog = (type == Qt::Dialog
- || type == Qt::Sheet
- || type == Qt::Drawer
- || (flags & Qt::MSWindowsFixedSizeDialogHint));
- bool desktop = (type == Qt::Desktop);
-
- // Determine this early for top-levels so, we can use it later.
- if (topLevel)
- determineWindowClass();
-
- if (desktop) {
- QSize desktopSize = qt_mac_desktopSize();
- q->setAttribute(Qt::WA_WState_Visible);
- data.crect.setRect(0, 0, desktopSize.width(), desktopSize.height());
- dialog = popup = false; // force these flags off
- } else {
- if (topLevel && (type != Qt::Drawer)) {
- if (QDesktopWidget *dsk = QApplication::desktop()) { // calc pos/size from screen
- const bool wasResized = q->testAttribute(Qt::WA_Resized);
- const bool wasMoved = q->testAttribute(Qt::WA_Moved);
- int deskn = dsk->primaryScreen();
- if (parentWidget && parentWidget->windowType() != Qt::Desktop)
- deskn = dsk->screenNumber(parentWidget);
- QRect screenGeo = dsk->screenGeometry(deskn);
- if (!wasResized) {
- NSRect newRect = [NSWindow frameRectForContentRect:NSMakeRect(0, 0,
- screenGeo.width() / 2.,
- 4 * screenGeo.height() / 10.)
- styleMask:topData()->wattr];
- data.crect.setSize(QSize(newRect.size.width, newRect.size.height));
- // Constrain to minimums and maximums we've set
- if (extra->minw > 0)
- data.crect.setWidth(qMax(extra->minw, data.crect.width()));
- if (extra->minh > 0)
- data.crect.setHeight(qMax(extra->minh, data.crect.height()));
- if (extra->maxw > 0)
- data.crect.setWidth(qMin(extra->maxw, data.crect.width()));
- if (extra->maxh > 0)
- data.crect.setHeight(qMin(extra->maxh, data.crect.height()));
- }
- if (!wasMoved && !q->testAttribute(Qt::WA_DontShowOnScreen))
- data.crect.moveTopLeft(QPoint(screenGeo.width()/4,
- 3 * screenGeo.height() / 10));
- }
- }
- }
-
-
- if(!window) // always initialize
- initializeWindow=true;
-
- hd = 0;
- if(window) { // override the old window (with a new NSView)
- OSViewRef nativeView = OSViewRef(window);
- OSViewRef parent = 0;
- [nativeView retain];
- if (destroyOldWindow)
- destroyid = qt_mac_nativeview_for(q);
- bool transfer = false;
- setWinId((WId)nativeView);
- if(topLevel) {
- for(int i = 0; i < 2; ++i) {
- if(i == 1) {
- if(!initializeWindow)
- break;
- createWindow_sys();
- }
- if(OSWindowRef windowref = qt_mac_window_for(nativeView)) {
- [windowref retain];
- if (initializeWindow) {
- parent = qt_mac_get_contentview_for(windowref);
- } else {
- parent = [nativeView superview];
- }
- break;
- }
- }
- if(!parent)
- transfer = true;
- } else if (parentWidget) {
- // I need to be added to my parent, therefore my parent needs an NSView
- // Alien note: a 'window' was supplied as argument, meaning this widget
- // is not alien. So therefore the parent cannot be alien either.
- parentWidget->createWinId();
- parent = qt_mac_nativeview_for(parentWidget);
- }
- if(parent != nativeView && parent) {
- [parent addSubview:nativeView];
- }
- if(transfer)
- transferChildren();
- data.fstrut_dirty = true; // we'll re calculate this later
- q->setAttribute(Qt::WA_WState_Visible,
- ![nativeView isHidden]
- );
- if(initializeWindow) {
- NSRect bounds = NSMakeRect(data.crect.x(), data.crect.y(), data.crect.width(), data.crect.height());
- [nativeView setFrame:bounds];
- q->setAttribute(Qt::WA_WState_Visible, [nativeView isHidden]);
- }
- } else if (desktop) { // desktop widget
- if (!qt_root_win)
- QWidgetPrivate::qt_create_root_win();
- Q_ASSERT(qt_root_win);
- WId rootWinID = 0;
- [qt_root_win retain];
- if (OSViewRef rootContentView = [qt_root_win contentView]) {
- rootWinID = (WId)rootContentView;
- [rootContentView retain];
- }
- setWinId(rootWinID);
- } else if (topLevel) {
- determineWindowClass();
- if(OSViewRef osview = qt_mac_create_widget(q, this, 0)) {
- NSRect bounds = NSMakeRect(data.crect.x(), flipYCoordinate(data.crect.y()),
- data.crect.width(), data.crect.height());
- [osview setFrame:bounds];
- setWinId((WId)osview);
- }
- } else {
- data.fstrut_dirty = false; // non-toplevel widgets don't have a frame, so no need to update the strut
-
- if (q->testAttribute(Qt::WA_NativeWindow) == false || q->internalWinId() != 0) {
- // INVARIANT: q is Alien, and we should not create an NSView to back it up.
- } else
- if (OSViewRef osview = qt_mac_create_widget(q, this, qt_mac_nativeview_for(parentWidget))) {
- NSRect bounds = NSMakeRect(data.crect.x(), data.crect.y(), data.crect.width(), data.crect.height());
- [osview setFrame:bounds];
- setWinId((WId)osview);
- if (q->isVisible()) {
- // If q were Alien before, but now became native (e.g. if a call to
- // winId was done from somewhere), we need to show the view immidiatly:
- QMacCocoaAutoReleasePool pool;
- [osview setHidden:NO];
- }
- }
- }
-
- updateIsOpaque();
-
- if (q->testAttribute(Qt::WA_DropSiteRegistered))
- registerDropSite(true);
- if (q->hasFocus())
- setFocus_sys();
- if (!topLevel && initializeWindow)
- setWSGeometry();
- if (destroyid)
- qt_mac_destructView(destroyid);
-}
-
-/*!
- Returns the QuickDraw handle of the widget. Use of this function is not
- portable. This function will return 0 if QuickDraw is not supported, or
- if the handle could not be created.
-
- \warning This function is only available on Mac OS X.
-*/
-
-Qt::HANDLE
-QWidget::macQDHandle() const
-{
- return 0;
-}
-
-/*!
- Returns the CoreGraphics handle of the widget. Use of this function is
- not portable. This function will return 0 if no painter context can be
- established, or if the handle could not be created.
-
- \warning This function is only available on Mac OS X.
-*/
-Qt::HANDLE
-QWidget::macCGHandle() const
-{
- return handle();
-}
-
-void qt_mac_updateParentUnderAlienWidget(QWidget *alienWidget)
-{
- QWidget *nativeParent = alienWidget->nativeParentWidget();
- if (!nativeParent)
- return;
-
- QPoint globalPos = alienWidget->mapToGlobal(QPoint(0, 0));
- QRect dirtyRect = QRect(nativeParent->mapFromGlobal(globalPos), alienWidget->size());
- nativeParent->update(dirtyRect);
-}
-
-void QWidget::destroy(bool destroyWindow, bool destroySubWindows)
-{
- Q_D(QWidget);
- QMacCocoaAutoReleasePool pool;
- d->aboutToDestroy();
- if (!isWindow() && parentWidget())
- parentWidget()->d_func()->invalidateBuffer(d->effectiveRectFor(geometry()));
- if (!internalWinId())
- qt_mac_updateParentUnderAlienWidget(this);
- d->deactivateWidgetCleanup();
- qt_mac_event_release(this);
- if(testAttribute(Qt::WA_WState_Created)) {
- setAttribute(Qt::WA_WState_Created, false);
- QObjectList chldrn = children();
- for(int i = 0; i < chldrn.size(); i++) { // destroy all widget children
- QObject *obj = chldrn.at(i);
- if(obj->isWidgetType())
- static_cast<QWidget*>(obj)->destroy(destroySubWindows, destroySubWindows);
- }
- if(mac_mouse_grabber == this)
- releaseMouse();
- if(mac_keyboard_grabber == this)
- releaseKeyboard();
-
- if(testAttribute(Qt::WA_ShowModal)) // just be sure we leave modal
- QApplicationPrivate::leaveModal(this);
- else if((windowType() == Qt::Popup))
- qApp->d_func()->closePopup(this);
- if (destroyWindow) {
- if(OSViewRef hiview = qt_mac_nativeview_for(this)) {
- OSWindowRef window = 0;
- NSDrawer *drawer = nil;
- if (qt_mac_is_macdrawer(this)) {
- drawer = qt_mac_drawer_for(this);
- } else
- if (isWindow())
- window = qt_mac_window_for(hiview);
-
- // Because of how "destruct" works, we have to do just a normal release for the root_win.
- if (window && window == qt_root_win) {
- [hiview release];
- } else {
- qt_mac_destructView(hiview);
- }
- if (drawer)
- qt_mac_destructDrawer(drawer);
- if (window)
- qt_mac_destructWindow(window);
- }
- }
- QT_TRY {
- d->setWinId(0);
- } QT_CATCH (const std::bad_alloc &) {
- // swallow - destructors must not throw
- }
- }
-}
-
-void QWidgetPrivate::transferChildren()
-{
- Q_Q(QWidget);
- if (!q->internalWinId())
- return; // Can't add any views anyway
-
- QObjectList chlist = q->children();
- for (int i = 0; i < chlist.size(); ++i) {
- QObject *obj = chlist.at(i);
- if (obj->isWidgetType()) {
- QWidget *w = (QWidget *)obj;
- if (!w->isWindow()) {
- // This seems weird, no need to call it in a loop right?
- if (!topData()->caption.isEmpty())
- setWindowTitle_helper(extra->topextra->caption);
- if (w->internalWinId()) {
- // New NSWindows get an extra reference when drops are
- // registered (at least in 10.5) which means that we may
- // access the window later and get a crash (becasue our
- // widget is dead). Work around this be having the drop
- // site disabled until it is part of the new hierarchy.
- bool oldRegistered = w->testAttribute(Qt::WA_DropSiteRegistered);
- w->setAttribute(Qt::WA_DropSiteRegistered, false);
- [qt_mac_nativeview_for(w) retain];
- [qt_mac_nativeview_for(w) removeFromSuperview];
- [qt_mac_nativeview_for(q) addSubview:qt_mac_nativeview_for(w)];
- [qt_mac_nativeview_for(w) release];
- w->setAttribute(Qt::WA_DropSiteRegistered, oldRegistered);
- }
- }
- }
- }
-}
-
-void QWidgetPrivate::setSubWindowStacking(bool set)
-{
- // After hitting too many unforeseen bugs trying to put Qt on top of the cocoa child
- // window API, we have decided to revert this behaviour as much as we can. We
- // therefore now only allow child windows to exist for children of modal dialogs.
- static bool use_behaviour_qt473 = !qgetenv("QT_MAC_USE_CHILDWINDOWS").isEmpty();
-
- // This will set/remove a visual relationship between parent and child on screen.
- // The reason for doing this is to ensure that a child always stacks infront of
- // its parent. Unfortunatly is turns out that [NSWindow addChildWindow] has
- // several unwanted side-effects, one of them being the moving of a child when
- // moving the parent, which we choose to accept. A way tougher side-effect is
- // that Cocoa will hide the parent if you hide the child. And in the case of
- // a tool window, since it will normally hide when you deactivate the
- // application, Cocoa will hide the parent upon deactivate as well. The result often
- // being no more visible windows on screen. So, to make a long story short, we only
- // allow parent-child relationships between windows that both are either a plain window
- // or a dialog.
-
- Q_Q(QWidget);
- if (!q->isWindow())
- return;
- NSWindow *qwin = [qt_mac_nativeview_for(q) window];
- if (!qwin)
- return;
- Qt::WindowType qtype = q->windowType();
- if (set && !(qtype == Qt::Window || qtype == Qt::Dialog))
- return;
- if (set && ![qwin isVisible])
- return;
-
- if (QWidget *parent = q->parentWidget()) {
- if (NSWindow *pwin = [qt_mac_nativeview_for(parent) window]) {
- if (set) {
- Qt::WindowType ptype = parent->window()->windowType();
- if ([pwin isVisible]
- && (ptype == Qt::Window || ptype == Qt::Dialog)
- && ![qwin parentWindow]
- && (use_behaviour_qt473 || parent->windowModality() == Qt::ApplicationModal)) {
- NSInteger level = [qwin level];
- [pwin addChildWindow:qwin ordered:NSWindowAbove];
- if ([qwin level] < level)
- [qwin setLevel:level];
- }
- } else {
- [pwin removeChildWindow:qwin];
- }
- }
- }
-
- // Only set-up child windows for q if q is modal:
- if (set && !use_behaviour_qt473 && q->windowModality() != Qt::ApplicationModal)
- return;
-
- QObjectList widgets = q->children();
- for (int i=0; i<widgets.size(); ++i) {
- QWidget *child = qobject_cast<QWidget *>(widgets.at(i));
- if (child && child->isWindow()) {
- if (NSWindow *cwin = [qt_mac_nativeview_for(child) window]) {
- if (set) {
- Qt::WindowType ctype = child->window()->windowType();
- if ([cwin isVisible] && (ctype == Qt::Window || ctype == Qt::Dialog) && ![cwin parentWindow]) {
- NSInteger level = [cwin level];
- [qwin addChildWindow:cwin ordered:NSWindowAbove];
- if ([cwin level] < level)
- [cwin setLevel:level];
- }
- } else {
- [qwin removeChildWindow:qt_mac_window_for(child)];
- }
- }
- }
- }
-}
-
-void QWidgetPrivate::setParent_sys(QWidget *parent, Qt::WindowFlags f)
-{
- Q_Q(QWidget);
- QMacCocoaAutoReleasePool pool;
- QTLWExtra *topData = maybeTopData();
- bool wasCreated = q->testAttribute(Qt::WA_WState_Created);
- bool wasWindow = q->isWindow();
- OSViewRef old_id = 0;
-
- if (q->isVisible() && q->parentWidget() && parent != q->parentWidget())
- q->parentWidget()->d_func()->invalidateBuffer(effectiveRectFor(q->geometry()));
-
- // Maintain the glWidgets list on parent change: remove "our" gl widgets
- // from the list on the old parent and grandparents.
- if (glWidgets.isEmpty() == false) {
- QWidget *current = q->parentWidget();
- while (current) {
- for (QList<QWidgetPrivate::GlWidgetInfo>::const_iterator it = glWidgets.constBegin();
- it != glWidgets.constEnd(); ++it)
- current->d_func()->glWidgets.removeAll(*it);
-
- if (current->isWindow())
- break;
- current = current->parentWidget();
- }
- }
-
- bool oldToolbarVisible = false;
- NSDrawer *oldDrawer = nil;
- NSToolbar *oldToolbar = 0;
- if (wasCreated && !(q->windowType() == Qt::Desktop)) {
- old_id = qt_mac_nativeview_for(q);
- if (qt_mac_is_macdrawer(q)) {
- oldDrawer = qt_mac_drawer_for(q);
- }
- if (wasWindow) {
- OSWindowRef oldWindow = qt_mac_window_for(old_id);
- oldToolbar = [oldWindow toolbar];
- if (oldToolbar) {
- [oldToolbar retain];
- oldToolbarVisible = [oldToolbar isVisible];
- [oldWindow setToolbar:nil];
- }
- }
- }
- QWidget* oldtlw = q->window();
-
- if (q->testAttribute(Qt::WA_DropSiteRegistered))
- q->setAttribute(Qt::WA_DropSiteRegistered, false);
-
- //recreate and setup flags
- QObjectPrivate::setParent_helper(parent);
- bool explicitlyHidden = q->testAttribute(Qt::WA_WState_Hidden) && q->testAttribute(Qt::WA_WState_ExplicitShowHide);
- if (wasCreated && !qt_isGenuineQWidget(q))
- return;
-
- if (!q->testAttribute(Qt::WA_WState_WindowOpacitySet)) {
- q->setWindowOpacity(1.0f);
- q->setAttribute(Qt::WA_WState_WindowOpacitySet, false);
- }
-
- setWinId(0); //do after the above because they may want the id
-
- data.window_flags = f;
- q->setAttribute(Qt::WA_WState_Created, false);
- q->setAttribute(Qt::WA_WState_Visible, false);
- q->setAttribute(Qt::WA_WState_Hidden, false);
- adjustFlags(data.window_flags, q);
- // keep compatibility with previous versions, we need to preserve the created state.
- // (but we recreate the winId for the widget being reparented, again for compatibility,
- // unless this is an alien widget. )
- const bool nonWindowWithCreatedParent = !q->isWindow() && parent->testAttribute(Qt::WA_WState_Created);
- const bool nativeWidget = q->internalWinId() != 0;
- if (wasCreated || (nativeWidget && nonWindowWithCreatedParent)) {
- createWinId();
- if (q->isWindow()) {
- // Simply transfer our toolbar over. Everything should stay put, unlike in Carbon.
- if (oldToolbar && !(f & Qt::FramelessWindowHint)) {
- OSWindowRef newWindow = qt_mac_window_for(q);
- [newWindow setToolbar:oldToolbar];
- [oldToolbar release];
- [oldToolbar setVisible:oldToolbarVisible];
- }
- }
- }
- if (q->isWindow() || (!parent || parent->isVisible()) || explicitlyHidden)
- q->setAttribute(Qt::WA_WState_Hidden);
- q->setAttribute(Qt::WA_WState_ExplicitShowHide, explicitlyHidden);
-
- if (wasCreated) {
- transferChildren();
-
- if (topData &&
- (!topData->caption.isEmpty() || !topData->filePath.isEmpty()))
- setWindowTitle_helper(q->windowTitle());
- }
-
- if (q->testAttribute(Qt::WA_AcceptDrops)
- || (!q->isWindow() && q->parentWidget()
- && q->parentWidget()->testAttribute(Qt::WA_DropSiteRegistered)))
- q->setAttribute(Qt::WA_DropSiteRegistered, true);
-
- //cleanup
- if (old_id) { //don't need old window anymore
- OSWindowRef window = (oldtlw == q) ? qt_mac_window_for(old_id) : 0;
- qt_mac_destructView(old_id);
-
- if (oldDrawer) {
- qt_mac_destructDrawer(oldDrawer);
- } else
- if (window)
- qt_mac_destructWindow(window);
- }
-
- // Maintain the glWidgets list on parent change: add "our" gl widgets
- // to the list on the new parent and grandparents.
- if (glWidgets.isEmpty() == false) {
- QWidget *current = q->parentWidget();
- while (current) {
- current->d_func()->glWidgets += glWidgets;
- if (current->isWindow())
- break;
- current = current->parentWidget();
- }
- }
- invalidateBuffer(q->rect());
- qt_event_request_window_change(q);
-}
-
-QPoint QWidget::mapToGlobal(const QPoint &pos) const
-{
- Q_D(const QWidget);
- if (!internalWinId()) {
- QPoint p = pos + data->crect.topLeft();
- return isWindow() ? p : parentWidget()->mapToGlobal(p);
- }
- QPoint tmp = d->mapToWS(pos);
- NSPoint hi_pos = NSMakePoint(tmp.x(), tmp.y());
- hi_pos = [qt_mac_nativeview_for(this) convertPoint:hi_pos toView:nil];
- NSRect win_rect = [qt_mac_window_for(this) frame];
- hi_pos.x += win_rect.origin.x;
- hi_pos.y += win_rect.origin.y;
- // If we aren't the desktop we need to flip, if you flip the desktop on itself, you get the other problem.
- return ((window()->windowFlags() & Qt::Desktop) == Qt::Desktop) ? QPointF(hi_pos.x, hi_pos.y).toPoint()
- : flipPoint(hi_pos).toPoint();
-}
-
-QPoint QWidget::mapFromGlobal(const QPoint &pos) const
-{
- Q_D(const QWidget);
- if (!internalWinId()) {
- QPoint p = isWindow() ? pos : parentWidget()->mapFromGlobal(pos);
- return p - data->crect.topLeft();
- }
- NSRect win_rect = [qt_mac_window_for(this) frame];
- // The Window point is in "Cocoa coordinates," but the view is in "Qt coordinates"
- // so make sure to keep them in sync.
- NSPoint hi_pos = NSMakePoint(pos.x()-win_rect.origin.x,
- flipYCoordinate(pos.y())-win_rect.origin.y);
- hi_pos = [qt_mac_nativeview_for(this) convertPoint:hi_pos fromView:0];
- return d->mapFromWS(QPoint(qRound(hi_pos.x), qRound(hi_pos.y)));
-}
-
-void QWidgetPrivate::updateSystemBackground()
-{
-}
-
-void QWidgetPrivate::setCursor_sys(const QCursor &)
-{
- qt_mac_update_cursor();
-}
-
-void QWidgetPrivate::unsetCursor_sys()
-{
- qt_mac_update_cursor();
-}
-
-void QWidgetPrivate::setWindowTitle_sys(const QString &caption)
-{
- Q_Q(QWidget);
- if (q->isWindow()) {
- QMacCocoaAutoReleasePool pool;
- [qt_mac_window_for(q) setTitle:qt_mac_QStringToNSString(caption)];
- }
-}
-
-void QWidgetPrivate::setWindowModified_sys(bool mod)
-{
- Q_Q(QWidget);
- if (q->isWindow() && q->testAttribute(Qt::WA_WState_Created)) {
- [qt_mac_window_for(q) setDocumentEdited:mod];
- }
-}
-
-void QWidgetPrivate::setWindowFilePath_sys(const QString &filePath)
-{
- Q_Q(QWidget);
- QMacCocoaAutoReleasePool pool;
- QFileInfo fi(filePath);
- [qt_mac_window_for(q) setRepresentedFilename:fi.exists() ? qt_mac_QStringToNSString(filePath) : @""];
-}
-
-void QWidgetPrivate::setWindowIcon_sys(bool forceReset)
-{
- Q_Q(QWidget);
-
- if (!q->testAttribute(Qt::WA_WState_Created))
- return;
-
- QTLWExtra *topData = this->topData();
- if (topData->iconPixmap && !forceReset) // already set
- return;
-
- QIcon icon = q->windowIcon();
- QPixmap *pm = 0;
- if (!icon.isNull()) {
- // now create the extra
- if (!topData->iconPixmap) {
- pm = new QPixmap(icon.pixmap(QSize(22, 22)));
- topData->iconPixmap = pm;
- } else {
- pm = topData->iconPixmap;
- }
- }
- if (q->isWindow()) {
- QMacCocoaAutoReleasePool pool;
- if (icon.isNull())
- return;
- NSButton *iconButton = [qt_mac_window_for(q) standardWindowButton:NSWindowDocumentIconButton];
- if (iconButton == nil) {
- QCFString string(q->windowTitle());
- const NSString *tmpString = reinterpret_cast<const NSString *>((CFStringRef)string);
- [qt_mac_window_for(q) setRepresentedURL:[NSURL fileURLWithPath:const_cast<NSString *>(tmpString)]];
- iconButton = [qt_mac_window_for(q) standardWindowButton:NSWindowDocumentIconButton];
- }
- if (icon.isNull()) {
- [iconButton setImage:nil];
- } else {
- QPixmap scaled = pm->scaled(QSize(16,16), Qt::KeepAspectRatio, Qt::SmoothTransformation);
- NSImage *image = static_cast<NSImage *>(qt_mac_create_nsimage(scaled));
- [iconButton setImage:image];
- [image release];
- }
- }
-}
-
-void QWidgetPrivate::setWindowIconText_sys(const QString &iconText)
-{
- Q_Q(QWidget);
- if(q->isWindow() && !iconText.isEmpty()) {
- QMacCocoaAutoReleasePool pool;
- [qt_mac_window_for(q) setMiniwindowTitle:qt_mac_QStringToNSString(iconText)];
- }
-}
-
-void QWidget::grabMouse()
-{
- if(isVisible() && !qt_nograb()) {
- if(mac_mouse_grabber)
- mac_mouse_grabber->releaseMouse();
- mac_mouse_grabber=this;
- qt_mac_setMouseGrabCursor(true);
- }
-}
-
-#ifndef QT_NO_CURSOR
-void QWidget::grabMouse(const QCursor &cursor)
-{
- if(isVisible() && !qt_nograb()) {
- if(mac_mouse_grabber)
- mac_mouse_grabber->releaseMouse();
- mac_mouse_grabber=this;
- qt_mac_setMouseGrabCursor(true, const_cast<QCursor *>(&cursor));
- }
-}
-#endif
-
-void QWidget::releaseMouse()
-{
- if(!qt_nograb() && mac_mouse_grabber == this) {
- mac_mouse_grabber = 0;
- qt_mac_setMouseGrabCursor(false);
- }
-}
-
-void QWidget::grabKeyboard()
-{
- if(!qt_nograb()) {
- if(mac_keyboard_grabber)
- mac_keyboard_grabber->releaseKeyboard();
- mac_keyboard_grabber = this;
- }
-}
-
-void QWidget::releaseKeyboard()
-{
- if(!qt_nograb() && mac_keyboard_grabber == this)
- mac_keyboard_grabber = 0;
-}
-
-QWidget *QWidget::mouseGrabber()
-{
- return mac_mouse_grabber;
-}
-
-QWidget *QWidget::keyboardGrabber()
-{
- return mac_keyboard_grabber;
-}
-
-void QWidget::activateWindow()
-{
- QWidget *tlw = window();
- if(!tlw->isVisible() || !tlw->isWindow() || (tlw->windowType() == Qt::Desktop))
- return;
- qt_event_remove_activate();
-
- QWidget *fullScreenWidget = tlw;
- QWidget *parentW = tlw;
- // Find the oldest parent or the parent with fullscreen, whichever comes first.
- while (parentW) {
- fullScreenWidget = parentW->window();
- if (fullScreenWidget->windowState() & Qt::WindowFullScreen)
- break;
- parentW = fullScreenWidget->parentWidget();
- }
-
- if (fullScreenWidget->windowType() != Qt::ToolTip) {
- qt_mac_set_fullscreen_mode((fullScreenWidget->windowState() & Qt::WindowFullScreen) &&
- qApp->desktop()->screenNumber(this) == 0);
- }
-
- bool windowActive;
- OSWindowRef win = qt_mac_window_for(tlw);
- QMacCocoaAutoReleasePool pool;
- windowActive = [win isKeyWindow];
- if ((tlw->windowType() == Qt::Popup)
- || (tlw->windowType() == Qt::Tool)
- || qt_mac_is_macdrawer(tlw)
- || windowActive) {
- [win makeKeyWindow];
- } else if(!isMinimized()) {
- [win makeKeyAndOrderFront:win];
- }
-}
-
-QWindowSurface *QWidgetPrivate::createDefaultWindowSurface_sys()
-{
- return new QMacWindowSurface(q_func());
-}
-
-void QWidgetPrivate::update_sys(const QRect &r)
-{
- Q_Q(QWidget);
- if (updateRedirectedToGraphicsProxyWidget(q, r))
- return;
- dirtyOnWidget += r;
- macSetNeedsDisplay(r != q->rect() ? r : QRegion());
-}
-
-void QWidgetPrivate::update_sys(const QRegion &rgn)
-{
- Q_Q(QWidget);
- if (updateRedirectedToGraphicsProxyWidget(q, rgn))
- return;
- dirtyOnWidget += rgn;
- macSetNeedsDisplay(rgn);
-}
-
-bool QWidgetPrivate::isRealWindow() const
-{
- return q_func()->isWindow() && !topData()->embedded;
-}
-
-void QWidgetPrivate::show_sys()
-{
- Q_Q(QWidget);
- if ((q->windowType() == Qt::Desktop)) //desktop is always visible
- return;
-
- invalidateBuffer(q->rect());
- if (q->testAttribute(Qt::WA_OutsideWSRange))
- return;
- QMacCocoaAutoReleasePool pool;
- q->setAttribute(Qt::WA_Mapped);
- if (q->testAttribute(Qt::WA_DontShowOnScreen))
- return;
-
- bool realWindow = isRealWindow();
-
- data.fstrut_dirty = true;
- if (realWindow) {
- bool isCurrentlyMinimized = (q->windowState() & Qt::WindowMinimized);
- setModal_sys();
- OSWindowRef window = qt_mac_window_for(q);
-
- // Make sure that we end up sending a repaint event to
- // the widget if the window has been visible one before:
- [qt_mac_get_contentview_for(window) setNeedsDisplay:YES];
- if(qt_mac_is_macsheet(q)) {
- qt_event_request_showsheet(q);
- } else if(qt_mac_is_macdrawer(q)) {
- NSDrawer *drawer = qt_mac_drawer_for(q);
- [drawer openOnEdge:[drawer preferredEdge]];
- } else {
- // sync the opacity value back (in case of a fade).
- [window setAlphaValue:q->windowOpacity()];
-
- QWidget *top = 0;
- if (QApplicationPrivate::tryModalHelper(q, &top)) {
- [window makeKeyAndOrderFront:window];
- // If this window is app modal, we need to start spinning
- // a modal session for it. Interrupting
- // the event dispatcher will make this happend:
- if (data.window_modality == Qt::ApplicationModal)
- QEventDispatcherMac::instance()->interrupt();
- } else {
- // The window is modally shaddowed, so we need to make
- // sure that we don't pop in front of the modal window:
- [window orderFront:window];
- if (!top->testAttribute(Qt::WA_DontShowOnScreen)) {
- if (NSWindow *modalWin = qt_mac_window_for(top))
- [modalWin orderFront:window];
- }
- }
- setSubWindowStacking(true);
- qt_mac_update_cursor();
- if (q->windowType() == Qt::Popup) {
- qt_button_down = 0;
- if (q->focusWidget())
- q->focusWidget()->d_func()->setFocus_sys();
- else
- setFocus_sys();
- }
- toggleDrawers(true);
- }
- if (isCurrentlyMinimized) { //show in collapsed state
- [window miniaturize:window];
- } else if (!q->testAttribute(Qt::WA_ShowWithoutActivating)) {
- }
- } else if(topData()->embedded || !q->parentWidget() || q->parentWidget()->isVisible()) {
- if (NSView *view = qt_mac_nativeview_for(q)) {
- // INVARIANT: q is native. Just show the view:
- [view setHidden:NO];
- } else {
- // INVARIANT: q is alien. Update q instead:
- q->update();
- }
- }
-
- if ([NSApp isActive] && !qt_button_down && !QWidget::mouseGrabber()){
- // Update enter/leave immidiatly, don't wait for a move event. But only
- // if no grab exists (even if the grab points to this widget, it seems, ref X11)
- QPoint qlocal, qglobal;
- QWidget *widgetUnderMouse = 0;
- qt_mac_getTargetForMouseEvent(0, QEvent::Enter, qlocal, qglobal, 0, &widgetUnderMouse);
- QApplicationPrivate::dispatchEnterLeave(widgetUnderMouse, qt_last_mouse_receiver);
- qt_last_mouse_receiver = widgetUnderMouse;
- qt_last_native_mouse_receiver = widgetUnderMouse ?
- (widgetUnderMouse->internalWinId() ? widgetUnderMouse : widgetUnderMouse->nativeParentWidget()) : 0;
- }
-
- topLevelAt_cache = 0;
- qt_event_request_window_change(q);
-}
-
-QPoint qt_mac_nativeMapFromParent(const QWidget *child, const QPoint &pt)
-{
- NSPoint nativePoint = [qt_mac_nativeview_for(child) convertPoint:NSMakePoint(pt.x(), pt.y()) fromView:qt_mac_nativeview_for(child->parentWidget())];
- return QPoint(nativePoint.x, nativePoint.y);
-}
-
-
-void QWidgetPrivate::hide_sys()
-{
- Q_Q(QWidget);
- if((q->windowType() == Qt::Desktop)) //you can't hide the desktop!
- return;
- QMacCocoaAutoReleasePool pool;
- if(q->isWindow()) {
- setSubWindowStacking(false);
- OSWindowRef window = qt_mac_window_for(q);
- if(qt_mac_is_macsheet(q)) {
- [NSApp endSheet:window];
- [window orderOut:window];
- } else if(qt_mac_is_macdrawer(q)) {
- [qt_mac_drawer_for(q) close];
- } else {
- [window orderOut:window];
- // Unfortunately it is not as easy as just hiding the window, we need
- // to find out if we were in full screen mode. If we were and this is
- // the last window in full screen mode then we need to unset the full screen
- // mode. If this is not the last visible window in full screen mode then we
- // don't change the full screen mode.
- if(q->isFullScreen())
- {
- bool keepFullScreen = false;
- QWidgetList windowList = qApp->topLevelWidgets();
- int windowCount = windowList.count();
- for(int i = 0; i < windowCount; i++)
- {
- QWidget *w = windowList[i];
- // If it is the same window, we don't need to check :-)
- if(q == w)
- continue;
- // If they are not visible or if they are minimized then
- // we just ignore them.
- if(!w->isVisible() || w->isMinimized())
- continue;
- // Is it full screen?
- // Notice that if there is one window in full screen mode then we
- // cannot switch the full screen mode off, therefore we just abort.
- if(w->isFullScreen()) {
- keepFullScreen = true;
- break;
- }
- }
- // No windows in full screen mode, so let just unset that flag.
- if(!keepFullScreen)
- qt_mac_set_fullscreen_mode(false);
- }
- toggleDrawers(false);
- qt_mac_update_cursor();
- }
- } else {
- invalidateBuffer(q->rect());
- if (NSView *view = qt_mac_nativeview_for(q)) {
- // INVARIANT: q is native. Just hide the view:
- [view setHidden:YES];
- } else {
- // INVARIANT: q is alien. Repaint where q is placed instead:
- qt_mac_updateParentUnderAlienWidget(q);
- }
- }
-
- if ([NSApp isActive] && !qt_button_down && !QWidget::mouseGrabber()){
- // Update enter/leave immidiatly, don't wait for a move event. But only
- // if no grab exists (even if the grab points to this widget, it seems, ref X11)
- QPoint qlocal, qglobal;
- QWidget *widgetUnderMouse = 0;
- qt_mac_getTargetForMouseEvent(0, QEvent::Leave, qlocal, qglobal, 0, &widgetUnderMouse);
- QApplicationPrivate::dispatchEnterLeave(widgetUnderMouse, qt_last_native_mouse_receiver);
- qt_last_mouse_receiver = widgetUnderMouse;
- qt_last_native_mouse_receiver = widgetUnderMouse ?
- (widgetUnderMouse->internalWinId() ? widgetUnderMouse : widgetUnderMouse->nativeParentWidget()) : 0;
- }
-
- topLevelAt_cache = 0;
- qt_event_request_window_change(q);
- deactivateWidgetCleanup();
- qt_mac_event_release(q);
-}
-
-void QWidget::setWindowState(Qt::WindowStates newstate)
-{
- Q_D(QWidget);
- bool needShow = false;
- Qt::WindowStates oldstate = windowState();
- if (oldstate == newstate)
- return;
-
- QMacCocoaAutoReleasePool pool;
- bool needSendStateChange = true;
- if(isWindow()) {
- if((oldstate & Qt::WindowFullScreen) != (newstate & Qt::WindowFullScreen)) {
- if(newstate & Qt::WindowFullScreen) {
- if(QTLWExtra *tlextra = d->topData()) {
- if(tlextra->normalGeometry.width() < 0) {
- if(!testAttribute(Qt::WA_Resized))
- adjustSize();
- tlextra->normalGeometry = geometry();
- }
- tlextra->savedFlags = windowFlags();
- }
- needShow = isVisible();
- const QRect fullscreen(qApp->desktop()->screenGeometry(qApp->desktop()->screenNumber(this)));
- setParent(parentWidget(), Qt::Window | Qt::FramelessWindowHint | (windowFlags() & 0xffff0000)); //save
- setGeometry(fullscreen);
- if(!qApp->desktop()->screenNumber(this))
- qt_mac_set_fullscreen_mode(true);
- } else {
- needShow = isVisible();
- if(!qApp->desktop()->screenNumber(this))
- qt_mac_set_fullscreen_mode(false);
- setParent(parentWidget(), d->topData()->savedFlags);
- setGeometry(d->topData()->normalGeometry);
- d->topData()->normalGeometry.setRect(0, 0, -1, -1);
- }
- }
-
- d->createWinId();
-
- OSWindowRef window = qt_mac_window_for(this);
- if((oldstate & Qt::WindowMinimized) != (newstate & Qt::WindowMinimized)) {
- if (newstate & Qt::WindowMinimized) {
- [window miniaturize:window];
- } else {
- [window deminiaturize:window];
- }
- needSendStateChange = oldstate == windowState(); // Collapse didn't change our flags.
- }
-
- if((newstate & Qt::WindowMaximized) && !((newstate & Qt::WindowFullScreen))) {
- if(QTLWExtra *tlextra = d->topData()) {
- if(tlextra->normalGeometry.width() < 0) {
- if(!testAttribute(Qt::WA_Resized))
- adjustSize();
- tlextra->normalGeometry = geometry();
- }
- }
- } else if(!(newstate & Qt::WindowFullScreen)) {
-// d->topData()->normalGeometry = QRect(0, 0, -1, -1);
- }
-
-#ifdef DEBUG_WINDOW_STATE
-#define WSTATE(x) qDebug("%s -- %s --> %s", #x, (oldstate & x) ? "true" : "false", (newstate & x) ? "true" : "false")
- WSTATE(Qt::WindowMinimized);
- WSTATE(Qt::WindowMaximized);
- WSTATE(Qt::WindowFullScreen);
-#undef WSTATE
-#endif
- if(!(newstate & (Qt::WindowMinimized|Qt::WindowFullScreen)) &&
- ((oldstate & Qt::WindowFullScreen) || (oldstate & Qt::WindowMinimized) ||
- (oldstate & Qt::WindowMaximized) != (newstate & Qt::WindowMaximized))) {
- if(newstate & Qt::WindowMaximized) {
- data->fstrut_dirty = true;
- NSToolbar *toolbarRef = [window toolbar];
- if (toolbarRef && !isVisible() && ![toolbarRef isVisible]) {
- // HIToolbar, needs to be shown so that it's in the structure window
- // Typically this is part of a main window and will get shown
- // during the show, but it's will make the maximize all wrong.
- // ### Not sure this is right for NSToolbar...
- [toolbarRef setVisible:true];
-// ShowHideWindowToolbar(window, true, false);
- d->updateFrameStrut(); // In theory the dirty would work, but it's optimized out if the window is not visible :(
- }
- // Everything should be handled by Cocoa.
- [window zoom:window];
- needSendStateChange = oldstate == windowState(); // Zoom didn't change flags.
- } else if(oldstate & Qt::WindowMaximized && !(oldstate & Qt::WindowFullScreen)) {
- [window zoom:window];
- if(QTLWExtra *tlextra = d->topData()) {
- setGeometry(tlextra->normalGeometry);
- tlextra->normalGeometry.setRect(0, 0, -1, -1);
- }
- }
- }
- }
-
- data->window_state = newstate;
-
- if(needShow)
- show();
-
- if(newstate & Qt::WindowActive)
- activateWindow();
-
- qt_event_request_window_change(this);
- if (needSendStateChange) {
- QWindowStateChangeEvent e(oldstate);
- QApplication::sendEvent(this, &e);
- }
-}
-
-void QWidgetPrivate::setFocus_sys()
-{
- Q_Q(QWidget);
- if (q->testAttribute(Qt::WA_WState_Created)) {
- QMacCocoaAutoReleasePool pool;
- NSView *view = qt_mac_nativeview_for(q);
- [[view window] makeFirstResponder:view];
- }
-}
-
-NSComparisonResult compareViews2Raise(id view1, id view2, void *context)
-{
- id topView = reinterpret_cast<id>(context);
- if (view1 == topView)
- return NSOrderedDescending;
- if (view2 == topView)
- return NSOrderedAscending;
- return NSOrderedSame;
-}
-
-void QWidgetPrivate::raise_sys()
-{
- Q_Q(QWidget);
- if((q->windowType() == Qt::Desktop))
- return;
-
- QMacCocoaAutoReleasePool pool;
- if (isRealWindow()) {
- // With the introduction of spaces it is not as simple as just raising the window.
- // First we need to check if we are in the right space. If we are, then we just continue
- // as usual. The problem comes when we are not in the active space. There are two main cases:
- // 1. Our parent was moved to a new space. In this case we want the window to be raised
- // in the same space as its parent.
- // 2. We don't have a parent. For this case we will just raise the window and let Cocoa
- // switch to the corresponding space.
- // NOTICE: There are a lot of corner cases here. We are keeping this simple for now, if
- // required we will introduce special handling for some of them.
- if (!q->testAttribute(Qt::WA_DontShowOnScreen) && q->isVisible()) {
- OSWindowRef window = qt_mac_window_for(q);
- // isOnActiveSpace is available only from 10.6 onwards, so we need to check if it is
- // available before calling it.
- if([window respondsToSelector:@selector(isOnActiveSpace)]) {
- if(![window performSelector:@selector(isOnActiveSpace)]) {
- QWidget *parentWidget = q->parentWidget();
- if(parentWidget) {
- OSWindowRef parentWindow = qt_mac_window_for(parentWidget);
- if(parentWindow && [parentWindow respondsToSelector:@selector(isOnActiveSpace)]) {
- if ([parentWindow performSelector:@selector(isOnActiveSpace)]) {
- // The window was created in a different space. Therefore if we want
- // to show it in the current space we need to recreate it in the new
- // space.
- recreateMacWindow();
- window = qt_mac_window_for(q);
- }
- }
- }
- }
- }
- [window orderFront:window];
- }
- if (qt_mac_raise_process) { //we get to be the active process now
- ProcessSerialNumber psn;
- GetCurrentProcess(&psn);
- SetFrontProcessWithOptions(&psn, kSetFrontProcessFrontWindowOnly);
- }
- } else {
- NSView *view = qt_mac_nativeview_for(q);
- NSView *parentView = [view superview];
- [parentView sortSubviewsUsingFunction:compareViews2Raise context:reinterpret_cast<void *>(view)];
- }
- topLevelAt_cache = 0;
-}
-
-NSComparisonResult compareViews2Lower(id view1, id view2, void *context)
-{
- id topView = reinterpret_cast<id>(context);
- if (view1 == topView)
- return NSOrderedAscending;
- if (view2 == topView)
- return NSOrderedDescending;
- return NSOrderedSame;
-}
-
-void QWidgetPrivate::lower_sys()
-{
- Q_Q(QWidget);
- if((q->windowType() == Qt::Desktop))
- return;
- if (isRealWindow()) {
- OSWindowRef window = qt_mac_window_for(q);
- [window orderBack:window];
- } else {
- NSView *view = qt_mac_nativeview_for(q);
- NSView *parentView = [view superview];
- [parentView sortSubviewsUsingFunction:compareViews2Lower context:reinterpret_cast<void *>(view)];
- }
- topLevelAt_cache = 0;
-}
-
-NSComparisonResult compareViews2StackUnder(id view1, id view2, void *context)
-{
- const QHash<NSView *, int> &viewOrder = *reinterpret_cast<QHash<NSView *, int> *>(context);
- if (viewOrder[view1] < viewOrder[view2])
- return NSOrderedAscending;
- if (viewOrder[view1] > viewOrder[view2])
- return NSOrderedDescending;
- return NSOrderedSame;
-}
-
-void QWidgetPrivate::stackUnder_sys(QWidget *w)
-{
- // stackUnder
- Q_Q(QWidget);
- if(!w || q->isWindow() || (q->windowType() == Qt::Desktop))
- return;
- // Do the same trick as lower_sys() and put this widget before the widget passed in.
- NSView *myView = qt_mac_nativeview_for(q);
- NSView *wView = qt_mac_nativeview_for(w);
-
- QHash<NSView *, int> viewOrder;
- NSView *parentView = [myView superview];
- NSArray *subviews = [parentView subviews];
- NSUInteger index = 1;
- // make a hash of view->zorderindex and make sure z-value is always odd,
- // so that when we modify the order we create a new (even) z-value which
- // will not interfere with others.
- for (NSView *subview in subviews) {
- viewOrder.insert(subview, index * 2);
- ++index;
- }
- viewOrder[myView] = viewOrder[wView] - 1;
-
- [parentView sortSubviewsUsingFunction:compareViews2StackUnder context:reinterpret_cast<void *>(&viewOrder)];
-}
-
-
-/*
- Helper function for non-toplevel widgets. Helps to map Qt's 32bit
- coordinate system to OS X's 16bit coordinate system.
-
- Sets the geometry of the widget to data.crect, but clipped to sizes
- that OS X can handle. Unmaps widgets that are completely outside the
- valid range.
-
- Maintains data.wrect, which is the geometry of the OS X widget,
- measured in this widget's coordinate system.
-
- if the parent is not clipped, parentWRect is empty, otherwise
- parentWRect is the geometry of the parent's OS X rect, measured in
- parent's coord sys
-*/
-void QWidgetPrivate::setWSGeometry(bool dontShow, const QRect &oldRect)
-{
- Q_Q(QWidget);
- Q_ASSERT(q->testAttribute(Qt::WA_WState_Created));
-
- if (!q->internalWinId() && QApplicationPrivate::graphicsSystem() != 0) {
- // We have no view to move, and no paint engine that
- // we can update dirty regions on. So just return:
- return;
- }
-
- QMacCocoaAutoReleasePool pool;
-
- /*
- There are up to four different coordinate systems here:
- Qt coordinate system for this widget.
- X coordinate system for this widget (relative to wrect).
- Qt coordinate system for parent
- X coordinate system for parent (relative to parent's wrect).
- */
-
- // wrect is the same as crect, except that it is
- // clipped to fit inside parent (and screen):
- QRect wrect;
-
- // wrectInParentCoordSys will be the same as wrect, except that it is
- // originated in q's parent rather than q itself. It starts out in
- // parent's Qt coord system, and ends up in parent's coordinate system:
- QRect wrectInParentCoordSys = data.crect;
-
- // If q's parent has been clipped, parentWRect will
- // be filled with the parents clipped crect:
- QRect parentWRect;
-
- // Embedded have different meaning on each platform, and on
- // Mac, it means that q is a QMacNativeWidget.
- bool isEmbeddedWindow = (q->isWindow() && topData()->embedded);
- NSView *nsview = qt_mac_nativeview_for(q);
- if (!isEmbeddedWindow) {
- parentWRect = q->parentWidget()->data->wrect;
- } else {
- // INVARIANT: q's parent view is not owned by Qt. So we need to
- // do some extra calls to get the clipped rect of the parent view:
- NSView *parentView = [qt_mac_nativeview_for(q) superview];
- if (parentView) {
- NSRect tmpRect = [parentView frame];
- parentWRect = QRect(tmpRect.origin.x, tmpRect.origin.y,
- tmpRect.size.width, tmpRect.size.height);
- } else {
- const QRect wrectRange(-WRECT_MAX,-WRECT_MAX, 2*WRECT_MAX, 2*WRECT_MAX);
- parentWRect = wrectRange;
- }
- }
-
- if (parentWRect.isValid()) {
- // INVARIANT: q's parent has been clipped.
- // So we fit our own wrects inside it:
- if (!parentWRect.contains(wrectInParentCoordSys) && !isEmbeddedWindow) {
- wrectInParentCoordSys &= parentWRect;
- wrect = wrectInParentCoordSys;
- // Make sure wrect is originated in q's coordinate system:
- wrect.translate(-data.crect.topLeft());
- }
- // // Make sure wrectInParentCoordSys originated in q's parent coordinate system:
- wrectInParentCoordSys.translate(-parentWRect.topLeft());
- } else {
- // INVARIANT: we dont know yet the clipping rect of q's parent.
- // So we may or may not have to adjust our wrects:
-
- if (data.wrect.isValid() && QRect(QPoint(),data.crect.size()).contains(data.wrect)) {
- // This is where the main optimization is: we have an old wrect from an earlier
- // setGeometry call, and the new crect is smaller than it. If the final wrect is
- // also inside the old wrect, we can just move q and its children to the new
- // location without any clipping:
-
- // vrect will be the part of q that's will be visible inside
- // q's parent. If it inside the old wrect, then we can just move:
- QRect vrect = wrectInParentCoordSys & q->parentWidget()->rect();
- vrect.translate(-data.crect.topLeft());
-
- if (data.wrect.contains(vrect)) {
- wrectInParentCoordSys = data.wrect;
- wrectInParentCoordSys.translate(data.crect.topLeft());
- if (nsview) {
- // INVARIANT: q is native. Set view frame:
- NSRect bounds = NSMakeRect(wrectInParentCoordSys.x(), wrectInParentCoordSys.y(),
- wrectInParentCoordSys.width(), wrectInParentCoordSys.height());
- [nsview setFrame:bounds];
- } else {
- // INVARIANT: q is alien. Repaint wrect instead (includes old and new wrect):
- QWidget *parent = q->parentWidget();
- QPoint globalPosWRect = parent->mapToGlobal(data.wrect.topLeft());
-
- QWidget *nativeParent = q->nativeParentWidget();
- QRect dirtyWRect = QRect(nativeParent->mapFromGlobal(globalPosWRect), data.wrect.size());
-
- nativeParent->update(dirtyWRect);
- }
- if (q->testAttribute(Qt::WA_OutsideWSRange)) {
- q->setAttribute(Qt::WA_OutsideWSRange, false);
- if (!dontShow) {
- q->setAttribute(Qt::WA_Mapped);
- // If q is Alien, the following call does nothing:
- [nsview setHidden:NO];
- }
- }
- return;
- }
- }
-
- }
-
- // unmap if we are outside the valid window system coord system
- bool outsideRange = !wrectInParentCoordSys.isValid();
- bool mapWindow = false;
- if (q->testAttribute(Qt::WA_OutsideWSRange) != outsideRange) {
- q->setAttribute(Qt::WA_OutsideWSRange, outsideRange);
- if (outsideRange) {
- // If q is Alien, the following call does nothing:
- [nsview setHidden:YES];
- q->setAttribute(Qt::WA_Mapped, false);
- } else if (!q->isHidden()) {
- mapWindow = true;
- }
- }
-
- if (outsideRange)
- return;
-
- // Store the new clipped rect:
- bool jump = (data.wrect != wrect);
- data.wrect = wrect;
-
- // and now recursively for all children...
- // ### can be optimized
- for (int i = 0; i < children.size(); ++i) {
- QObject *object = children.at(i);
- if (object->isWidgetType()) {
- QWidget *w = static_cast<QWidget *>(object);
- if (!w->isWindow() && w->testAttribute(Qt::WA_WState_Created))
- w->d_func()->setWSGeometry();
- }
- }
-
- if (nsview) {
- // INVARIANT: q is native. Move the actual NSView:
- NSRect bounds = NSMakeRect(
- wrectInParentCoordSys.x(), wrectInParentCoordSys.y(),
- wrectInParentCoordSys.width(), wrectInParentCoordSys.height());
- [nsview setFrame:bounds];
- if (jump)
- q->update();
- } else if (QApplicationPrivate::graphicsSystem() == 0){
- // INVARIANT: q is alien and we use native paint engine.
- // Schedule updates where q is moved from and to:
- const QWidget *parent = q->parentWidget();
- const QPoint globalPosOldWRect = parent->mapToGlobal(oldRect.topLeft());
- const QPoint globalPosNewWRect = parent->mapToGlobal(wrectInParentCoordSys.topLeft());
-
- QWidget *nativeParent = q->nativeParentWidget();
- const QRegion dirtyOldWRect = QRect(nativeParent->mapFromGlobal(globalPosOldWRect), oldRect.size());
- const QRegion dirtyNewWRect = QRect(nativeParent->mapFromGlobal(globalPosNewWRect), wrectInParentCoordSys.size());
-
- const bool sizeUnchanged = oldRect.size() == wrectInParentCoordSys.size();
- const bool posUnchanged = oldRect.topLeft() == wrectInParentCoordSys.topLeft();
-
- // Resolve/minimize the region that needs to update:
- if (sizeUnchanged && q->testAttribute(Qt::WA_OpaquePaintEvent)) {
- // INVARIANT: q is opaque, and is only moved (not resized). So in theory we only
- // need to blit pixels, and skip a repaint. But we can only make this work if we
- // had access to the backbuffer, so we need to update all:
- nativeParent->update(dirtyOldWRect | dirtyNewWRect);
- } else if (posUnchanged && q->testAttribute(Qt::WA_StaticContents)) {
- // We only need to redraw exposed areas:
- nativeParent->update(dirtyNewWRect - dirtyOldWRect);
- } else {
- nativeParent->update(dirtyOldWRect | dirtyNewWRect);
- }
- }
-
- if (mapWindow && !dontShow) {
- q->setAttribute(Qt::WA_Mapped);
- // If q is Alien, the following call does nothing:
- [nsview setHidden:NO];
- }
-}
-
-void QWidgetPrivate::adjustWithinMaxAndMinSize(int &w, int &h)
-{
- if (QWExtra *extra = extraData()) {
- w = qMin(w, extra->maxw);
- h = qMin(h, extra->maxh);
- w = qMax(w, extra->minw);
- h = qMax(h, extra->minh);
-
- // Deal with size increment
- if (QTLWExtra *top = topData()) {
- if(top->incw) {
- w = w/top->incw;
- w *= top->incw;
- }
- if(top->inch) {
- h = h/top->inch;
- h *= top->inch;
- }
- }
- }
-
- if (isRealWindow()) {
- w = qMax(0, w);
- h = qMax(0, h);
- }
-}
-
-void QWidgetPrivate::applyMaxAndMinSizeOnWindow()
-{
- Q_Q(QWidget);
- QMacCocoaAutoReleasePool pool;
-
- const float max_f(20000);
-#define SF(x) ((x > max_f) ? max_f : x)
- NSSize max = NSMakeSize(SF(extra->maxw), SF(extra->maxh));
- NSSize min = NSMakeSize(SF(extra->minw), SF(extra->minh));
-#undef SF
- [qt_mac_window_for(q) setContentMinSize:min];
- [qt_mac_window_for(q) setContentMaxSize:max];
-}
-
-void QWidgetPrivate::setGeometry_sys(int x, int y, int w, int h, bool isMove)
-{
- Q_Q(QWidget);
- Q_ASSERT(q->testAttribute(Qt::WA_WState_Created));
-
- if(q->windowType() == Qt::Desktop)
- return;
-
- QMacCocoaAutoReleasePool pool;
- bool realWindow = isRealWindow();
-
- if (realWindow && !q->testAttribute(Qt::WA_DontShowOnScreen)){
- adjustWithinMaxAndMinSize(w, h);
- if (!isMove && !q->testAttribute(Qt::WA_Moved) && !q->isVisible()) {
- // INVARIANT: The location of the window has not yet been set. The default will
- // instead be to center it on the desktop, or over the parent, if any. Since we now
- // resize the window, we need to adjust the top left position to keep the window
- // centeralized. And we need to to this now (and before show) in case the positioning
- // of other windows (e.g. sub-windows) depend on this position:
- if (QWidget *p = q->parentWidget()) {
- x = p->geometry().center().x() - (w / 2);
- y = p->geometry().center().y() - (h / 2);
- } else {
- QRect availGeo = QApplication::desktop()->availableGeometry(q);
- x = availGeo.center().x() - (w / 2);
- y = availGeo.center().y() - (h / 2);
- }
- }
-
- QSize olds = q->size();
- const bool isResize = (olds != QSize(w, h));
- NSWindow *window = qt_mac_window_for(q);
- const QRect &fStrut = frameStrut();
- const QRect frameRect(QPoint(x - fStrut.left(), y - fStrut.top()),
- QSize(fStrut.left() + fStrut.right() + w,
- fStrut.top() + fStrut.bottom() + h));
- NSRect cocoaFrameRect = NSMakeRect(frameRect.x(), flipYCoordinate(frameRect.bottom() + 1),
- frameRect.width(), frameRect.height());
- // The setFrame call will trigger a 'windowDidResize' notification for the corresponding
- // NSWindow. The pending flag is set, so that the resize event can be send as non-spontaneous.
- if (isResize)
- q->setAttribute(Qt::WA_PendingResizeEvent);
- QPoint currTopLeft = data.crect.topLeft();
- if (currTopLeft.x() == x && currTopLeft.y() == y
- && cocoaFrameRect.size.width != 0
- && cocoaFrameRect.size.height != 0) {
- [window setFrame:cocoaFrameRect display:realWindow];
- } else {
- // The window is moved and resized (or resized to zero).
- // Since Cocoa usually only sends us a resize callback after
- // setting a window frame, we issue an explicit move as
- // well. To stop Cocoa from optimize away the move (since the move
- // would have the same origin as the setFrame call) we shift the
- // window back and forth inbetween.
- cocoaFrameRect.origin.y += 1;
- [window setFrame:cocoaFrameRect display:realWindow];
- cocoaFrameRect.origin.y -= 1;
- [window setFrameOrigin:cocoaFrameRect.origin];
- }
- } else {
- setGeometry_sys_helper(x, y, w, h, isMove);
- }
-
- topLevelAt_cache = 0;
-}
-
-void QWidgetPrivate::setGeometry_sys_helper(int x, int y, int w, int h, bool isMove)
-{
- Q_Q(QWidget);
- bool realWindow = isRealWindow();
-
- QPoint oldp = q->pos();
- QSize olds = q->size();
- // Apply size restrictions, applicable for Windows & Widgets.
- if (QWExtra *extra = extraData()) {
- w = qBound(extra->minw, w, extra->maxw);
- h = qBound(extra->minh, h, extra->maxh);
- }
- const bool isResize = (olds != QSize(w, h));
-
- if (!realWindow && !isResize && QPoint(x, y) == oldp)
- return;
-
- if (isResize)
- data.window_state = data.window_state & ~Qt::WindowMaximized;
-
- const bool visible = q->isVisible();
- data.crect = QRect(x, y, w, h);
-
- if (realWindow) {
- adjustWithinMaxAndMinSize(w, h);
- qt_mac_update_sizer(q);
-
- [qt_mac_nativeview_for(q) setFrame:NSMakeRect(0, 0, w, h)];
- } else {
- const QRect oldRect(oldp, olds);
- if (!isResize && QApplicationPrivate::graphicsSystem())
- moveRect(oldRect, x - oldp.x(), y - oldp.y());
-
- setWSGeometry(false, oldRect);
-
- if (isResize && QApplicationPrivate::graphicsSystem())
- invalidateBuffer_resizeHelper(oldp, olds);
- }
-
- if(isMove || isResize) {
- if(!visible) {
- if(isMove && q->pos() != oldp)
- q->setAttribute(Qt::WA_PendingMoveEvent, true);
- if(isResize)
- q->setAttribute(Qt::WA_PendingResizeEvent, true);
- } else {
- if(isResize) { //send the resize event..
- QResizeEvent e(q->size(), olds);
- QApplication::sendEvent(q, &e);
- }
- if(isMove && q->pos() != oldp) { //send the move event..
- QMoveEvent e(q->pos(), oldp);
- QApplication::sendEvent(q, &e);
- }
- }
- }
- qt_event_request_window_change(q);
-}
-
-void QWidgetPrivate::setConstraints_sys()
-{
- updateMaximizeButton_sys();
- applyMaxAndMinSizeOnWindow();
-}
-
-void QWidgetPrivate::updateMaximizeButton_sys()
-{
- Q_Q(QWidget);
- if (q->data->window_flags & Qt::CustomizeWindowHint)
- return;
-
- OSWindowRef window = qt_mac_window_for(q);
- QTLWExtra * tlwExtra = topData();
- QMacCocoaAutoReleasePool pool;
- NSButton *maximizeButton = [window standardWindowButton:NSWindowZoomButton];
- if (extra->maxw && extra->maxh
- && extra->maxw == extra->minw
- && extra->maxh == extra->minh) {
- // The window has a fixed size, so gray out the maximize button:
- if (!tlwExtra->savedWindowAttributesFromMaximized) {
- tlwExtra->savedWindowAttributesFromMaximized = (![maximizeButton isHidden] && [maximizeButton isEnabled]);
- }
- [maximizeButton setEnabled:NO];
-
-
- } else {
- if (tlwExtra->savedWindowAttributesFromMaximized) {
- [maximizeButton setEnabled:YES];
- tlwExtra->savedWindowAttributesFromMaximized = 0;
- }
- }
-
-
-}
-
-void QWidgetPrivate::scroll_sys(int dx, int dy)
-{
- if (QApplicationPrivate::graphicsSystem() && !paintOnScreen()) {
- // INVARIANT: Alien paint engine
- scrollChildren(dx, dy);
- scrollRect(q_func()->rect(), dx, dy);
- } else {
- scroll_sys(dx, dy, QRect());
- }
-}
-
-void QWidgetPrivate::scroll_sys(int dx, int dy, const QRect &qscrollRect)
-{
- if (QMacScrollOptimization::delayScroll(this, dx, dy, qscrollRect))
- return;
-
- Q_Q(QWidget);
- if (QApplicationPrivate::graphicsSystem() && !paintOnScreen()) {
- // INVARIANT: Alien paint engine
- scrollRect(qscrollRect, dx, dy);
- return;
- }
-
- static int accelEnv = -1;
- if (accelEnv == -1) {
- accelEnv = qgetenv("QT_NO_FAST_SCROLL").toInt() == 0;
- }
-
- // Scroll the whole widget if qscrollRect is not valid:
- QRect validScrollRect = qscrollRect.isValid() ? qscrollRect : q->rect();
- validScrollRect &= clipRect();
-
- // If q is overlapped by other widgets, we cannot just blit pixels since
- // this will move overlapping widgets as well. In case we just update:
- const bool overlapped = isOverlapped(validScrollRect.translated(data.crect.topLeft()));
- const bool accelerateScroll = accelEnv && isOpaque && !overlapped;
- const bool isAlien = (q->internalWinId() == 0);
- const QPoint scrollDelta(dx, dy);
-
- // If qscrollRect is valid, we are _not_ supposed to scroll q's children (as documented).
- // But we do scroll children (and the whole of q) if qscrollRect is invalid. This case is
- // documented as undefined, but we exploit it to help factor our code into one function.
- const bool scrollChildren = !qscrollRect.isValid();
-
- if (!q->updatesEnabled()) {
- // We are told not to update anything on q at this point. So unless
- // we are supposed to scroll children, we bail out early:
- if (!scrollChildren || q->children().isEmpty())
- return;
- }
-
- if (!accelerateScroll) {
- if (overlapped) {
- QRegion region(validScrollRect);
- subtractOpaqueSiblings(region);
- update_sys(region);
- }else {
- update_sys(qscrollRect);
- }
- return;
- }
-
- QMacCocoaAutoReleasePool pool;
-
- // First move all native children. Alien children will indirectly be
- // moved when the parent is scrolled. All directly or indirectly moved
- // children will receive a move event before the function call returns.
- QWidgetList movedChildren;
- if (scrollChildren) {
- QObjectList children = q->children();
-
- for (int i=0; i<children.size(); i++) {
- QObject *obj = children.at(i);
- if (QWidget *w = qobject_cast<QWidget*>(obj)) {
- if (!w->isWindow()) {
- w->data->crect = QRect(w->pos() + scrollDelta, w->size());
- if (NSView *view = qt_mac_nativeview_for(w)) {
- // INVARIANT: w is not alien
- [view setFrame:NSMakeRect(
- w->data->crect.x(), w->data->crect.y(),
- w->data->crect.width(), w->data->crect.height())];
- }
- movedChildren.append(w);
- }
- }
- }
- }
-
- if (q->testAttribute(Qt::WA_WState_Created) && q->isVisible()) {
- // Scroll q itself according to the qscrollRect, and
- // call update on any exposed areas so that they get redrawn:
-
-
- QWidget *nativeWidget = isAlien ? q->nativeParentWidget() : q;
- if (!nativeWidget)
- return;
- OSViewRef view = qt_mac_nativeview_for(nativeWidget);
- if (!view)
- return;
-
- // Calculate the rectangles that needs to be redrawn
- // after the scroll. This will be source rect minus destination rect:
- QRect deltaXRect;
- if (dx != 0) {
- deltaXRect.setY(validScrollRect.y());
- deltaXRect.setHeight(validScrollRect.height());
- if (dx > 0) {
- deltaXRect.setX(validScrollRect.x());
- deltaXRect.setWidth(dx);
- } else {
- deltaXRect.setX(validScrollRect.x() + validScrollRect.width() + dx);
- deltaXRect.setWidth(-dx);
- }
- }
-
- QRect deltaYRect;
- if (dy != 0) {
- deltaYRect.setX(validScrollRect.x());
- deltaYRect.setWidth(validScrollRect.width());
- if (dy > 0) {
- deltaYRect.setY(validScrollRect.y());
- deltaYRect.setHeight(dy);
- } else {
- deltaYRect.setY(validScrollRect.y() + validScrollRect.height() + dy);
- deltaYRect.setHeight(-dy);
- }
- }
-
- if (isAlien) {
- // Adjust the scroll rect to the location as seen from the native parent:
- QPoint scrollTopLeftInsideNative = nativeWidget->mapFromGlobal(q->mapToGlobal(validScrollRect.topLeft()));
- validScrollRect.moveTo(scrollTopLeftInsideNative);
- }
-
- // Make the pixel copy rect within the validScrollRect bounds:
- NSRect nsscrollRect = NSMakeRect(
- validScrollRect.x() + (dx < 0 ? -dx : 0),
- validScrollRect.y() + (dy < 0 ? -dy : 0),
- validScrollRect.width() + (dx > 0 ? -dx : 0),
- validScrollRect.height() + (dy > 0 ? -dy : 0));
-
- NSSize deltaSize = NSMakeSize(dx, dy);
- [view scrollRect:nsscrollRect by:deltaSize];
-
- // Some areas inside the scroll rect might have been marked as dirty from before, which
- // means that they are scheduled to be redrawn. But as we now scroll, those dirty rects
- // should also move along to ensure that q receives repaints on the correct places.
- // Since some of the dirty rects might lay outside, or only intersect with, the scroll
- // rect, the old calls to setNeedsDisplay still makes sense.
- // NB: Using [view translateRectsNeedingDisplayInRect:nsscrollRect by:deltaSize] have
- // so far not been proven fruitful to solve this problem.
- const QVector<QRect> &dirtyRectsToScroll = dirtyOnWidget.rects();
- for (int i=0; i<dirtyRectsToScroll.size(); ++i) {
- QRect qdirtyRect = dirtyRectsToScroll[i];
- qdirtyRect.translate(dx, dy);
- update_sys(qdirtyRect);
- }
-
- // Update newly exposed areas. This will generate new dirty areas on
- // q, and therefore, we do it after updating the old dirty rects above:
- if (dx != 0)
- update_sys(deltaXRect);
- if (dy != 0)
- update_sys(deltaYRect);
-
- }
-
- for (int i=0; i<movedChildren.size(); i++) {
- QWidget *w = movedChildren.at(i);
- QMoveEvent e(w->pos(), w->pos() - scrollDelta);
- QApplication::sendEvent(w, &e);
- }
-}
-
-int QWidget::metric(PaintDeviceMetric m) const
-{
- switch(m) {
- case PdmHeightMM:
- return qRound(metric(PdmHeight) * 25.4 / qreal(metric(PdmDpiY)));
- case PdmWidthMM:
- return qRound(metric(PdmWidth) * 25.4 / qreal(metric(PdmDpiX)));
- case PdmHeight:
- case PdmWidth:
- if (m == PdmWidth)
- return data->crect.width();
- else
- return data->crect.height();
- case PdmDepth:
- return 32;
- case PdmNumColors:
- return INT_MAX;
- case PdmDpiX:
- case PdmPhysicalDpiX: {
- Q_D(const QWidget);
- if (d->extra && d->extra->customDpiX)
- return d->extra->customDpiX;
- else if (d->parent)
- return static_cast<QWidget *>(d->parent)->metric(m);
- extern float qt_mac_defaultDpi_x(); //qpaintdevice_mac.cpp
- return int(qt_mac_defaultDpi_x()); }
- case PdmDpiY:
- case PdmPhysicalDpiY: {
- Q_D(const QWidget);
- if (d->extra && d->extra->customDpiY)
- return d->extra->customDpiY;
- else if (d->parent)
- return static_cast<QWidget *>(d->parent)->metric(m);
- extern float qt_mac_defaultDpi_y(); //qpaintdevice_mac.cpp
- return int(qt_mac_defaultDpi_y()); }
- default: //leave this so the compiler complains when new ones are added
- qWarning("QWidget::metric: Unhandled parameter %d", m);
- return QPaintDevice::metric(m);
- }
- return 0;
-}
-
-void QWidgetPrivate::createSysExtra()
-{
- extra->imageMask = 0;
-}
-
-void QWidgetPrivate::deleteSysExtra()
-{
- if (extra->imageMask)
- CFRelease(extra->imageMask);
-}
-
-void QWidgetPrivate::createTLSysExtra()
-{
- extra->topextra->resizer = 0;
- extra->topextra->isSetGeometry = 0;
- extra->topextra->isMove = 0;
- extra->topextra->wattr = 0;
- extra->topextra->wclass = 0;
- extra->topextra->group = 0;
- extra->topextra->windowIcon = 0;
- extra->topextra->savedWindowAttributesFromMaximized = 0;
-}
-
-void QWidgetPrivate::deleteTLSysExtra()
-{
-}
-
-void QWidgetPrivate::updateFrameStrut()
-{
- Q_Q(QWidget);
-
- QWidgetPrivate *that = const_cast<QWidgetPrivate*>(this);
-
- that->data.fstrut_dirty = false;
- QTLWExtra *top = that->topData();
-
- // 1 Get the window frame
- OSWindowRef oswnd = qt_mac_window_for(q);
- NSRect frameW = [oswnd frame];
- // 2 Get the content frame - so now
- NSRect frameC = [oswnd contentRectForFrameRect:frameW];
- top->frameStrut.setCoords(frameC.origin.x - frameW.origin.x,
- (frameW.origin.y + frameW.size.height) - (frameC.origin.y + frameC.size.height),
- (frameW.origin.x + frameW.size.width) - (frameC.origin.x + frameC.size.width),
- frameC.origin.y - frameW.origin.y);
-}
-
-void QWidgetPrivate::registerDropSite(bool on)
-{
- Q_Q(QWidget);
- if (!q->testAttribute(Qt::WA_WState_Created))
- return;
- NSWindow *win = qt_mac_window_for(q);
- if (on) {
- if ([win isKindOfClass:[QT_MANGLE_NAMESPACE(QCocoaWindow) class]])
- [static_cast<QT_MANGLE_NAMESPACE(QCocoaWindow) *>(win) registerDragTypes];
- else if ([win isKindOfClass:[QT_MANGLE_NAMESPACE(QCocoaPanel) class]])
- [static_cast<QT_MANGLE_NAMESPACE(QCocoaPanel) *>(win) registerDragTypes];
- }
-}
-
-void QWidgetPrivate::registerTouchWindow(bool enable)
-{
- Q_UNUSED(enable);
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
- if (QSysInfo::MacintoshVersion < QSysInfo::MV_10_6)
- return;
-
- Q_Q(QWidget);
- if (enable == touchEventsEnabled)
- return;
-
- QT_MANGLE_NAMESPACE(QCocoaView) *view = static_cast<QT_MANGLE_NAMESPACE(QCocoaView) *>(qt_mac_effectiveview_for(q));
- if (!view)
- return;
-
- if (enable) {
- ++view->alienTouchCount;
- if (view->alienTouchCount == 1) {
- touchEventsEnabled = true;
- [view setAcceptsTouchEvents:YES];
- }
- } else {
- --view->alienTouchCount;
- if (view->alienTouchCount == 0) {
- touchEventsEnabled = false;
- [view setAcceptsTouchEvents:NO];
- }
- }
-#endif
-}
-
-void QWidgetPrivate::setMask_sys(const QRegion &region)
-{
- Q_UNUSED(region);
- Q_Q(QWidget);
-
- if (!q->internalWinId())
- return;
-
- if (extra->mask.isEmpty()) {
- extra->maskBits = QImage();
- finishCocoaMaskSetup();
- } else {
- syncCocoaMask();
- }
-
- topLevelAt_cache = 0;
-}
-
-void QWidgetPrivate::setWindowOpacity_sys(qreal level)
-{
- Q_Q(QWidget);
-
- if (!q->isWindow())
- return;
-
- level = qBound(0.0, level, 1.0);
- topData()->opacity = (uchar)(level * 255);
- if (!q->testAttribute(Qt::WA_WState_Created))
- return;
-
- OSWindowRef oswindow = qt_mac_window_for(q);
- [oswindow setAlphaValue:level];
-}
-
-void QWidgetPrivate::syncCocoaMask()
-{
- Q_Q(QWidget);
- if (!q->testAttribute(Qt::WA_WState_Created) || !extra)
- return;
-
- if (extra->hasMask) {
- if(extra->maskBits.size() != q->size()) {
- extra->maskBits = QImage(q->size(), QImage::Format_Mono);
- }
- extra->maskBits.fill(QColor(Qt::color1).rgba());
- extra->maskBits.setNumColors(2);
- extra->maskBits.setColor(0, QColor(Qt::color0).rgba());
- extra->maskBits.setColor(1, QColor(Qt::color1).rgba());
- QPainter painter(&extra->maskBits);
- painter.setBrush(Qt::color1);
- painter.setPen(Qt::NoPen);
- painter.drawRects(extra->mask.rects());
- painter.end();
- finishCocoaMaskSetup();
- }
-}
-
-void QWidgetPrivate::finishCocoaMaskSetup()
-{
- Q_Q(QWidget);
-
- if (!q->testAttribute(Qt::WA_WState_Created) || !extra)
- return;
-
- // Technically this is too late to release, because the data behind the image
- // has already been released. But it's more tidy to do it here.
- // If you are seeing a crash, consider doing a CFRelease before changing extra->maskBits.
- if (extra->imageMask) {
- CFRelease(extra->imageMask);
- extra->imageMask = 0;
- }
-
- if (!extra->maskBits.isNull()) {
- QCFType<CGDataProviderRef> dataProvider = CGDataProviderCreateWithData(0,
- extra->maskBits.bits(),
- extra->maskBits.numBytes(),
- 0); // shouldn't need to release.
- CGFloat decode[2] = {1, 0};
- extra->imageMask = CGImageMaskCreate(extra->maskBits.width(), extra->maskBits.height(),
- 1, 1, extra->maskBits.bytesPerLine(), dataProvider,
- decode, false);
- }
- if (q->isWindow()) {
- NSWindow *window = qt_mac_window_for(q);
- [window setOpaque:(extra->imageMask == 0)];
- [window invalidateShadow];
- }
- macSetNeedsDisplay(QRegion());
-}
-
-struct QPaintEngineCleanupHandler
-{
- inline QPaintEngineCleanupHandler() : engine(0) {}
- inline ~QPaintEngineCleanupHandler() { delete engine; }
- QPaintEngine *engine;
-};
-
-Q_GLOBAL_STATIC(QPaintEngineCleanupHandler, engineHandler)
-
-QPaintEngine *QWidget::paintEngine() const
-{
- QPaintEngine *&pe = engineHandler()->engine;
- if (!pe)
- pe = new QCoreGraphicsPaintEngine();
- if (pe->isActive()) {
- QPaintEngine *engine = new QCoreGraphicsPaintEngine();
- engine->setAutoDestruct(true);
- return engine;
- }
- return pe;
-}
-
-void QWidgetPrivate::setModal_sys()
-{
- Q_Q(QWidget);
- if (!q->testAttribute(Qt::WA_WState_Created) || !q->isWindow())
- return;
- const QWidget * const windowParent = q->window()->parentWidget();
- const QWidget * const primaryWindow = windowParent ? windowParent->window() : 0;
- OSWindowRef windowRef = qt_mac_window_for(q);
-
- QMacCocoaAutoReleasePool pool;
- bool alreadySheet = [windowRef styleMask] & NSDocModalWindowMask;
-
- if (windowParent && q->windowModality() == Qt::WindowModal){
- // INVARIANT: Window should be window-modal (which implies a sheet).
- if (!alreadySheet) {
- // NB: the following call will call setModal_sys recursivly:
- recreateMacWindow();
- windowRef = qt_mac_window_for(q);
- }
- if ([windowRef isKindOfClass:[NSPanel class]]){
- // If the primary window of the sheet parent is a child of a modal dialog,
- // the sheet parent should not be modally shaddowed.
- // This goes for the sheet as well:
- OSWindowRef ref = primaryWindow ? qt_mac_window_for(primaryWindow) : 0;
- bool isDialog = ref ? [ref isKindOfClass:[NSPanel class]] : false;
- bool worksWhenModal = isDialog ? [static_cast<NSPanel *>(ref) worksWhenModal] : false;
- if (worksWhenModal)
- [static_cast<NSPanel *>(windowRef) setWorksWhenModal:YES];
- }
- } else {
- // INVARIANT: Window shold _not_ be window-modal (and as such, not a sheet).
- if (alreadySheet){
- // NB: the following call will call setModal_sys recursivly:
- recreateMacWindow();
- windowRef = qt_mac_window_for(q);
- }
- if (q->windowModality() == Qt::NonModal
- && primaryWindow && primaryWindow->windowModality() == Qt::ApplicationModal) {
- // INVARIANT: Our window has a parent that is application modal.
- // This means that q is supposed to be on top of this window and
- // not be modally shaddowed:
- if ([windowRef isKindOfClass:[NSPanel class]])
- [static_cast<NSPanel *>(windowRef) setWorksWhenModal:YES];
- }
- }
-
-}
-
-void QWidgetPrivate::macUpdateHideOnSuspend()
-{
- Q_Q(QWidget);
- if (!q->testAttribute(Qt::WA_WState_Created) || !q->isWindow() || q->windowType() != Qt::Tool)
- return;
- if(q->testAttribute(Qt::WA_MacAlwaysShowToolWindow))
- [qt_mac_window_for(q) setHidesOnDeactivate:NO];
- else
- [qt_mac_window_for(q) setHidesOnDeactivate:YES];
-}
-
-void QWidgetPrivate::macUpdateOpaqueSizeGrip()
-{
- Q_Q(QWidget);
-
- if (!q->testAttribute(Qt::WA_WState_Created) || !q->isWindow())
- return;
-
-}
-
-void QWidgetPrivate::macUpdateSizeAttribute()
-{
- Q_Q(QWidget);
- QEvent event(QEvent::MacSizeChange);
- QApplication::sendEvent(q, &event);
- for (int i = 0; i < children.size(); ++i) {
- QWidget *w = qobject_cast<QWidget *>(children.at(i));
- if (w && (!w->isWindow() || w->testAttribute(Qt::WA_WindowPropagation))
- && !q->testAttribute(Qt::WA_MacMiniSize) // no attribute set? inherit from parent
- && !w->testAttribute(Qt::WA_MacSmallSize)
- && !w->testAttribute(Qt::WA_MacNormalSize))
- w->d_func()->macUpdateSizeAttribute();
- }
- resolveFont();
-}
-
-void QWidgetPrivate::macUpdateIgnoreMouseEvents()
-{
-}
-
-void QWidgetPrivate::macUpdateMetalAttribute()
-{
- Q_Q(QWidget);
- bool realWindow = isRealWindow();
- if (!q->testAttribute(Qt::WA_WState_Created) || !realWindow)
- return;
-
- if (realWindow) {
- // Cocoa doesn't let us change the style mask once it's been changed
- // So, that means we need to recreate the window.
- OSWindowRef cocoaWindow = qt_mac_window_for(q);
- if ([cocoaWindow styleMask] & NSTexturedBackgroundWindowMask)
- return;
- recreateMacWindow();
- }
-}
-
-void QWidgetPrivate::setEnabled_helper_sys(bool enable)
-{
- Q_Q(QWidget);
- NSView *view = qt_mac_nativeview_for(q);
- if ([view isKindOfClass:[NSControl class]])
- [static_cast<NSControl *>(view) setEnabled:enable];
-}
-
-QT_END_NAMESPACE
diff --git a/src/widgets/statemachine/qbasickeyeventtransition.cpp b/src/widgets/statemachine/qbasickeyeventtransition.cpp
index fca11eb036..8119787f50 100644
--- a/src/widgets/statemachine/qbasickeyeventtransition.cpp
+++ b/src/widgets/statemachine/qbasickeyeventtransition.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/statemachine/qbasickeyeventtransition_p.h b/src/widgets/statemachine/qbasickeyeventtransition_p.h
index 379c151e60..cae270ba4a 100644
--- a/src/widgets/statemachine/qbasickeyeventtransition_p.h
+++ b/src/widgets/statemachine/qbasickeyeventtransition_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/statemachine/qbasicmouseeventtransition.cpp b/src/widgets/statemachine/qbasicmouseeventtransition.cpp
index c05b262b66..e0451e876f 100644
--- a/src/widgets/statemachine/qbasicmouseeventtransition.cpp
+++ b/src/widgets/statemachine/qbasicmouseeventtransition.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/statemachine/qbasicmouseeventtransition_p.h b/src/widgets/statemachine/qbasicmouseeventtransition_p.h
index 98a8f28ca8..c53ef9ce77 100644
--- a/src/widgets/statemachine/qbasicmouseeventtransition_p.h
+++ b/src/widgets/statemachine/qbasicmouseeventtransition_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/statemachine/qguistatemachine.cpp b/src/widgets/statemachine/qguistatemachine.cpp
index 928bbd5a53..465da1e2ba 100644
--- a/src/widgets/statemachine/qguistatemachine.cpp
+++ b/src/widgets/statemachine/qguistatemachine.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -183,10 +183,6 @@ static QEvent *cloneEvent(QEvent *e)
return new QInputMethodEvent(*static_cast<QInputMethodEvent*>(e));
case QEvent::AccessibilityPrepare:
return new QEvent(*e);
-#ifndef QT_NO_TABLETEVENT
- case QEvent::TabletMove:
- return new QTabletEvent(*static_cast<QTabletEvent*>(e));
-#endif //QT_NO_TABLETEVENT
case QEvent::LocaleChange:
return new QEvent(*e);
case QEvent::LanguageChange:
@@ -196,8 +192,8 @@ static QEvent *cloneEvent(QEvent *e)
case QEvent::Style:
return new QEvent(*e);
#ifndef QT_NO_TABLETEVENT
+ case QEvent::TabletMove:
case QEvent::TabletPress:
- return new QTabletEvent(*static_cast<QTabletEvent*>(e));
case QEvent::TabletRelease:
return new QTabletEvent(*static_cast<QTabletEvent*>(e));
#endif //QT_NO_TABLETEVENT
diff --git a/src/widgets/statemachine/qkeyeventtransition.cpp b/src/widgets/statemachine/qkeyeventtransition.cpp
index 175d4924a9..6367174255 100644
--- a/src/widgets/statemachine/qkeyeventtransition.cpp
+++ b/src/widgets/statemachine/qkeyeventtransition.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/statemachine/qkeyeventtransition.h b/src/widgets/statemachine/qkeyeventtransition.h
index b22a4e0934..d6ceaa8703 100644
--- a/src/widgets/statemachine/qkeyeventtransition.h
+++ b/src/widgets/statemachine/qkeyeventtransition.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -48,7 +48,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
#ifndef QT_NO_STATEMACHINE
diff --git a/src/widgets/statemachine/qmouseeventtransition.cpp b/src/widgets/statemachine/qmouseeventtransition.cpp
index 60c2c85159..4a5553e058 100644
--- a/src/widgets/statemachine/qmouseeventtransition.cpp
+++ b/src/widgets/statemachine/qmouseeventtransition.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/statemachine/qmouseeventtransition.h b/src/widgets/statemachine/qmouseeventtransition.h
index bdd64c5f3f..6ba39c659f 100644
--- a/src/widgets/statemachine/qmouseeventtransition.h
+++ b/src/widgets/statemachine/qmouseeventtransition.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -48,7 +48,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
#ifndef QT_NO_STATEMACHINE
diff --git a/src/widgets/styles/qcdestyle.cpp b/src/widgets/styles/qcdestyle.cpp
index 518461c279..f7cf3b2fba 100644
--- a/src/widgets/styles/qcdestyle.cpp
+++ b/src/widgets/styles/qcdestyle.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/styles/qcdestyle.h b/src/widgets/styles/qcdestyle.h
index b5293d30f3..fa9ec099d5 100644
--- a/src/widgets/styles/qcdestyle.h
+++ b/src/widgets/styles/qcdestyle.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -49,7 +49,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
#if !defined(QT_NO_STYLE_CDE)
diff --git a/src/widgets/styles/qcleanlooksstyle.cpp b/src/widgets/styles/qcleanlooksstyle.cpp
index 42f9b38bd4..67b3c59b29 100644
--- a/src/widgets/styles/qcleanlooksstyle.cpp
+++ b/src/widgets/styles/qcleanlooksstyle.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/styles/qcleanlooksstyle.h b/src/widgets/styles/qcleanlooksstyle.h
index 94b3aa889c..cd37eadb1e 100644
--- a/src/widgets/styles/qcleanlooksstyle.h
+++ b/src/widgets/styles/qcleanlooksstyle.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -48,7 +48,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
#if !defined(QT_NO_STYLE_CLEANLOOKS)
diff --git a/src/widgets/styles/qcleanlooksstyle_p.h b/src/widgets/styles/qcleanlooksstyle_p.h
index d9968bb531..ad7e00ef81 100644
--- a/src/widgets/styles/qcleanlooksstyle_p.h
+++ b/src/widgets/styles/qcleanlooksstyle_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/styles/qcommonstyle.cpp b/src/widgets/styles/qcommonstyle.cpp
index c874770fdb..db783d14d4 100644
--- a/src/widgets/styles/qcommonstyle.cpp
+++ b/src/widgets/styles/qcommonstyle.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/styles/qcommonstyle.h b/src/widgets/styles/qcommonstyle.h
index e023c702da..6fe7411413 100644
--- a/src/widgets/styles/qcommonstyle.h
+++ b/src/widgets/styles/qcommonstyle.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -47,7 +47,6 @@
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
class QCommonStylePrivate;
diff --git a/src/widgets/styles/qcommonstyle_p.h b/src/widgets/styles/qcommonstyle_p.h
index 10a9cd875a..0c783324e2 100644
--- a/src/widgets/styles/qcommonstyle_p.h
+++ b/src/widgets/styles/qcommonstyle_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/styles/qcommonstylepixmaps_p.h b/src/widgets/styles/qcommonstylepixmaps_p.h
index 73c183d485..decfac637f 100644
--- a/src/widgets/styles/qcommonstylepixmaps_p.h
+++ b/src/widgets/styles/qcommonstylepixmaps_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/styles/qdrawutil.cpp b/src/widgets/styles/qdrawutil.cpp
index fd8a272851..15788e34f5 100644
--- a/src/widgets/styles/qdrawutil.cpp
+++ b/src/widgets/styles/qdrawutil.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/styles/qdrawutil.h b/src/widgets/styles/qdrawutil.h
index 74347b09c1..611c1fb8bd 100644
--- a/src/widgets/styles/qdrawutil.h
+++ b/src/widgets/styles/qdrawutil.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -50,7 +50,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
class QPainter;
class QPalette;
diff --git a/src/widgets/styles/qgtkpainter.cpp b/src/widgets/styles/qgtkpainter.cpp
index a9d1ed2281..3d8cb98135 100644
--- a/src/widgets/styles/qgtkpainter.cpp
+++ b/src/widgets/styles/qgtkpainter.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/styles/qgtkpainter_p.h b/src/widgets/styles/qgtkpainter_p.h
index b0874d2315..ff512f2894 100644
--- a/src/widgets/styles/qgtkpainter_p.h
+++ b/src/widgets/styles/qgtkpainter_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/styles/qgtkstyle.cpp b/src/widgets/styles/qgtkstyle.cpp
index 30e1371354..87d335baad 100644
--- a/src/widgets/styles/qgtkstyle.cpp
+++ b/src/widgets/styles/qgtkstyle.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/styles/qgtkstyle.h b/src/widgets/styles/qgtkstyle.h
index 26665dcd51..38a6e15db2 100644
--- a/src/widgets/styles/qgtkstyle.h
+++ b/src/widgets/styles/qgtkstyle.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -51,7 +51,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
#if !defined(QT_NO_STYLE_GTK)
diff --git a/src/widgets/styles/qgtkstyle_p.cpp b/src/widgets/styles/qgtkstyle_p.cpp
index f3b41e0ba1..40ad9f2a95 100644
--- a/src/widgets/styles/qgtkstyle_p.cpp
+++ b/src/widgets/styles/qgtkstyle_p.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/styles/qgtkstyle_p.h b/src/widgets/styles/qgtkstyle_p.h
index 656a187ded..95988fa8b1 100644
--- a/src/widgets/styles/qgtkstyle_p.h
+++ b/src/widgets/styles/qgtkstyle_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/styles/qmacstyle.qdoc b/src/widgets/styles/qmacstyle.qdoc
index 97baf80e9d..d48a65c41f 100644
--- a/src/widgets/styles/qmacstyle.qdoc
+++ b/src/widgets/styles/qmacstyle.qdoc
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -21,6 +20,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/styles/qmacstyle_mac.h b/src/widgets/styles/qmacstyle_mac.h
index 7a3a4248b3..b42f0e36f2 100644
--- a/src/widgets/styles/qmacstyle_mac.h
+++ b/src/widgets/styles/qmacstyle_mac.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -48,7 +48,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
#if defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC)
diff --git a/src/widgets/styles/qmacstyle_mac.mm b/src/widgets/styles/qmacstyle_mac.mm
index ca9b5cf234..09cb9cc016 100644
--- a/src/widgets/styles/qmacstyle_mac.mm
+++ b/src/widgets/styles/qmacstyle_mac.mm
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -44,6 +44,8 @@
.../doc/src/qstyles.qdoc.
*/
+#include <Cocoa/Cocoa.h>
+
#include "qmacstyle_mac.h"
#include "qmacstyle_mac_p.h"
#include "qmacstylepixmaps_mac_p.h"
@@ -2103,7 +2105,7 @@ void QMacStyle::unpolish(QWidget* w)
}
}
- if (QRubberBand *rubber = ::qobject_cast<QRubberBand*>(w)) {
+ if (QRubberBand *rubber = qobject_cast<QRubberBand*>(w)) {
rubber->setWindowOpacity(1.0);
rubber->setAttribute(Qt::WA_PaintOnScreen, true);
rubber->setAttribute(Qt::WA_NoSystemBackground, true);
@@ -3536,7 +3538,7 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
QCommonStyle::drawControl(ce, opt, p, w);
break;
case CE_PushButtonBevel:
- if (const QStyleOptionButton *btn = ::qstyleoption_cast<const QStyleOptionButton *>(opt)) {
+ if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(opt)) {
if (!(btn->state & (State_Raised | State_Sunken | State_On)))
break;
diff --git a/src/widgets/styles/qmacstyle_mac_p.h b/src/widgets/styles/qmacstyle_mac_p.h
index 1739a382f3..8f7edd51d5 100644
--- a/src/widgets/styles/qmacstyle_mac_p.h
+++ b/src/widgets/styles/qmacstyle_mac_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/styles/qmacstylepixmaps_mac_p.h b/src/widgets/styles/qmacstylepixmaps_mac_p.h
index 3f852a63f3..1a293d9f3c 100644
--- a/src/widgets/styles/qmacstylepixmaps_mac_p.h
+++ b/src/widgets/styles/qmacstylepixmaps_mac_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/styles/qmotifstyle.cpp b/src/widgets/styles/qmotifstyle.cpp
index fc697454c1..331b70f153 100644
--- a/src/widgets/styles/qmotifstyle.cpp
+++ b/src/widgets/styles/qmotifstyle.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -2254,25 +2254,6 @@ static const char * const qt_minimize_xpm[] = {
" ",
" "};
-#if 0 // ### not used???
-static const char * const qt_normalize_xpm[] = {
- "12 12 2 1",
- " s None c None",
- ". c black",
- " ",
- " ",
- " . ",
- " .. ",
- " ... ",
- " .... ",
- " ..... ",
- " ...... ",
- " ....... ",
- " ",
- " ",
- " "};
-#endif
-
static const char * const qt_normalizeup_xpm[] = {
"12 12 2 1",
" s None c None",
diff --git a/src/widgets/styles/qmotifstyle.h b/src/widgets/styles/qmotifstyle.h
index 0aa506d2ac..fa957f392a 100644
--- a/src/widgets/styles/qmotifstyle.h
+++ b/src/widgets/styles/qmotifstyle.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -49,7 +49,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
#if !defined(QT_NO_STYLE_MOTIF)
diff --git a/src/widgets/styles/qmotifstyle_p.h b/src/widgets/styles/qmotifstyle_p.h
index 83394059e8..76a6a1035d 100644
--- a/src/widgets/styles/qmotifstyle_p.h
+++ b/src/widgets/styles/qmotifstyle_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/styles/qplastiquestyle.cpp b/src/widgets/styles/qplastiquestyle.cpp
index 750d0765ef..79893f066d 100644
--- a/src/widgets/styles/qplastiquestyle.cpp
+++ b/src/widgets/styles/qplastiquestyle.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -3784,10 +3784,9 @@ void QPlastiqueStyle::drawComplexControl(ComplexControl control, const QStyleOpt
if (!QPixmapCache::find(handlePixmapName, cache)) {
cache = QPixmap(handle.size());
- cache.fill(Qt::white);
+ cache.fill(Qt::transparent);
QRect pixmapRect(0, 0, handle.width(), handle.height());
QPainter handlePainter(&cache);
- handlePainter.fillRect(pixmapRect, option->palette.background());
// draw handle
if (horizontal) {
diff --git a/src/widgets/styles/qplastiquestyle.h b/src/widgets/styles/qplastiquestyle.h
index 837e07a75f..3247f66811 100644
--- a/src/widgets/styles/qplastiquestyle.h
+++ b/src/widgets/styles/qplastiquestyle.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -48,7 +48,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
#if !defined(QT_NO_STYLE_PLASTIQUE)
diff --git a/src/widgets/styles/qproxystyle.cpp b/src/widgets/styles/qproxystyle.cpp
index 56e3dc56b4..5bcd83a6ea 100644
--- a/src/widgets/styles/qproxystyle.cpp
+++ b/src/widgets/styles/qproxystyle.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/styles/qproxystyle.h b/src/widgets/styles/qproxystyle.h
index e5d05eb3e5..87839e1278 100644
--- a/src/widgets/styles/qproxystyle.h
+++ b/src/widgets/styles/qproxystyle.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -48,7 +48,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
#if !defined(QT_NO_STYLE_PROXY)
diff --git a/src/widgets/styles/qproxystyle_p.h b/src/widgets/styles/qproxystyle_p.h
index 3dc960afcd..24504e3d3b 100644
--- a/src/widgets/styles/qproxystyle_p.h
+++ b/src/widgets/styles/qproxystyle_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/styles/qstyle.cpp b/src/widgets/styles/qstyle.cpp
index e4000bef19..3ff5aea0ca 100644
--- a/src/widgets/styles/qstyle.cpp
+++ b/src/widgets/styles/qstyle.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -1594,7 +1594,7 @@ void QStyle::drawItemPixmap(QPainter *painter, const QRect &rect, int alignment,
\value RSIP_OnMouseClick Requests an input panel if the user clicks on the
widget.
- \sa QEvent::RequestSoftwareInputPanel, QInputContext
+ \sa QInputMethod
*/
/*!
diff --git a/src/widgets/styles/qstyle.h b/src/widgets/styles/qstyle.h
index fcc8412414..a8ec8c8c3e 100644
--- a/src/widgets/styles/qstyle.h
+++ b/src/widgets/styles/qstyle.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -54,7 +54,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
class QAction;
class QDebug;
diff --git a/src/widgets/styles/qstyle_p.h b/src/widgets/styles/qstyle_p.h
index 3fd221938d..3da4c458d2 100644
--- a/src/widgets/styles/qstyle_p.h
+++ b/src/widgets/styles/qstyle_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/styles/qstylefactory.cpp b/src/widgets/styles/qstylefactory.cpp
index cc19a895d0..ef555fbdb1 100644
--- a/src/widgets/styles/qstylefactory.cpp
+++ b/src/widgets/styles/qstylefactory.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -69,9 +69,6 @@
#ifndef QT_NO_STYLE_WINDOWSMOBILE
#include "qwindowsmobilestyle.h"
#endif
-#ifndef QT_NO_STYLE_S60
-#include "qs60style.h"
-#endif
QT_BEGIN_NAMESPACE
@@ -158,11 +155,6 @@ QStyle *QStyleFactory::create(const QString& key)
ret = new QCDEStyle;
else
#endif
-#ifndef QT_NO_STYLE_S60
- if (style == QLatin1String("s60"))
- ret = new QS60Style;
- else
-#endif
#ifndef QT_NO_STYLE_PLASTIQUE
if (style == QLatin1String("plastique"))
ret = new QPlastiqueStyle;
@@ -242,10 +234,6 @@ QStringList QStyleFactory::keys()
if (!list.contains(QLatin1String("CDE")))
list << QLatin1String("CDE");
#endif
-#ifndef QT_NO_STYLE_S60
- if (!list.contains(QLatin1String("S60")))
- list << QLatin1String("S60");
-#endif
#ifndef QT_NO_STYLE_PLASTIQUE
if (!list.contains(QLatin1String("Plastique")))
list << QLatin1String("Plastique");
diff --git a/src/widgets/styles/qstylefactory.h b/src/widgets/styles/qstylefactory.h
index f98d37b26e..3551e62613 100644
--- a/src/widgets/styles/qstylefactory.h
+++ b/src/widgets/styles/qstylefactory.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -48,7 +48,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
class QStyle;
diff --git a/src/widgets/styles/qstylehelper.cpp b/src/widgets/styles/qstylehelper.cpp
index 8f2d7364c1..818671f85f 100644
--- a/src/widgets/styles/qstylehelper.cpp
+++ b/src/widgets/styles/qstylehelper.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/styles/qstylehelper_p.h b/src/widgets/styles/qstylehelper_p.h
index a193e2ec78..a7bc64abcd 100644
--- a/src/widgets/styles/qstylehelper_p.h
+++ b/src/widgets/styles/qstylehelper_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/styles/qstyleoption.cpp b/src/widgets/styles/qstyleoption.cpp
index 0e4a1e98f8..63e7b8775e 100644
--- a/src/widgets/styles/qstyleoption.cpp
+++ b/src/widgets/styles/qstyleoption.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -110,12 +110,12 @@ QT_BEGIN_NAMESPACE
\value SO_Default QStyleOption
\value SO_DockWidget \l QStyleOptionDockWidget
\value SO_FocusRect \l QStyleOptionFocusRect
- \value SO_Frame \l QStyleOptionFrame \l QStyleOptionFrameV2
+ \value SO_Frame \l QStyleOptionFrame
\value SO_GraphicsItem \l QStyleOptionGraphicsItem
\value SO_GroupBox \l QStyleOptionGroupBox
\value SO_Header \l QStyleOptionHeader
\value SO_MenuItem \l QStyleOptionMenuItem
- \value SO_ProgressBar \l QStyleOptionProgressBar \l QStyleOptionProgressBarV2
+ \value SO_ProgressBar \l QStyleOptionProgressBar
\value SO_RubberBand \l QStyleOptionRubberBand
\value SO_SizeGrip \l QStyleOptionSizeGrip
\value SO_Slider \l QStyleOptionSlider
@@ -455,13 +455,11 @@ QStyleOptionFocusRect::QStyleOptionFocusRect(int version)
\inmodule QtWidgets
QStyleOptionFrame is used for drawing several built-in Qt widgets,
- including QFrame, QGroupBox, QLineEdit, and QMenu. Note that to
- describe the parameters necessary for drawing a frame in Qt 4.1 or
- above, you must use the QStyleOptionFrameV2 subclass.
+ including QFrame, QGroupBox, QLineEdit, and QMenu.
An instance of the QStyleOptionFrame class has
\l{QStyleOption::type} {type} SO_Frame and \l{QStyleOption::version}
- {version} 1.
+ {version} 3.
The type is used internally by QStyleOption, its subclasses, and
qstyleoption_cast() to determine the type of style option. In
@@ -471,13 +469,24 @@ QStyleOptionFocusRect::QStyleOptionFocusRect(int version)
without breaking compatibility. If you use qstyleoption_cast(),
you normally do not need to check it.
- If you create your own QStyle subclass, you should handle both
- QStyleOptionFrame and QStyleOptionFrameV2.
-
For an example demonstrating how style options can be used, see
the \l {widgets/styles}{Styles} example.
- \sa QStyleOptionFrameV2, QStyleOption
+ \sa QStyleOption
+*/
+
+/*!
+ \typedef QStyleOptionFrameV2
+ \relates QStyleOptionFrame
+
+ Synonym for QStyleOptionFrame.
+*/
+
+/*!
+ \typedef QStyleOptionFrameV3
+ \relates QStyleOptionFrame
+
+ Synonym for QStyleOptionFrame.
*/
/*!
@@ -486,7 +495,8 @@ QStyleOptionFocusRect::QStyleOptionFocusRect(int version)
*/
QStyleOptionFrame::QStyleOptionFrame()
- : QStyleOption(Version, SO_Frame), lineWidth(0), midLineWidth(0)
+ : QStyleOption(Version, SO_Frame), lineWidth(0), midLineWidth(0),
+ features(None), frameShape(QFrame::NoFrame)
{
}
@@ -494,7 +504,8 @@ QStyleOptionFrame::QStyleOptionFrame()
\internal
*/
QStyleOptionFrame::QStyleOptionFrame(int version)
- : QStyleOption(version, SO_Frame), lineWidth(0), midLineWidth(0)
+ : QStyleOption(version, SO_Frame), lineWidth(0), midLineWidth(0),
+ features(None), frameShape(QFrame::NoFrame)
{
}
@@ -526,7 +537,7 @@ QStyleOptionFrame::QStyleOptionFrame(int version)
This enum is used to hold information about the version of the style option, and
is defined for each QStyleOption subclass.
- \value Version 1
+ \value Version 3
The version is used by QStyleOption subclasses to implement
extensions without breaking compatibility. If you use
@@ -556,110 +567,7 @@ QStyleOptionFrame::QStyleOptionFrame(int version)
*/
/*!
- \class QStyleOptionFrameV2
- \brief The QStyleOptionFrameV2 class is used to describe the
- parameters necessary for drawing a frame in Qt 4.1 or above.
-
- \since 4.1
- \inmodule QtWidgets
-
- QStyleOptionFrameV2 inherits QStyleOptionFrame which is used for
- drawing several built-in Qt widgets, including QFrame, QGroupBox,
- QLineEdit, and QMenu.
-
- An instance of the QStyleOptionFrameV2 class has
- \l{QStyleOption::type} {type} SO_Frame and
- \l{QStyleOption::version} {version} 2. The type is used
- internally by QStyleOption, its subclasses, and
- qstyleoption_cast() to determine the type of style option. In
- general you do not need to worry about this unless you want to
- create your own QStyleOption subclass and your own styles. The
- version is used by QStyleOption subclasses to implement extensions
- without breaking compatibility. If you use qstyleoption_cast(),
- you normally do not need to check it.
-
- If you create your own QStyle subclass, you should handle both
- QStyleOptionFrame and QStyleOptionFrameV2. One way to achieve this
- is to use the QStyleOptionFrameV2 copy constructor. For example:
-
- \snippet doc/src/snippets/qstyleoption/main.cpp 1
-
- In the example above: If the \c frameOption's version is 1, \l
- FrameFeature is set to \l None for \c frameOptionV2. If \c
- frameOption's version is 2, the constructor will simply copy the
- \c frameOption's \l FrameFeature value.
-
- For an example demonstrating how style options can be used, see
- the \l {widgets/styles}{Styles} example.
-
- \sa QStyleOptionFrame, QStyleOption
-*/
-
-/*!
- Constructs a QStyleOptionFrameV2 object.
-*/
-QStyleOptionFrameV2::QStyleOptionFrameV2()
- : QStyleOptionFrame(Version), features(None)
-{
-}
-
-/*!
- \fn QStyleOptionFrameV2::QStyleOptionFrameV2(const QStyleOptionFrameV2 &other)
-
- Constructs a QStyleOptionFrameV2 copy of the \a other style option.
-*/
-
-/*!
- \internal
-*/
-QStyleOptionFrameV2::QStyleOptionFrameV2(int version)
- : QStyleOptionFrame(version), features(None)
-{
-}
-
-/*!
- Constructs a QStyleOptionFrameV2 copy of the \a other style option
- which can be either of the QStyleOptionFrameV2 or
- QStyleOptionFrame types.
-
- If the \a other style option's version is 1, the new style option's \l
- FrameFeature value is set to \l QStyleOptionFrameV2::None. If its
- version is 2, its \l FrameFeature value is simply copied to the
- new style option.
-
- \sa version
-*/
-QStyleOptionFrameV2::QStyleOptionFrameV2(const QStyleOptionFrame &other)
-{
- QStyleOptionFrame::operator=(other);
-
- const QStyleOptionFrameV2 *f2 = qstyleoption_cast<const QStyleOptionFrameV2 *>(&other);
- features = f2 ? f2->features : FrameFeatures(QStyleOptionFrameV2::None);
- version = Version;
-}
-
-/*!
- Assigns the \a other style option to this style option. The \a
- other style option can be either of the QStyleOptionFrameV2 or
- QStyleOptionFrame types.
-
- If the \a{other} style option's version is 1, this style option's
- \l FrameFeature value is set to \l QStyleOptionFrameV2::None. If
- its version is 2, its \l FrameFeature value is simply copied to
- this style option.
-*/
-QStyleOptionFrameV2 &QStyleOptionFrameV2::operator=(const QStyleOptionFrame &other)
-{
- QStyleOptionFrame::operator=(other);
-
- const QStyleOptionFrameV2 *f2 = qstyleoption_cast<const QStyleOptionFrameV2 *>(&other);
- features = f2 ? f2->features : FrameFeatures(QStyleOptionFrameV2::None);
- version = Version;
- return *this;
-}
-
-/*!
- \enum QStyleOptionFrameV2::FrameFeature
+ \enum QStyleOptionFrame::FrameFeature
This enum describes the different types of features a frame can have.
@@ -668,503 +576,20 @@ QStyleOptionFrameV2 &QStyleOptionFrameV2::operator=(const QStyleOptionFrame &oth
*/
/*!
- \variable QStyleOptionFrameV2::features
+ \variable QStyleOptionFrame::features
\brief a bitwise OR of the features that describe this frame.
\sa FrameFeature
*/
/*!
- \enum QStyleOptionFrameV2::StyleOptionVersion
-
- This enum is used to hold information about the version of the
- style option, and is defined for each QStyleOption subclass.
-
- \value Version 2
-
- The version is used by QStyleOption subclasses to implement
- extensions without breaking compatibility. If you use
- qstyleoption_cast(), you normally do not need to check it.
-
- \sa StyleOptionType
-*/
-
-/*!
- \class QStyleOptionFrameV3
- \brief The QStyleOptionFrameV3 class is used to describe the
- parameters necessary for drawing a frame in Qt 4.1 or above.
-
- \since 4.5
- \inmodule QtWidgets
-
- QStyleOptionFrameV3 inherits QStyleOptionFrameV2
-
- An instance of the QStyleOptionFrameV3 class has
- \l{QStyleOption::type} {type} SO_Frame and
- \l{QStyleOption::version} {version} 3. The type is used
- internally by QStyleOption, its subclasses, and
- qstyleoption_cast() to determine the type of style option. In
- general you do not need to worry about this unless you want to
- create your own QStyleOption subclass and your own styles. The
- version is used by QStyleOption subclasses to implement extensions
- without breaking compatibility. If you use qstyleoption_cast(),
- you normally do not need to check it.
-
- \sa QStyleOptionFrameV2, QStyleOption
-*/
-
-/*!
- Constructs a QStyleOptionFrameV3 object.
-*/
-QStyleOptionFrameV3::QStyleOptionFrameV3()
- : QStyleOptionFrameV2(Version), frameShape(QFrame::NoFrame), unused(0)
-{
-}
-
-/*!
- \fn QStyleOptionFrameV3::QStyleOptionFrameV3(const QStyleOptionFrameV3 &other)
-
- Constructs a QStyleOptionFrameV3 copy of the \a other style option.
-*/
-
-/*!
- \internal
-*/
-QStyleOptionFrameV3::QStyleOptionFrameV3(int version)
- : QStyleOptionFrameV2(version), frameShape(QFrame::NoFrame), unused(0)
-{
-}
-
-/*!
- Constructs a QStyleOptionFrameV3 copy of the \a other style option
- which can be either of the QStyleOptionFrameV3 or
- QStyleOptionFrame types.
-
- If the \a other style option's version is 1, the new style
- option's \l FrameFeature value is set to
- \l{QStyleOptionFrameV2::None}. If its version is 2 or lower,
- \l{QStyleOptionFrameV3::frameShape} value is QFrame::NoFrame
-
- \sa version
-*/
-QStyleOptionFrameV3::QStyleOptionFrameV3(const QStyleOptionFrame &other)
-{
- operator=(other);
-}
-
-/*!
- Assigns the \a other style option to this style option. The \a
- other style option can be either of the QStyleOptionFrameV3,
- QStyleOptionFrameV2 or QStyleOptionFrame types.
-
- If the \a other style option's version is 1, the new style
- option's \l FrameFeature value is set to
- \l{QStyleOptionFrameV2::None}. If its version is 2 or lower,
- \l{QStyleOptionFrameV3::frameShape} value is QFrame::NoFrame
-*/
-QStyleOptionFrameV3 &QStyleOptionFrameV3::operator=(const QStyleOptionFrame &other)
-{
- QStyleOptionFrameV2::operator=(other);
-
- const QStyleOptionFrameV3 *f3 = qstyleoption_cast<const QStyleOptionFrameV3 *>(&other);
- frameShape = f3 ? f3->frameShape : QFrame::NoFrame;
- version = Version;
- return *this;
-}
-
-
-/*!
- \variable QStyleOptionFrameV3::frameShape
+ \variable QStyleOptionFrame::frameShape
\brief This property holds the frame shape value of the frame.
\sa QFrame::frameShape
*/
/*!
- \enum QStyleOptionFrameV3::StyleOptionVersion
-
- This enum is used to hold information about the version of the style option, and
- is defined for each QStyleOption subclass.
-
- \value Version 3
-
- The version is used by QStyleOption subclasses to implement
- extensions without breaking compatibility. If you use
- qstyleoption_cast(), you normally do not need to check it.
-
- \sa StyleOptionType
-*/
-
-/*!
- \class QStyleOptionViewItemV2
- \brief The QStyleOptionViewItemV2 class is used to describe the
- parameters necessary for drawing a frame in Qt 4.2 or above.
- \since 4.2
- \inmodule QtWidgets
-
- QStyleOptionViewItemV2 inherits QStyleOptionViewItem.
-
- An instance of the QStyleOptionViewItemV2 class has
- \l{QStyleOption::type} {type} SO_ViewItem and
- \l{QStyleOption::version} {version} 2. The type is used internally
- by QStyleOption, its subclasses, and qstyleoption_cast() to
- determine the type of style option. In general you do not need to
- worry about this unless you want to create your own QStyleOption
- subclass and your own styles. The version is used by QStyleOption
- subclasses to implement extensions without breaking
- compatibility. If you use qstyleoption_cast(), you normally do not
- need to check it.
-
- See QStyleOptionFrameV2's detailed description for a discussion
- of how to handle "V2" classes.
-
- \sa QStyleOptionViewItem, QStyleOption
-*/
-
-/*!
- \enum QStyleOptionViewItemV2::StyleOptionVersion
-
- This enum is used to hold information about the version of the
- style option, and is defined for each QStyleOption subclass.
-
- \value Version 2
-
- The version is used by QStyleOption subclasses to implement
- extensions without breaking compatibility. If you use
- qstyleoption_cast(), you normally do not need to check it.
-
- \sa StyleOptionType
-*/
-
-/*!
- \variable QStyleOptionViewItemV2::features
- \brief a bitwise OR of the features that describe this view item
-
- \sa ViewItemFeature
-*/
-
-/*!
- Constructs a QStyleOptionViewItemV2 object.
-*/
-QStyleOptionViewItemV2::QStyleOptionViewItemV2()
- : QStyleOptionViewItem(Version), features(None)
-{
-}
-
-/*!
- \fn QStyleOptionViewItemV2::QStyleOptionViewItemV2(const QStyleOptionViewItemV2 &other)
-
- Constructs a copy of \a other.
-*/
-
-/*!
- Constructs a QStyleOptionViewItemV2 copy of the \a other style option
- which can be either of the QStyleOptionViewItemV2 or
- QStyleOptionViewItem types.
-
- If the \a other style option's version is 1, the new style option's \l
- ViewItemFeature value is set to \l QStyleOptionViewItemV2::None. If its
- version is 2, its \l ViewItemFeature value is simply copied to the
- new style option.
-
- \sa version
-*/
-QStyleOptionViewItemV2::QStyleOptionViewItemV2(const QStyleOptionViewItem &other)
- : QStyleOptionViewItem(Version)
-{
- (void)QStyleOptionViewItemV2::operator=(other);
-}
-
-/*!
- \internal
-*/
-QStyleOptionViewItemV2::QStyleOptionViewItemV2(int version)
- : QStyleOptionViewItem(version)
-{
-
-}
-
-/*!
- Assigns the \a other style option to this style option. The \a
- other style option can be either of the QStyleOptionViewItemV2 or
- QStyleOptionViewItem types.
-
- If the \a{other} style option's version is 1, this style option's
- \l ViewItemFeature value is set to \l QStyleOptionViewItemV2::None.
- If its version is 2, its \l ViewItemFeature value is simply copied
- to this style option.
-*/
-QStyleOptionViewItemV2 &QStyleOptionViewItemV2::operator=(const QStyleOptionViewItem &other)
-{
- QStyleOptionViewItem::operator=(other);
- const QStyleOptionViewItemV2 *v2 = qstyleoption_cast<const QStyleOptionViewItemV2 *>(&other);
- features = v2 ? v2->features : ViewItemFeatures(QStyleOptionViewItemV2::None);
- return *this;
-}
-
-/*!
- \enum QStyleOptionViewItemV2::ViewItemFeature
-
- This enum describes the different types of features an item can have.
-
- \value None Indicates a normal item.
- \value WrapText Indicates an item with wrapped text.
- \value Alternate Indicates that the item's background is rendered using alternateBase.
- \value HasCheckIndicator Indicates that the item has a check state indicator.
- \value HasDisplay Indicates that the item has a display role.
- \value HasDecoration Indicates that the item has a decoration role.
-*/
-
-
-
-/*!
- \class QStyleOptionViewItemV3
- \brief The QStyleOptionViewItemV3 class is used to describe the
- parameters necessary for drawing a frame in Qt 4.3 or above.
- \since 4.3
- \inmodule QtWidgets
-
- QStyleOptionViewItemV3 inherits QStyleOptionViewItem.
-
- An instance of the QStyleOptionViewItemV3 class has
- \l{QStyleOption::type} {type} SO_ViewItem and \l{QStyleOption::version}
- {version} 3. The type is used internally by QStyleOption, its subclasses,
- and qstyleoption_cast() to determine the type of style option. In general
- you do not need to worry about this unless you want to create your own
- QStyleOption subclass and your own styles. The version is used by
- QStyleOption subclasses to implement extensions without breaking
- compatibility. If you use qstyleoption_cast(), you normally do not need to
- check it.
-
- See QStyleOptionFrameV2's detailed description for a discussion
- of how to handle "V2" and other versioned classes.
-
- \sa QStyleOptionViewItem, QStyleOption
-*/
-
-/*!
- \enum QStyleOptionViewItemV3::StyleOptionVersion
-
- This enum is used to hold information about the version of the
- style option, and is defined for each QStyleOption subclass.
-
- \value Version 3
-
- The version is used by QStyleOption subclasses to implement
- extensions without breaking compatibility. If you use
- qstyleoption_cast(), you normally do not need to check it.
-
- \sa StyleOptionType
-*/
-
-/*!
- Constructs a QStyleOptionViewItemV3 object.
-*/
-QStyleOptionViewItemV3::QStyleOptionViewItemV3()
- : QStyleOptionViewItemV2(Version), widget(0)
-{
-}
-
-/*!
- Constructs a copy of \a other.
-*/
-QStyleOptionViewItemV3::QStyleOptionViewItemV3(const QStyleOptionViewItem &other)
- : QStyleOptionViewItemV2(Version), widget(0)
-{
- (void)QStyleOptionViewItemV3::operator=(other);
-}
-
-/*!
- \fn QStyleOptionViewItemV3::QStyleOptionViewItemV3(const QStyleOptionViewItemV3 &other)
-
- Constructs a copy of \a other.
-*/
-
-/*!
- Assigns the \a other style option to this style option. The \a
- other style option can be an instance of the QStyleOptionViewItemV2,
- QStyleOptionViewItemV3 or QStyleOptionViewItem types.
-*/
-QStyleOptionViewItemV3 &QStyleOptionViewItemV3::operator = (const QStyleOptionViewItem &other)
-{
- QStyleOptionViewItemV2::operator=(other);
- const QStyleOptionViewItemV3 *v3 = qstyleoption_cast<const QStyleOptionViewItemV3*>(&other);
- locale = v3 ? v3->locale : QLocale();
- widget = v3 ? v3->widget : 0;
- return *this;
-}
-
-/*!
- \internal
-*/
-QStyleOptionViewItemV3::QStyleOptionViewItemV3(int version)
- : QStyleOptionViewItemV2(version), widget(0)
-{
-}
-
-#ifndef QT_NO_ITEMVIEWS
-
-/*!
- \class QStyleOptionViewItemV4
- \brief The QStyleOptionViewItemV4 class is used to describe the
- parameters necessary for drawing a frame in Qt 4.4 or above.
- \since 4.4
- \inmodule QtWidgets
-
- QStyleOptionViewItemV4 inherits QStyleOptionViewItemV3.
-
- An instance of the QStyleOptionViewItemV4 class has
- \l{QStyleOption::type} {type} SO_ViewItem and
- \l{QStyleOption::version} {version} 4. The type is used internally
- by QStyleOption, its subclasses, and qstyleoption_cast() to
- determine the type of style option. In general you do not need to
- worry about this unless you want to create your own QStyleOption
- subclass and your own styles. The version is used by QStyleOption
- subclasses to implement extensions without breaking
- compatibility. If you use qstyleoption_cast(), you normally do not
- need to check it.
-
- See QStyleOptionViewItemV3's detailed description for a discussion
- of how to handle "V3" classes.
-
- \sa QStyleOptionViewItem, QStyleOption
-*/
-
-/*!
- \variable QStyleOptionViewItemV4::index
-
- The model index that is to be drawn.
-*/
-
-/*!
- \variable QStyleOptionViewItemV4::checkState
-
- If this view item is checkable, i.e.,
- ViewItemFeature::HasCheckIndicator is true, \c checkState is true
- if the item is checked; otherwise, it is false.
-
-*/
-
-/*!
- \variable QStyleOptionViewItemV4::icon
-
- The icon (if any) to be drawn in the view item.
-*/
-
-
-/*!
- \variable QStyleOptionViewItemV4::text
-
- The text (if any) to be drawn in the view item.
-*/
-
-/*!
- \variable QStyleOptionViewItemV4::backgroundBrush
-
- The QBrush that should be used to paint the view items
- background.
-*/
-
-/*!
- \variable QStyleOptionViewItemV4::viewItemPosition
-
- Gives the position of this view item relative to other items. See
- the \l{QStyleOptionViewItemV4::}{ViewItemPosition} enum for the
- details.
-*/
-
-/*!
- \enum QStyleOptionViewItemV4::StyleOptionVersion
-
- This enum is used to hold information about the version of the
- style option, and is defined for each QStyleOption subclass.
-
- \value Version 4
-
- The version is used by QStyleOption subclasses to implement
- extensions without breaking compatibility. If you use
- qstyleoption_cast(), you normally do not need to check it.
-
- \sa StyleOptionType
-*/
-
-/*!
- \enum QStyleOptionViewItemV4::ViewItemPosition
-
- This enum is used to represent the placement of the item on
- a row. This can be used to draw items differently depending
- on their placement, for example by putting rounded edges at
- the beginning and end, and straight edges in between.
-
- \value Invalid The ViewItemPosition is unknown and should be
- disregarded.
- \value Beginning The item appears at the beginning of the row.
- \value Middle The item appears in the middle of the row.
- \value End The item appears at the end of the row.
- \value OnlyOne The item is the only one on the row, and is
- therefore both at the beginning and the end.
-*/
-
-
-/*!
- Constructs a QStyleOptionViewItemV4 object.
-*/
-QStyleOptionViewItemV4::QStyleOptionViewItemV4()
-: QStyleOptionViewItemV3(Version), checkState(Qt::Unchecked), viewItemPosition(QStyleOptionViewItemV4::Invalid)
-{
-}
-
-/*!
- \fn QStyleOptionViewItemV4::QStyleOptionViewItemV4(const QStyleOptionViewItemV4 &other)
-
- Constructs a copy of \a other.
-*/
-
-/*!
- Constructs a QStyleOptionViewItemV4 copy of the \a other style option
- which can be either of the QStyleOptionViewItemV3 or
- QStyleOptionViewItem types.
-
- \sa version
-*/
-QStyleOptionViewItemV4::QStyleOptionViewItemV4(const QStyleOptionViewItem &other)
- : QStyleOptionViewItemV3(Version)
-{
- (void)QStyleOptionViewItemV4::operator=(other);
-}
-
-/*!
- Assigns the \a other style option to this style option. The \a
- other style option can be either of the QStyleOptionViewItemV3 or
- QStyleOptionViewItem types.
-*/
-QStyleOptionViewItemV4 &QStyleOptionViewItemV4::operator = (const QStyleOptionViewItem &other)
-{
- QStyleOptionViewItemV3::operator=(other);
- if (const QStyleOptionViewItemV4 *v4 = qstyleoption_cast<const QStyleOptionViewItemV4*>(&other)) {
- index = v4->index;
- checkState = v4->checkState;
- text = v4->text;
- viewItemPosition = v4->viewItemPosition;
- backgroundBrush = v4->backgroundBrush;
- icon = v4->icon;
- } else {
- viewItemPosition = QStyleOptionViewItemV4::Invalid;
- checkState = Qt::Unchecked;
- }
- return *this;
-}
-
-/*!
- \internal
-*/
-QStyleOptionViewItemV4::QStyleOptionViewItemV4(int version)
- : QStyleOptionViewItemV3(version)
-{
-}
-#endif // QT_NO_ITEMVIEWS
-
-/*!
\class QStyleOptionGroupBox
\brief The QStyleOptionGroupBox class describes the parameters for
drawing a group box.
@@ -1264,7 +689,7 @@ QStyleOptionViewItemV4::QStyleOptionViewItemV4(int version)
The frame is flat by default.
- \sa QStyleOptionFrameV2::FrameFeature
+ \sa QStyleOptionFrame::FrameFeature
*/
/*!
@@ -1281,7 +706,7 @@ QStyleOptionViewItemV4::QStyleOptionViewItemV4(int version)
variables to their default values.
*/
QStyleOptionGroupBox::QStyleOptionGroupBox()
- : QStyleOptionComplex(Version, Type), features(QStyleOptionFrameV2::None),
+ : QStyleOptionComplex(Version, Type), features(QStyleOptionFrame::None),
textAlignment(Qt::AlignLeft), lineWidth(0), midLineWidth(0)
{
}
@@ -1296,7 +721,7 @@ QStyleOptionGroupBox::QStyleOptionGroupBox()
\internal
*/
QStyleOptionGroupBox::QStyleOptionGroupBox(int version)
- : QStyleOptionComplex(version, Type), features(QStyleOptionFrameV2::None),
+ : QStyleOptionComplex(version, Type), features(QStyleOptionFrame::None),
textAlignment(Qt::AlignLeft), lineWidth(0), midLineWidth(0)
{
}
@@ -1808,13 +1233,11 @@ QStyleOptionToolBar::QStyleOptionToolBar(int version)
\inmodule QtWidgets
The QStyleOptionTab class is used for drawing several built-in Qt
- widgets including \l QTabBar and the panel for \l QTabWidget. Note
- that to describe the parameters necessary for drawing a frame in
- Qt 4.1 or above, you must use the QStyleOptionFrameV2 subclass.
+ widgets including \l QTabBar and the panel for \l QTabWidget.
- An instance of the QStyleOptiontabV2 class has
+ An instance of the QStyleOptionTab class has
\l{QStyleOption::type} {type} \l SO_Tab and
- \l{QStyleOption::version} {version} 1. The type is used internally
+ \l{QStyleOption::version} {version} 3. The type is used internally
by QStyleOption, its subclasses, and qstyleoption_cast() to
determine the type of style option. In general you do not need to
worry about this unless you want to create your own QStyleOption
@@ -1823,13 +1246,24 @@ QStyleOptionToolBar::QStyleOptionToolBar(int version)
compatibility. If you use qstyleoption_cast(), you normally do not
need to check it.
- If you create your own QStyle subclass, you should handle both
- QStyleOptionTab and QStyleOptionTabV2.
-
For an example demonstrating how style options can be used, see
the \l {widgets/styles}{Styles} example.
- \sa QStyleOptionTabV2, QStyleOption
+ \sa QStyleOption
+*/
+
+/*!
+ \typedef QStyleOptionTabV2
+ \relates QStyleOptionTab
+
+ Synonym for QStyleOptionTab.
+*/
+
+/*!
+ \typedef QStyleOptionTabV3
+ \relates QStyleOptionTab
+
+ Synonym for QStyleOptionTab.
*/
/*!
@@ -1842,7 +1276,8 @@ QStyleOptionTab::QStyleOptionTab()
shape(QTabBar::RoundedNorth),
row(0),
position(Beginning),
- selectedPosition(NotAdjacent), cornerWidgets(QStyleOptionTab::NoCornerWidgets)
+ selectedPosition(NotAdjacent), cornerWidgets(QStyleOptionTab::NoCornerWidgets),
+ documentMode(false)
{
}
@@ -1854,7 +1289,8 @@ QStyleOptionTab::QStyleOptionTab(int version)
shape(QTabBar::RoundedNorth),
row(0),
position(Beginning),
- selectedPosition(NotAdjacent), cornerWidgets(QStyleOptionTab::NoCornerWidgets)
+ selectedPosition(NotAdjacent), cornerWidgets(QStyleOptionTab::NoCornerWidgets),
+ documentMode(false)
{
}
@@ -1886,7 +1322,7 @@ QStyleOptionTab::QStyleOptionTab(int version)
This enum is used to hold information about the version of the style option, and
is defined for each QStyleOption subclass.
- \value Version 1
+ \value Version 3
The version is used by QStyleOption subclasses to implement
extensions without breaking compatibility. If you use
@@ -1990,60 +1426,8 @@ QStyleOptionTab::QStyleOptionTab(int version)
The default value is \l Beginning, i.e. the tab is the first tab
in the tab bar.
*/
-
-/*!
- \class QStyleOptionTabV2
- \brief The QStyleOptionTabV2 class is used to describe the
- parameters necessary for drawing a tabs in Qt 4.1 or above.
-
- \since 4.1
- \inmodule QtWidgets
-
- An instance of the QStyleOptionTabV2 class has
- \l{QStyleOption::type} {type} \l SO_Tab and
- \l{QStyleOption::version} {version} 2. The type is used internally
- by QStyleOption, its subclasses, and qstyleoption_cast() to
- determine the type of style option. In general you do not need to
- worry about this unless you want to create your own QStyleOption
- subclass and your own styles. The version is used by QStyleOption
- subclasses to implement extensions without breaking
- compatibility. If you use qstyleoption_cast(), you normally do not
- need to check it.
-
- If you create your own QStyle subclass, you should handle both
- QStyleOptionTab and QStyleOptionTabV2. One way to achieve this is
- to use the QStyleOptionTabV2 copy constructor. For example:
-
- \snippet doc/src/snippets/qstyleoption/main.cpp 3
-
- In the example above: If \c tabOption's version is 1, the extra
- member (\l iconSize) will be set to an invalid size for \c tabV2.
- If \c tabOption's version is 2, the constructor will simply copy
- the \c tab's iconSize.
-
- For an example demonstrating how style options can be used, see
- the \l {widgets/styles}{Styles} example.
-
- \sa QStyleOptionTab, QStyleOption
-*/
-
/*!
- \enum QStyleOptionTabV2::StyleOptionVersion
-
- This enum is used to hold information about the version of the style option, and
- is defined for each QStyleOption subclass.
-
- \value Version 2
-
- The version is used by QStyleOption subclasses to implement
- extensions without breaking compatibility. If you use
- qstyleoption_cast(), you normally do not need to check it.
-
- \sa StyleOptionType
-*/
-
-/*!
- \variable QStyleOptionTabV2::iconSize
+ \variable QStyleOptionTab::iconSize
\brief the size for the icons
The default value is QSize(-1, -1), i.e. an invalid size; use
@@ -2053,216 +1437,26 @@ QStyleOptionTab::QStyleOptionTab(int version)
*/
/*!
- Constructs a QStyleOptionTabV2.
-*/
-QStyleOptionTabV2::QStyleOptionTabV2()
- : QStyleOptionTab(Version)
-{
-}
-
-/*!
- \internal
-*/
-QStyleOptionTabV2::QStyleOptionTabV2(int version)
- : QStyleOptionTab(version)
-{
-}
-
-/*!
- \fn QStyleOptionTabV2::QStyleOptionTabV2(const QStyleOptionTabV2 &other)
-
- Constructs a copy of the \a other style option.
-*/
-
-/*!
- Constructs a QStyleOptionTabV2 copy of the \a other style option
- which can be either of the QStyleOptionTabV2 or QStyleOptionTab
- types.
-
- If the other style option's version is 1, the new style option's
- \c iconSize is set to an invalid value. If its version is 2, its
- \c iconSize value is simply copied to the new style option.
-*/
-QStyleOptionTabV2::QStyleOptionTabV2(const QStyleOptionTab &other)
- : QStyleOptionTab(Version)
-{
- if (const QStyleOptionTabV2 *tab = qstyleoption_cast<const QStyleOptionTabV2 *>(&other)) {
- *this = *tab;
- } else {
- *((QStyleOptionTab *)this) = other;
- version = Version;
- }
-}
-
-/*!
- Assigns the \a other style option to this QStyleOptionTabV2. The
- \a other style option can be either of the QStyleOptionTabV2 or
- QStyleOptionTab types.
-
- If the other style option's version is 1, this style option's \c
- iconSize is set to an invalid size. If its version is 2, its \c
- iconSize value is simply copied to this style option.
-*/
-QStyleOptionTabV2 &QStyleOptionTabV2::operator=(const QStyleOptionTab &other)
-{
- QStyleOptionTab::operator=(other);
-
- if (const QStyleOptionTabV2 *tab = qstyleoption_cast<const QStyleOptionTabV2 *>(&other))
- iconSize = tab->iconSize;
- else
- iconSize = QSize();
- return *this;
-}
-
-/*!
- \class QStyleOptionTabV3
- \brief The QStyleOptionTabV3 class is used to describe the
- parameters necessary for drawing a tabs in Qt 4.5 or above.
-
- \since 4.5
- \inmodule QtWidgets
-
- An instance of the QStyleOptionTabV3 class has
- \l{QStyleOption::type} {type} \l SO_Tab and
- \l{QStyleOption::version} {version} 3. The type is used internally
- by QStyleOption, its subclasses, and qstyleoption_cast() to
- determine the type of style option. In general you do not need to
- worry about this unless you want to create your own QStyleOption
- subclass and your own styles. The version is used by QStyleOption
- subclasses to implement extensions without breaking
- compatibility. If you use qstyleoption_cast(), you normally do not
- need to check it.
-
- If you create your own QStyle subclass, you should handle both
- QStyleOptionTab, QStyleOptionTabV2 and QStyleOptionTabV3.
- One way to achieve this is to use the QStyleOptionTabV3 copy
- constructor. For example:
-
- \snippet doc/src/snippets/qstyleoption/main.cpp 3
-
- In the example above: If \c tabOption's version is 1, the extra
- member (\l{QStyleOptionTabV2::iconSize}{iconSize}) will be set to
- an invalid size for \c tabV2. If \c tabOption's version is 2, the
- constructor will simply copy the \c tab's iconSize.
-
- For an example demonstrating how style options can be used, see
- the \l {widgets/styles}{Styles} example.
-
- \sa QStyleOptionTab, QStyleOption
-*/
-
-/*!
- \enum QStyleOptionTabV3::StyleOptionVersion
-
- This enum is used to hold information about the version of the style option, and
- is defined for each QStyleOption subclass.
-
- \value Version 3
-
- The version is used by QStyleOption subclasses to implement
- extensions without breaking compatibility. If you use
- qstyleoption_cast(), you normally do not need to check it.
-
- \sa StyleOptionType
-*/
-
-/*!
- \variable QStyleOptionTabV3::documentMode
+ \variable QStyleOptionTab::documentMode
\brief whether the tabbar is in document mode.
The default value is false;
*/
/*!
- \variable QStyleOptionTabV3::leftButtonSize
+ \variable QStyleOptionTab::leftButtonSize
\brief the size for the left widget on the tab.
The default value is QSize(-1, -1), i.e. an invalid size;
*/
/*!
- \variable QStyleOptionTabV3::rightButtonSize
+ \variable QStyleOptionTab::rightButtonSize
\brief the size for the right widget on the tab.
The default value is QSize(-1, -1), i.e. an invalid size;
*/
-/*!
- Constructs a QStyleOptionTabV3.
-*/
-
-QStyleOptionTabV3::QStyleOptionTabV3()
- : QStyleOptionTabV2(Version)
- , documentMode(false)
-{
-}
-
-/*!
- \internal
-*/
-QStyleOptionTabV3::QStyleOptionTabV3(int version)
- : QStyleOptionTabV2(version)
-{
-}
-
-/*!
- \fn QStyleOptionTabV3::QStyleOptionTabV3(const QStyleOptionTabV3 &other)
-
- Constructs a copy of the \a other style option.
-*/
-
-/*!
- \fn QStyleOptionTabV3::QStyleOptionTabV3(const QStyleOptionTabV2 &other)
-
- Constructs a copy of the \a other style option.
-*/
-
-/*!
- Constructs a QStyleOptionTabV3 copy of the \a other style option
- which can be either of the QStyleOptionTabV3, QStyleOptionTabV2
- or QStyleOptionTab types.
-
- If the other style option's version is 1 or 2, the new style option's
- \c leftButtonSize and \c rightButtonSize is set to an invalid value. If
- its version is 3, its \c leftButtonSize and \c rightButtonSize values
- are simply copied to the new style option.
-*/
-QStyleOptionTabV3::QStyleOptionTabV3(const QStyleOptionTab &other)
- : QStyleOptionTabV2(Version)
-{
- if (const QStyleOptionTabV3 *tab = qstyleoption_cast<const QStyleOptionTabV3 *>(&other)) {
- *this = *tab;
- } else {
- *((QStyleOptionTabV2 *)this) = other;
- version = Version;
- }
-}
-
-/*!
- Assigns the \a other style option to this QStyleOptionTabV3. The
- \a other style option can be either of the QStyleOptionTabV3,
- QStyleOptionTabV2 or QStyleOptionTab types.
-
- If the other style option's version is 1 or 2, the new style option's
- \c leftButtonSize and \c rightButtonSize is set to an invalid value. If
- its version is 3, its \c leftButtonSize and \c rightButtonSize values
- are simply copied to the new style option.
-*/
-QStyleOptionTabV3 &QStyleOptionTabV3::operator=(const QStyleOptionTab &other)
-{
- QStyleOptionTabV2::operator=(other);
-
- if (const QStyleOptionTabV3 *tab = qstyleoption_cast<const QStyleOptionTabV3 *>(&other)) {
- leftButtonSize = tab->leftButtonSize;
- rightButtonSize = tab->rightButtonSize;
- } else {
- leftButtonSize = QSize();
- rightButtonSize = QSize();
- documentMode = false;
- }
- return *this;
-}
-
#endif // QT_NO_TABBAR
/*!
@@ -2271,12 +1465,9 @@ QStyleOptionTabV3 &QStyleOptionTabV3::operator=(const QStyleOptionTab &other)
parameters necessary for drawing a progress bar.
\inmodule QtWidgets
-
- Since Qt 4.1, Qt uses the QStyleOptionProgressBarV2 subclass for
- drawing QProgressBar.
An instance of the QStyleOptionProgressBar class has type
- SO_ProgressBar and version 1.
+ SO_ProgressBar and version 2.
The type is used internally by QStyleOption, its subclasses, and
qstyleoption_cast() to determine the type of style option. In
@@ -2286,13 +1477,17 @@ QStyleOptionTabV3 &QStyleOptionTabV3::operator=(const QStyleOptionTab &other)
without breaking compatibility. If you use qstyleoption_cast(),
you normally do not need to check it.
- If you create your own QStyle subclass, you should handle both
- QStyleOptionProgressBar and QStyleOptionProgressBarV2.
-
For an example demonstrating how style options can be used, see
the \l {widgets/styles}{Styles} example.
- \sa QStyleOptionProgressBarV2, QStyleOption
+ \sa QStyleOption
+*/
+
+/*!
+ \typedef QStyleOptionProgressBarV2
+ \relates QStyleOptionProgressBar
+
+ Synonym for QStyleOptionProgressBar.
*/
/*!
@@ -2302,7 +1497,8 @@ QStyleOptionTabV3 &QStyleOptionTabV3::operator=(const QStyleOptionTab &other)
QStyleOptionProgressBar::QStyleOptionProgressBar()
: QStyleOption(QStyleOptionProgressBar::Version, SO_ProgressBar),
- minimum(0), maximum(0), progress(0), textAlignment(Qt::AlignLeft), textVisible(false)
+ minimum(0), maximum(0), progress(0), textAlignment(Qt::AlignLeft), textVisible(false),
+ orientation(Qt::Horizontal), invertedAppearance(false), bottomToTop(false)
{
}
@@ -2311,7 +1507,8 @@ QStyleOptionProgressBar::QStyleOptionProgressBar()
*/
QStyleOptionProgressBar::QStyleOptionProgressBar(int version)
: QStyleOption(version, SO_ProgressBar),
- minimum(0), maximum(0), progress(0), textAlignment(Qt::AlignLeft), textVisible(false)
+ minimum(0), maximum(0), progress(0), textAlignment(Qt::AlignLeft), textVisible(false),
+ orientation(Qt::Horizontal), invertedAppearance(false), bottomToTop(false)
{
}
@@ -2343,7 +1540,7 @@ QStyleOptionProgressBar::QStyleOptionProgressBar(int version)
This enum is used to hold information about the version of the style option, and
is defined for each QStyleOption subclass.
- \value Version 1
+ \value Version 2
The version is used by QStyleOption subclasses to implement
extensions without breaking compatibility. If you use
@@ -2414,118 +1611,7 @@ QStyleOptionProgressBar::QStyleOptionProgressBar(int version)
*/
/*!
- \class QStyleOptionProgressBarV2
- \brief The QStyleOptionProgressBarV2 class is used to describe the
- parameters necessary for drawing a progress bar in Qt 4.1 or above.
-
- \since 4.1
- \inmodule QtWidgets
-
- An instance of this class has \l{QStyleOption::type} {type}
- SO_ProgressBar and \l{QStyleOption::version} {version} 2.
-
- The type is used internally by QStyleOption, its subclasses, and
- qstyleoption_cast() to determine the type of style option. In
- general you do not need to worry about this unless you want to
- create your own QStyleOption subclass and your own styles. The
- version is used by QStyleOption subclasses to implement extensions
- without breaking compatibility. If you use qstyleoption_cast(),
- you normally do not need to check it.
-
- If you create your own QStyle subclass, you should handle both
- QStyleOptionProgressBar and QStyleOptionProgressBarV2. One way
- to achieve this is to use the QStyleOptionProgressBarV2 copy
- constructor. For example:
-
- \snippet doc/src/snippets/qstyleoption/main.cpp 2
-
- In the example above: If the \c progressBarOption's version is 1,
- the extra members (\l orientation, \l invertedAppearance, and \l
- bottomToTop) are set to default values for \c progressBarV2. If
- the \c progressBarOption's version is 2, the constructor will
- simply copy the extra members to progressBarV2.
-
- For an example demonstrating how style options can be used, see
- the \l {widgets/styles}{Styles} example.
-
- \sa QStyleOptionProgressBar, QStyleOption
-*/
-
-/*!
- Constructs a QStyleOptionProgressBarV2, initializing he members
- variables to their default values.
-*/
-
-QStyleOptionProgressBarV2::QStyleOptionProgressBarV2()
- : QStyleOptionProgressBar(2),
- orientation(Qt::Horizontal), invertedAppearance(false), bottomToTop(false)
-{
-}
-
-/*!
- \internal
-*/
-QStyleOptionProgressBarV2::QStyleOptionProgressBarV2(int version)
- : QStyleOptionProgressBar(version),
- orientation(Qt::Horizontal), invertedAppearance(false), bottomToTop(false)
-{
-}
-
-/*!
- Constructs a copy of the \a other style option which can be either
- of the QStyleOptionProgressBar and QStyleOptionProgressBarV2
- types.
-
- If the \a{other} style option's version is 1, the extra members (\l
- orientation, \l invertedAppearance, and \l bottomToTop) are set
- to default values for the new style option. If \a{other}'s version
- is 2, the extra members are simply copied.
-
- \sa version
-*/
-QStyleOptionProgressBarV2::QStyleOptionProgressBarV2(const QStyleOptionProgressBar &other)
- : QStyleOptionProgressBar(2), orientation(Qt::Horizontal), invertedAppearance(false), bottomToTop(false)
-{
- const QStyleOptionProgressBarV2 *pb2 = qstyleoption_cast<const QStyleOptionProgressBarV2 *>(&other);
- if (pb2)
- *this = *pb2;
- else
- *((QStyleOptionProgressBar *)this) = other;
-}
-
-/*!
- Constructs a copy of the \a other style option.
-*/
-QStyleOptionProgressBarV2::QStyleOptionProgressBarV2(const QStyleOptionProgressBarV2 &other)
- : QStyleOptionProgressBar(2), orientation(Qt::Horizontal), invertedAppearance(false), bottomToTop(false)
-{
- *this = other;
-}
-
-/*!
- Assigns the \a other style option to this style option. The \a
- other style option can be either of the QStyleOptionProgressBarV2
- or QStyleOptionProgressBar types.
-
- If the \a{other} style option's version is 1, the extra members
- (\l orientation, \l invertedAppearance, and \l bottomToTop) are
- set to default values for this style option. If \a{other}'s
- version is 2, the extra members are simply copied to this style
- option.
-*/
-QStyleOptionProgressBarV2 &QStyleOptionProgressBarV2::operator=(const QStyleOptionProgressBar &other)
-{
- QStyleOptionProgressBar::operator=(other);
-
- const QStyleOptionProgressBarV2 *pb2 = qstyleoption_cast<const QStyleOptionProgressBarV2 *>(&other);
- orientation = pb2 ? pb2->orientation : Qt::Horizontal;
- invertedAppearance = pb2 ? pb2->invertedAppearance : false;
- bottomToTop = pb2 ? pb2->bottomToTop : false;
- return *this;
-}
-
-/*!
- \variable QStyleOptionProgressBarV2::orientation
+ \variable QStyleOptionProgressBar::orientation
\brief the progress bar's orientation (horizontal or vertical);
the default orentation is Qt::Horizontal
@@ -2533,7 +1619,7 @@ QStyleOptionProgressBarV2 &QStyleOptionProgressBarV2::operator=(const QStyleOpti
*/
/*!
- \variable QStyleOptionProgressBarV2::invertedAppearance
+ \variable QStyleOptionProgressBar::invertedAppearance
\brief whether the progress bar's appearance is inverted
The default value is false.
@@ -2542,7 +1628,7 @@ QStyleOptionProgressBarV2 &QStyleOptionProgressBarV2::operator=(const QStyleOpti
*/
/*!
- \variable QStyleOptionProgressBarV2::bottomToTop
+ \variable QStyleOptionProgressBar::bottomToTop
\brief whether the text reads from bottom to top when the progress
bar is vertical
@@ -2552,38 +1638,6 @@ QStyleOptionProgressBarV2 &QStyleOptionProgressBarV2::operator=(const QStyleOpti
*/
/*!
- \enum QStyleOptionProgressBarV2::StyleOptionType
-
- This enum is used to hold information about the type of the style option, and
- is defined for each QStyleOption subclass.
-
- \value Type The type of style option provided (\l{SO_ProgressBar} for this class).
-
- The type is used internally by QStyleOption, its subclasses, and
- qstyleoption_cast() to determine the type of style option. In
- general you do not need to worry about this unless you want to
- create your own QStyleOption subclass and your own styles.
-
- \sa StyleOptionVersion
-*/
-
-/*!
- \enum QStyleOptionProgressBarV2::StyleOptionVersion
-
- This enum is used to hold information about the version of the style option, and
- is defined for each QStyleOption subclass.
-
- \value Version 2
-
- The version is used by QStyleOption subclasses to implement
- extensions without breaking compatibility. If you use
- qstyleoption_cast(), you normally do not need to check it.
-
- \sa StyleOptionType
-*/
-
-
-/*!
\class QStyleOptionMenuItem
\brief The QStyleOptionMenuItem class is used to describe the
parameter necessary for drawing a menu item.
@@ -3576,13 +2630,20 @@ QStyleOptionQ3DockWindow::QStyleOptionQ3DockWindow(int version)
*/
/*!
+ \typedef QStyleOptionDockWidgetV2
+ \relates QStyleOptionDockWidget
+
+ Synonym for QStyleOptionDockWidget.
+*/
+
+/*!
Constructs a QStyleOptionDockWidget, initializing the member
variables to their default values.
*/
QStyleOptionDockWidget::QStyleOptionDockWidget()
: QStyleOption(Version, SO_DockWidget), closable(false),
- movable(false), floatable(false)
+ movable(false), floatable(false), verticalTitleBar(false)
{
}
@@ -3591,34 +2652,7 @@ QStyleOptionDockWidget::QStyleOptionDockWidget()
*/
QStyleOptionDockWidget::QStyleOptionDockWidget(int version)
: QStyleOption(version, SO_DockWidget), closable(false),
- movable(false), floatable(false)
-{
-}
-
-QStyleOptionDockWidgetV2::QStyleOptionDockWidgetV2()
- : QStyleOptionDockWidget(Version), verticalTitleBar(false)
-{
-}
-
-QStyleOptionDockWidgetV2::QStyleOptionDockWidgetV2(
- const QStyleOptionDockWidget &other)
- : QStyleOptionDockWidget(Version)
-{
- (void)QStyleOptionDockWidgetV2::operator=(other);
-}
-
-QStyleOptionDockWidgetV2 &QStyleOptionDockWidgetV2::operator = (
- const QStyleOptionDockWidget &other)
-{
- QStyleOptionDockWidget::operator=(other);
- const QStyleOptionDockWidgetV2 *v2
- = qstyleoption_cast<const QStyleOptionDockWidgetV2*>(&other);
- verticalTitleBar = v2 ? v2->verticalTitleBar : false;
- return *this;
-}
-
-QStyleOptionDockWidgetV2::QStyleOptionDockWidgetV2(int version)
- : QStyleOptionDockWidget(version), verticalTitleBar(false)
+ movable(false), floatable(false), verticalTitleBar(false)
{
}
@@ -3650,7 +2684,7 @@ QStyleOptionDockWidgetV2::QStyleOptionDockWidgetV2(int version)
This enum is used to hold information about the version of the style option, and
is defined for each QStyleOption subclass.
- \value Version 1
+ \value Version 2
The version is used by QStyleOption subclasses to implement
extensions without breaking compatibility. If you use
@@ -3693,7 +2727,7 @@ QStyleOptionDockWidgetV2::QStyleOptionDockWidgetV2(int version)
parameters for drawing a tool button.
\inmodule QtWidgets
-
+
QStyleOptionToolButton contains all the information that QStyle
functions need to draw QToolButton.
@@ -3857,7 +2891,7 @@ QStyleOptionToolButton::QStyleOptionToolButton(int version)
parameter for drawing a combobox.
\inmodule QtWidgets
-
+
QStyleOptionButton contains all the information that QStyle
functions need to draw QComboBox.
@@ -3985,7 +3019,7 @@ QStyleOptionComboBox::QStyleOptionComboBox(int version)
parameters needed for drawing a tool box.
\inmodule QtWidgets
-
+
QStyleOptionToolBox contains all the information that QStyle
functions need to draw QToolBox.
@@ -4001,12 +3035,19 @@ QStyleOptionComboBox::QStyleOptionComboBox(int version)
*/
/*!
+ \typedef QStyleOptionToolBoxV2
+ \relates QStyleOptionToolBox
+
+ Synonym for QStyleOptionToolBox.
+*/
+
+/*!
Creates a QStyleOptionToolBox, initializing the members variables
to their default values.
*/
QStyleOptionToolBox::QStyleOptionToolBox()
- : QStyleOption(Version, SO_ToolBox)
+ : QStyleOption(Version, SO_ToolBox), position(Beginning), selectedPosition(NotAdjacent)
{
}
@@ -4014,7 +3055,7 @@ QStyleOptionToolBox::QStyleOptionToolBox()
\internal
*/
QStyleOptionToolBox::QStyleOptionToolBox(int version)
- : QStyleOption(version, SO_ToolBox)
+ : QStyleOption(version, SO_ToolBox), position(Beginning), selectedPosition(NotAdjacent)
{
}
@@ -4046,7 +3087,7 @@ QStyleOptionToolBox::QStyleOptionToolBox(int version)
This enum is used to hold information about the version of the style option, and
is defined for each QStyleOption subclass.
- \value Version 1
+ \value Version 2
The version is used by QStyleOption subclasses to implement
extensions without breaking compatibility. If you use
@@ -4071,104 +3112,7 @@ QStyleOptionToolBox::QStyleOptionToolBox(int version)
*/
/*!
- \class QStyleOptionToolBoxV2
- \brief The QStyleOptionToolBoxV2 class is used to describe the parameters necessary for drawing a frame in Qt 4.3 or above.
-
- \since 4.3
- \inmodule QtWidgets
-
- QStyleOptionToolBoxV2 inherits QStyleOptionToolBox which is used for
- drawing the tabs in a QToolBox.
-
- An instance of the QStyleOptionToolBoxV2 class has
- \l{QStyleOption::type} {type} SO_ToolBox and
- \l{QStyleOption::version} {version} 2. The type is used
- internally by QStyleOption, its subclasses, and
- qstyleoption_cast() to determine the type of style option. In
- general you do not need to worry about this unless you want to
- create your own QStyleOption subclass and your own styles. The
- version is used by QStyleOption subclasses to implement extensions
- without breaking compatibility. If you use qstyleoption_cast(),
- you normally do not need to check it.
-
- If you create your own QStyle subclass, you should handle both
- QStyleOptionToolBox and QStyleOptionToolBoxV2.
-
- \sa QStyleOptionToolBox, QStyleOption
-*/
-
-/*!
- Contsructs a QStyleOptionToolBoxV2 object.
-*/
-QStyleOptionToolBoxV2::QStyleOptionToolBoxV2()
- : QStyleOptionToolBox(Version), position(Beginning), selectedPosition(NotAdjacent)
-{
-}
-
-/*!
- \fn QStyleOptionToolBoxV2::QStyleOptionToolBoxV2(const QStyleOptionToolBoxV2 &other)
-
- Constructs a QStyleOptionToolBoxV2 copy of the \a other style option.
-*/
-
-/*!
- \internal
-*/
-QStyleOptionToolBoxV2::QStyleOptionToolBoxV2(int version)
- : QStyleOptionToolBox(version), position(Beginning), selectedPosition(NotAdjacent)
-{
-}
-
-/*!
- Constructs a QStyleOptionToolBoxV2 copy of the \a other style option
- which can be either of the QStyleOptionToolBoxV2 or
- QStyleOptionToolBox types.
-
- If the \a other style option's version is 1, the new style
- option's \l{QStyleOptionTab::position} {position} value is set to
- \l QStyleOptionToolBoxV2::Beginning and \l selectedPosition is set
- to \l QStyleOptionToolBoxV2::NotAdjacent. If its version is 2, the
- \l{QStyleOptionTab::position} {position} selectedPosition values
- are simply copied to the new style option.
-
- \sa version
-*/
-QStyleOptionToolBoxV2::QStyleOptionToolBoxV2(const QStyleOptionToolBox &other)
-{
- QStyleOptionToolBox::operator=(other);
-
- const QStyleOptionToolBoxV2 *f2 = qstyleoption_cast<const QStyleOptionToolBoxV2 *>(&other);
- position = f2 ? f2->position : Beginning;
- selectedPosition = f2 ? f2->selectedPosition : NotAdjacent;
- version = Version;
-}
-
-/*!
- Assigns the \a other style option to this style option. The \a
- other style option can be either of the QStyleOptionToolBoxV2 or
- QStyleOptionToolBox types.
-
- If the \a{other} style option's version is 1, this style option's
- \l{QStyleOptionTab::position} {position} and \l selectedPosition
- values are set to \l QStyleOptionToolBoxV2::Beginning and \l
- QStyleOptionToolBoxV2::NotAdjacent respectively. If its
- \l{QStyleOption::version} {version} is 2, these values are simply
- copied to this style option.
-*/
-QStyleOptionToolBoxV2 &QStyleOptionToolBoxV2::operator=(const QStyleOptionToolBox &other)
-{
- QStyleOptionToolBox::operator=(other);
-
- const QStyleOptionToolBoxV2 *f2 = qstyleoption_cast<const QStyleOptionToolBoxV2 *>(&other);
- position = f2 ? f2->position : Beginning;
- selectedPosition = f2 ? f2->selectedPosition : NotAdjacent;
- version = Version;
- return *this;
-}
-
-
-/*!
- \enum QStyleOptionToolBoxV2::SelectedPosition
+ \enum QStyleOptionToolBox::SelectedPosition
This enum describes the position of the selected tab. Some styles
need to draw a tab differently depending on whether or not it is
@@ -4182,15 +3126,7 @@ QStyleOptionToolBoxV2 &QStyleOptionToolBoxV2::operator=(const QStyleOptionToolBo
*/
/*!
- \enum QStyleOptionToolBoxV2::StyleOptionVersion
-
- This enum holds the version of this style option
-
- \value Version 2
-*/
-
-/*!
- \enum QStyleOptionToolBoxV2::TabPosition
+ \enum QStyleOptionToolBox::TabPosition
This enum describes tab positions relative to other tabs.
@@ -4202,7 +3138,7 @@ QStyleOptionToolBoxV2 &QStyleOptionToolBoxV2::operator=(const QStyleOptionToolBo
*/
/*!
- \variable QStyleOptionToolBoxV2::selectedPosition
+ \variable QStyleOptionToolBox::selectedPosition
\brief the position of the selected tab in relation to this tab
The default value is NotAdjacent, i.e. the tab is not adjacent to
@@ -4216,7 +3152,7 @@ QStyleOptionToolBoxV2 &QStyleOptionToolBoxV2::operator=(const QStyleOptionToolBo
parameters needed for drawing a rubber band.
\inmodule QtWidgets
-
+
QStyleOptionRubberBand contains all the information that
QStyle functions need to draw QRubberBand.
@@ -4307,7 +3243,7 @@ QStyleOptionRubberBand::QStyleOptionRubberBand(int version)
parameters for drawing a title bar.
\inmodule QtWidgets
-
+
QStyleOptionTitleBar contains all the information that QStyle
functions need to draw the title bar of a QMdiSubWindow.
@@ -4412,13 +3348,14 @@ QStyleOptionTitleBar::QStyleOptionTitleBar(int version)
\sa Qt::WindowFlags
*/
+#ifndef QT_NO_ITEMVIEWS
/*!
\class QStyleOptionViewItem
\brief The QStyleOptionViewItem class is used to describe the
parameters used to draw an item in a view widget.
\inmodule QtWidgets
-
+
QStyleOptionViewItem contains all the information that QStyle
functions need to draw the items for Qt's model/view classes.
@@ -4435,6 +3372,27 @@ QStyleOptionTitleBar::QStyleOptionTitleBar(int version)
*/
/*!
+ \typedef QStyleOptionViewItemV2
+ \relates QStyleOptionViewItem
+
+ Synonym for QStyleOptionViewItem.
+*/
+
+/*!
+ \typedef QStyleOptionViewItemV3
+ \relates QStyleOptionViewItem
+
+ Synonym for QStyleOptionViewItem.
+*/
+
+/*!
+ \typedef QStyleOptionViewItemV4
+ \relates QStyleOptionViewItem
+
+ Synonym for QStyleOptionViewItem.
+*/
+
+/*!
\enum QStyleOptionViewItem::Position
This enum describes the position of the item's decoration.
@@ -4479,7 +3437,8 @@ QStyleOptionViewItem::QStyleOptionViewItem()
: QStyleOption(Version, SO_ViewItem),
displayAlignment(Qt::AlignLeft), decorationAlignment(Qt::AlignLeft),
textElideMode(Qt::ElideMiddle), decorationPosition(Left),
- showDecorationSelected(false)
+ showDecorationSelected(false), features(None), widget(0),
+ checkState(Qt::Unchecked), viewItemPosition(QStyleOptionViewItem::Invalid)
{
}
@@ -4490,7 +3449,8 @@ QStyleOptionViewItem::QStyleOptionViewItem(int version)
: QStyleOption(version, SO_ViewItem),
displayAlignment(Qt::AlignLeft), decorationAlignment(Qt::AlignLeft),
textElideMode(Qt::ElideMiddle), decorationPosition(Left),
- showDecorationSelected(false)
+ showDecorationSelected(false), features(None), widget(0),
+ checkState(Qt::Unchecked), viewItemPosition(QStyleOptionViewItem::Invalid)
{
}
@@ -4522,7 +3482,7 @@ QStyleOptionViewItem::QStyleOptionViewItem(int version)
This enum is used to hold information about the version of the style option, and
is defined for each QStyleOption subclass.
- \value Version 1
+ \value Version 4
The version is used by QStyleOption subclasses to implement
extensions without breaking compatibility. If you use
@@ -4573,6 +3533,87 @@ QStyleOptionViewItem::QStyleOptionViewItem(int version)
*/
/*!
+ \variable QStyleOptionViewItem::features
+ \brief a bitwise OR of the features that describe this view item
+
+ \sa ViewItemFeature
+*/
+
+/*!
+ \enum QStyleOptionViewItem::ViewItemFeature
+
+ This enum describes the different types of features an item can have.
+
+ \value None Indicates a normal item.
+ \value WrapText Indicates an item with wrapped text.
+ \value Alternate Indicates that the item's background is rendered using alternateBase.
+ \value HasCheckIndicator Indicates that the item has a check state indicator.
+ \value HasDisplay Indicates that the item has a display role.
+ \value HasDecoration Indicates that the item has a decoration role.
+*/
+
+/*!
+ \variable QStyleOptionViewItem::index
+
+ The model index that is to be drawn.
+*/
+
+/*!
+ \variable QStyleOptionViewItem::checkState
+
+ If this view item is checkable, i.e.,
+ ViewItemFeature::HasCheckIndicator is true, \c checkState is true
+ if the item is checked; otherwise, it is false.
+
+*/
+
+/*!
+ \variable QStyleOptionViewItem::icon
+
+ The icon (if any) to be drawn in the view item.
+*/
+
+
+/*!
+ \variable QStyleOptionViewItem::text
+
+ The text (if any) to be drawn in the view item.
+*/
+
+/*!
+ \variable QStyleOptionViewItem::backgroundBrush
+
+ The QBrush that should be used to paint the view items
+ background.
+*/
+
+/*!
+ \variable QStyleOptionViewItem::viewItemPosition
+
+ Gives the position of this view item relative to other items. See
+ the \l{QStyleOptionViewItem::}{ViewItemPosition} enum for the
+ details.
+*/
+
+/*!
+ \enum QStyleOptionViewItem::ViewItemPosition
+
+ This enum is used to represent the placement of the item on
+ a row. This can be used to draw items differently depending
+ on their placement, for example by putting rounded edges at
+ the beginning and end, and straight edges in between.
+
+ \value Invalid The ViewItemPosition is unknown and should be
+ disregarded.
+ \value Beginning The item appears at the beginning of the row.
+ \value Middle The item appears in the middle of the row.
+ \value End The item appears at the end of the row.
+ \value OnlyOne The item is the only one on the row, and is
+ therefore both at the beginning and the end.
+*/
+
+#endif // QT_NO_ITEMVIEWS
+/*!
\fn T qstyleoption_cast<T>(const QStyleOption *option)
\relates QStyleOption
@@ -4601,7 +3642,7 @@ QStyleOptionViewItem::QStyleOptionViewItem(int version)
parameters for drawing the frame around a tab widget.
\inmodule QtWidgets
-
+
QStyleOptionTabWidgetFrame contains all the information that
QStyle functions need to draw the frame around QTabWidget.
@@ -4617,6 +3658,13 @@ QStyleOptionViewItem::QStyleOptionViewItem(int version)
*/
/*!
+ \typedef QStyleOptionTabWidgetFrameV2
+ \relates QStyleOptionTabWidgetFrame
+
+ Synonym for QStyleOptionTabWidgetFrame.
+*/
+
+/*!
Constructs a QStyleOptionTabWidgetFrame, initializing the members
variables to their default values.
*/
@@ -4661,7 +3709,7 @@ QStyleOptionTabWidgetFrame::QStyleOptionTabWidgetFrame(int version)
This enum is used to hold information about the version of the style option, and
is defined for each QStyleOption subclass.
- \value Version 1
+ \value Version 2
The version is used by QStyleOption subclasses to implement
extensions without breaking compatibility. If you use
@@ -4714,30 +3762,7 @@ QStyleOptionTabWidgetFrame::QStyleOptionTabWidgetFrame(int version)
/*!
-
- \class QStyleOptionTabWidgetFrameV2
- \brief The QStyleOptionTabWidgetFrameV2 class is used to describe the
- parameters for drawing the frame around a tab widget.
-
- \inmodule QtWidgets
-
- QStyleOptionTabWidgetFrameV2 contains all the information that
- QStyle functions need to draw the frame around QTabWidget.
-
- For performance reasons, the access to the member variables is
- direct (i.e., using the \c . or \c -> operator). This low-level feel
- makes the structures straightforward to use and emphasizes that
- these are simply parameters used by the style functions.
-
- For an example demonstrating how style options can be used, see
- the \l {widgets/styles}{Styles} example.
-
- \sa QStyleOption, QTabWidget
-*/
-
-
-/*!
- \variable QStyleOptionTabWidgetFrameV2::tabBarRect
+ \variable QStyleOptionTabWidgetFrame::tabBarRect
\brief the rectangle containing all the tabs
The default value is a null rectangle, i.e. a rectangle with both
@@ -4745,7 +3770,7 @@ QStyleOptionTabWidgetFrame::QStyleOptionTabWidgetFrame(int version)
*/
/*!
- \variable QStyleOptionTabWidgetFrameV2::selectedTabRect
+ \variable QStyleOptionTabWidgetFrame::selectedTabRect
\brief the rectangle containing the selected tab
This rectangle is contained within the tabBarRect. The default
@@ -4753,87 +3778,6 @@ QStyleOptionTabWidgetFrame::QStyleOptionTabWidgetFrame(int version)
and the height set to 0.
*/
-
-/*!
- Constructs a QStyleOptionTabWidgetFrameV2, initializing the members
- variables to their default values.
-*/
-
-QStyleOptionTabWidgetFrameV2::QStyleOptionTabWidgetFrameV2()
- : QStyleOptionTabWidgetFrame(Version)
-{
-}
-
-
-/*! \internal */
-QStyleOptionTabWidgetFrameV2::QStyleOptionTabWidgetFrameV2(int version)
- : QStyleOptionTabWidgetFrame(version)
-{
-}
-
-
-/*! \fn QStyleOptionTabWidgetFrameV2::QStyleOptionTabWidgetFrameV2(const QStyleOptionTabWidgetFrameV2 &other)
- Constructs a QStyleOptionTabWidgetFrameV2 copy of the \a other style option.
-
- If the \a other style option's version is 1, the new style option's \l
- selectedTabRect and tabBarRect will contain null rects
-
- \sa version
-*/
-
-/*!
- Constructs a QStyleOptionTabWidgetFrameV2 copy of the \a other style option.
-
- If the \a other style option's version is 1, the new style option's \l
- selectedTabRect and tabBarRect will contain null rects
-
- \sa version
-*/
-QStyleOptionTabWidgetFrameV2::QStyleOptionTabWidgetFrameV2(const QStyleOptionTabWidgetFrame &other)
-{
- QStyleOptionTabWidgetFrameV2::operator=(other);
-
-}
-
-
-/*!
- Assigns the \a other style option to this style option. The \a
- other style option can be either of the QStyleOptionFrameV2 or
- QStyleOptionFrame types.
-
- If the \a{other} style option's version is 1, this style option's
- QStyleOptionFrameV2::FrameFeature value is set to
- QStyleOptionFrameV2::None. If its version is 2, its
- \l{QStyleOptionFrameV2::}{FrameFeature} value is simply copied to
- this style option.
-*/
-QStyleOptionTabWidgetFrameV2 &QStyleOptionTabWidgetFrameV2::operator=(const QStyleOptionTabWidgetFrame &other)
-{
- QStyleOptionTabWidgetFrame::operator=(other);
- if (const QStyleOptionTabWidgetFrameV2 *f2 = qstyleoption_cast<const QStyleOptionTabWidgetFrameV2 *>(&other)) {
- selectedTabRect = f2->selectedTabRect;
- tabBarRect = f2->tabBarRect;
- }
- return *this;
-}
-
-
-/*!
- \enum QStyleOptionTabWidgetFrameV2::StyleOptionVersion
-
- This enum is used to hold information about the version of the style option, and
- is defined for each QStyleOption subclass.
-
- \value Version 2
-
- The version is used by QStyleOption subclasses to implement
- extensions without breaking compatibility. If you use
- qstyleoption_cast(), you normally do not need to check it.
-
- \sa StyleOptionType
-*/
-
-
#endif // QT_NO_TABWIDGET
#ifndef QT_NO_TABBAR
@@ -4845,7 +3789,7 @@ QStyleOptionTabWidgetFrameV2 &QStyleOptionTabWidgetFrameV2::operator=(const QSty
overlaps with.
\inmodule QtWidgets
-
+
QStyleOptionTabBarBase contains all the information that QStyle
functions need to draw the tab bar base. Note that this is only
drawn for a standalone QTabBar (one that isn't part of a
@@ -4863,17 +3807,26 @@ QStyleOptionTabWidgetFrameV2 &QStyleOptionTabWidgetFrameV2::operator=(const QSty
*/
/*!
+ \typedef QStyleOptionTabBarBaseV2
+ \relates QStyleOptionTabBarBase
+
+ Synonym for QStyleOptionTabBarBase.
+*/
+
+/*!
Construct a QStyleOptionTabBarBase, initializing the members
vaiables to their default values.
*/
QStyleOptionTabBarBase::QStyleOptionTabBarBase()
- : QStyleOption(Version, SO_TabBarBase), shape(QTabBar::RoundedNorth)
+ : QStyleOption(Version, SO_TabBarBase), shape(QTabBar::RoundedNorth),
+ documentMode(false)
{
}
/*! \internal */
QStyleOptionTabBarBase::QStyleOptionTabBarBase(int version)
- : QStyleOption(version, SO_TabBarBase), shape(QTabBar::RoundedNorth)
+ : QStyleOption(version, SO_TabBarBase), shape(QTabBar::RoundedNorth),
+ documentMode(false)
{
}
@@ -4905,7 +3858,7 @@ QStyleOptionTabBarBase::QStyleOptionTabBarBase(int version)
This enum is used to hold information about the version of the style option, and
is defined for each QStyleOption subclass.
- \value Version 1
+ \value Version 2
The version is used by QStyleOption subclasses to implement
extensions without breaking compatibility. If you use
@@ -4940,96 +3893,12 @@ QStyleOptionTabBarBase::QStyleOptionTabBarBase(int version)
/*!
- \class QStyleOptionTabBarBaseV2
- \brief The QStyleOptionTabBarBaseV2 class is used to describe
- the base of a tab bar, i.e. the part that the tab bar usually
- overlaps with.
- \since 4.5
- \inmodule QtWidgets
-
- QStyleOptionTabBarBase contains all the information that QStyle
- functions need to draw the tab bar base.
-
- For performance reasons, the access to the member variables is
- direct (i.e., using the \c . or \c -> operator). This low-level feel
- makes the structures straightforward to use and emphasizes that
- these are simply parameters used by the style functions.
-
- For an example demonstrating how style options can be used, see
- the \l {widgets/styles}{Styles} example.
-
- \sa QStyleOption, QTabBar::drawBase()
-*/
-
-/*!
- \enum QStyleOptionTabBarBaseV2::StyleOptionVersion
-
- This enum is used to hold information about the version of the style option, and
- is defined for each QStyleOption subclass.
-
- \value Version 2
-
- The version is used by QStyleOption subclasses to implement
- extensions without breaking compatibility. If you use
- qstyleoption_cast(), you normally do not need to check it.
-
- \sa StyleOptionType
-*/
-
-/*!
- \variable QStyleOptionTabBarBaseV2::documentMode
+ \variable QStyleOptionTabBarBase::documentMode
\brief whether the tabbar is in document mode.
The default value is false;
*/
-/*!
- Construct a QStyleOptionTabBarBaseV2, initializing the members
- vaiables to their default values.
-*/
-QStyleOptionTabBarBaseV2::QStyleOptionTabBarBaseV2()
- : QStyleOptionTabBarBase(Version)
- , documentMode(false)
-{
-}
-
-/*!
- \fn QStyleOptionTabBarBaseV2::QStyleOptionTabBarBaseV2(const QStyleOptionTabBarBaseV2 &other)
-
- Constructs a copy of \a other.
-*/
-
-/*!
- Constructs a copy of \a other.
-*/
-QStyleOptionTabBarBaseV2::QStyleOptionTabBarBaseV2(const QStyleOptionTabBarBase &other)
- : QStyleOptionTabBarBase(Version)
-{
- (void)QStyleOptionTabBarBaseV2::operator=(other);
-}
-
-/*!
- Constructs a QStyleOptionTabBarBaseV2 copy of the \a other style option
- which can be either of the QStyleOptionTabBarBaseV2, or QStyleOptionTabBarBase types.
-
- If the other style option's version is not 1, the new style option's
- \c documentMode is set to false. If its version is 2, its \c documentMode value
- is simply copied to the new style option.
-*/
-QStyleOptionTabBarBaseV2 &QStyleOptionTabBarBaseV2::operator = (const QStyleOptionTabBarBase &other)
-{
- QStyleOptionTabBarBase::operator=(other);
- const QStyleOptionTabBarBaseV2 *v2 = qstyleoption_cast<const QStyleOptionTabBarBaseV2*>(&other);
- documentMode = v2 ? v2->documentMode : false;
- return *this;
-}
-
-/*! \internal */
-QStyleOptionTabBarBaseV2::QStyleOptionTabBarBaseV2(int version)
- : QStyleOptionTabBarBase(version), documentMode(false)
-{
-}
-
#endif // QT_NO_TABBAR
#ifndef QT_NO_SIZEGRIP
diff --git a/src/widgets/styles/qstyleoption.h b/src/widgets/styles/qstyleoption.h
index 56203a6615..677a48ec20 100644
--- a/src/widgets/styles/qstyleoption.h
+++ b/src/widgets/styles/qstyleoption.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -60,7 +60,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
class QDebug;
@@ -119,64 +118,36 @@ class Q_WIDGETS_EXPORT QStyleOptionFrame : public QStyleOption
{
public:
enum StyleOptionType { Type = SO_Frame };
- enum StyleOptionVersion { Version = 1 };
+ enum StyleOptionVersion { Version = 3 };
int lineWidth;
int midLineWidth;
-
- QStyleOptionFrame();
- QStyleOptionFrame(const QStyleOptionFrame &other) : QStyleOption(Version, Type) { *this = other; }
-
-protected:
- QStyleOptionFrame(int version);
-};
-
-class Q_WIDGETS_EXPORT QStyleOptionFrameV2 : public QStyleOptionFrame
-{
-public:
- enum StyleOptionVersion { Version = 2 };
enum FrameFeature {
None = 0x00,
Flat = 0x01
};
Q_DECLARE_FLAGS(FrameFeatures, FrameFeature)
FrameFeatures features;
+ QFrame::Shape frameShape;
- QStyleOptionFrameV2();
- QStyleOptionFrameV2(const QStyleOptionFrameV2 &other) : QStyleOptionFrame(Version) { *this = other; }
- QStyleOptionFrameV2(const QStyleOptionFrame &other);
- QStyleOptionFrameV2 &operator=(const QStyleOptionFrame &other);
+ QStyleOptionFrame();
+ QStyleOptionFrame(const QStyleOptionFrame &other) : QStyleOption(Version, Type) { *this = other; }
protected:
- QStyleOptionFrameV2(int version);
+ QStyleOptionFrame(int version);
};
-Q_DECLARE_OPERATORS_FOR_FLAGS(QStyleOptionFrameV2::FrameFeatures)
-
-
-class Q_WIDGETS_EXPORT QStyleOptionFrameV3 : public QStyleOptionFrameV2
-{
-public:
- enum StyleOptionVersion { Version = 3 };
- QFrame::Shape frameShape : 4;
- uint unused : 28;
-
- QStyleOptionFrameV3();
- QStyleOptionFrameV3(const QStyleOptionFrameV3 &other) : QStyleOptionFrameV2(Version) { *this = other; }
- QStyleOptionFrameV3(const QStyleOptionFrame &other);
- QStyleOptionFrameV3 &operator=(const QStyleOptionFrame &other);
-
-protected:
- QStyleOptionFrameV3(int version);
-};
+Q_DECLARE_OPERATORS_FOR_FLAGS(QStyleOptionFrame::FrameFeatures)
+typedef QStyleOptionFrame QStyleOptionFrameV2;
+typedef QStyleOptionFrame QStyleOptionFrameV3;
#ifndef QT_NO_TABWIDGET
class Q_WIDGETS_EXPORT QStyleOptionTabWidgetFrame : public QStyleOption
{
public:
enum StyleOptionType { Type = SO_TabWidgetFrame };
- enum StyleOptionVersion { Version = 1 };
+ enum StyleOptionVersion { Version = 2 };
int lineWidth;
int midLineWidth;
@@ -184,6 +155,8 @@ public:
QSize tabBarSize;
QSize rightCornerWidgetSize;
QSize leftCornerWidgetSize;
+ QRect tabBarRect;
+ QRect selectedTabRect;
QStyleOptionTabWidgetFrame();
inline QStyleOptionTabWidgetFrame(const QStyleOptionTabWidgetFrame &other)
@@ -193,25 +166,8 @@ protected:
QStyleOptionTabWidgetFrame(int version);
};
-class Q_WIDGETS_EXPORT QStyleOptionTabWidgetFrameV2 : public QStyleOptionTabWidgetFrame
-{
-public:
- enum StyleOptionVersion { Version = 2 };
-
- QRect tabBarRect;
- QRect selectedTabRect;
-
- QStyleOptionTabWidgetFrameV2();
- QStyleOptionTabWidgetFrameV2(const QStyleOptionTabWidgetFrameV2 &other) :
- QStyleOptionTabWidgetFrame(Version) { *this = other; }
- QStyleOptionTabWidgetFrameV2(const QStyleOptionTabWidgetFrame &other);
- QStyleOptionTabWidgetFrameV2 &operator=(const QStyleOptionTabWidgetFrame &other);
-
-protected:
- QStyleOptionTabWidgetFrameV2(int version);
-};
-
-#endif
+typedef QStyleOptionTabWidgetFrame QStyleOptionTabWidgetFrameV2;
+#endif // QT_NO_TABWIDGET
#ifndef QT_NO_TABBAR
@@ -219,11 +175,12 @@ class Q_WIDGETS_EXPORT QStyleOptionTabBarBase : public QStyleOption
{
public:
enum StyleOptionType { Type = SO_TabBarBase };
- enum StyleOptionVersion { Version = 1 };
+ enum StyleOptionVersion { Version = 2 };
QTabBar::Shape shape;
QRect tabBarRect;
QRect selectedTabRect;
+ bool documentMode;
QStyleOptionTabBarBase();
QStyleOptionTabBarBase(const QStyleOptionTabBarBase &other) : QStyleOption(Version, Type) { *this = other; }
@@ -232,21 +189,8 @@ protected:
QStyleOptionTabBarBase(int version);
};
-class Q_WIDGETS_EXPORT QStyleOptionTabBarBaseV2 : public QStyleOptionTabBarBase
-{
-public:
- enum StyleOptionVersion { Version = 2 };
- bool documentMode;
- QStyleOptionTabBarBaseV2();
- QStyleOptionTabBarBaseV2(const QStyleOptionTabBarBaseV2 &other) : QStyleOptionTabBarBase(Version) { *this = other; }
- QStyleOptionTabBarBaseV2(const QStyleOptionTabBarBase &other);
- QStyleOptionTabBarBaseV2 &operator=(const QStyleOptionTabBarBase &other);
-
-protected:
- QStyleOptionTabBarBaseV2(int version);
-};
-
-#endif
+typedef QStyleOptionTabBarBase QStyleOptionTabBarBaseV2;
+#endif // QT_NO_TABBAR
class Q_WIDGETS_EXPORT QStyleOptionHeader : public QStyleOption
{
@@ -305,7 +249,7 @@ class Q_WIDGETS_EXPORT QStyleOptionTab : public QStyleOption
{
public:
enum StyleOptionType { Type = SO_Tab };
- enum StyleOptionVersion { Version = 1 };
+ enum StyleOptionVersion { Version = 3 };
enum TabPosition { Beginning, Middle, End, OnlyOneTab };
enum SelectedPosition { NotAdjacent, NextIsSelected, PreviousIsSelected };
@@ -320,6 +264,10 @@ public:
TabPosition position;
SelectedPosition selectedPosition;
CornerWidgets cornerWidgets;
+ QSize iconSize;
+ bool documentMode;
+ QSize leftButtonSize;
+ QSize rightButtonSize;
QStyleOptionTab();
QStyleOptionTab(const QStyleOptionTab &other) : QStyleOption(Version, Type) { *this = other; }
@@ -330,38 +278,9 @@ protected:
Q_DECLARE_OPERATORS_FOR_FLAGS(QStyleOptionTab::CornerWidgets)
-class Q_WIDGETS_EXPORT QStyleOptionTabV2 : public QStyleOptionTab
-{
-public:
- enum StyleOptionVersion { Version = 2 };
- QSize iconSize;
- QStyleOptionTabV2();
- QStyleOptionTabV2(const QStyleOptionTabV2 &other) : QStyleOptionTab(Version) { *this = other; }
- QStyleOptionTabV2(const QStyleOptionTab &other);
- QStyleOptionTabV2 &operator=(const QStyleOptionTab &other);
-
-protected:
- QStyleOptionTabV2(int version);
-};
-
-class Q_WIDGETS_EXPORT QStyleOptionTabV3 : public QStyleOptionTabV2
-{
-public:
- enum StyleOptionVersion { Version = 3 };
- bool documentMode;
- QSize leftButtonSize;
- QSize rightButtonSize;
- QStyleOptionTabV3();
- QStyleOptionTabV3(const QStyleOptionTabV3 &other) : QStyleOptionTabV2(Version) { *this = other; }
- QStyleOptionTabV3(const QStyleOptionTabV2 &other) : QStyleOptionTabV2(Version) { *this = other; }
- QStyleOptionTabV3(const QStyleOptionTab &other);
- QStyleOptionTabV3 &operator=(const QStyleOptionTab &other);
-
-protected:
- QStyleOptionTabV3(int version);
-};
-
-#endif
+typedef QStyleOptionTab QStyleOptionTabV2;
+typedef QStyleOptionTab QStyleOptionTabV3;
+#endif // QT_NO_TABBAR
#ifndef QT_NO_TOOLBAR
@@ -389,15 +308,13 @@ protected:
Q_DECLARE_OPERATORS_FOR_FLAGS(QStyleOptionToolBar::ToolBarFeatures)
-#endif
-
-
+#endif // QT_NO_TOOLBAR
class Q_WIDGETS_EXPORT QStyleOptionProgressBar : public QStyleOption
{
public:
enum StyleOptionType { Type = SO_ProgressBar };
- enum StyleOptionVersion { Version = 1 };
+ enum StyleOptionVersion { Version = 2 };
int minimum;
int maximum;
@@ -405,6 +322,9 @@ public:
QString text;
Qt::Alignment textAlignment;
bool textVisible;
+ Qt::Orientation orientation;
+ bool invertedAppearance;
+ bool bottomToTop;
QStyleOptionProgressBar();
QStyleOptionProgressBar(const QStyleOptionProgressBar &other) : QStyleOption(Version, Type) { *this = other; }
@@ -413,24 +333,7 @@ protected:
QStyleOptionProgressBar(int version);
};
-// Adds style info for vertical progress bars
-class Q_WIDGETS_EXPORT QStyleOptionProgressBarV2 : public QStyleOptionProgressBar
-{
-public:
- enum StyleOptionType { Type = SO_ProgressBar };
- enum StyleOptionVersion { Version = 2 };
- Qt::Orientation orientation;
- bool invertedAppearance;
- bool bottomToTop;
-
- QStyleOptionProgressBarV2();
- QStyleOptionProgressBarV2(const QStyleOptionProgressBar &other);
- QStyleOptionProgressBarV2(const QStyleOptionProgressBarV2 &other);
- QStyleOptionProgressBarV2 &operator=(const QStyleOptionProgressBar &other);
-
-protected:
- QStyleOptionProgressBarV2(int version);
-};
+typedef QStyleOptionProgressBar QStyleOptionProgressBarV2;
class Q_WIDGETS_EXPORT QStyleOptionMenuItem : public QStyleOption
{
@@ -505,12 +408,13 @@ class Q_WIDGETS_EXPORT QStyleOptionDockWidget : public QStyleOption
{
public:
enum StyleOptionType { Type = SO_DockWidget };
- enum StyleOptionVersion { Version = 1 };
+ enum StyleOptionVersion { Version = 2 };
QString title;
bool closable;
bool movable;
bool floatable;
+ bool verticalTitleBar;
QStyleOptionDockWidget();
QStyleOptionDockWidget(const QStyleOptionDockWidget &other) : QStyleOption(Version, Type) { *this = other; }
@@ -519,28 +423,15 @@ protected:
QStyleOptionDockWidget(int version);
};
-class Q_WIDGETS_EXPORT QStyleOptionDockWidgetV2 : public QStyleOptionDockWidget
-{
-public:
- enum StyleOptionVersion { Version = 2 };
-
- bool verticalTitleBar;
+typedef QStyleOptionDockWidget QStyleOptionDockWidgetV2;
- QStyleOptionDockWidgetV2();
- QStyleOptionDockWidgetV2(const QStyleOptionDockWidgetV2 &other)
- : QStyleOptionDockWidget(Version) { *this = other; }
- QStyleOptionDockWidgetV2(const QStyleOptionDockWidget &other);
- QStyleOptionDockWidgetV2 &operator = (const QStyleOptionDockWidget &other);
-
-protected:
- QStyleOptionDockWidgetV2(int version);
-};
+#ifndef QT_NO_ITEMVIEWS
class Q_WIDGETS_EXPORT QStyleOptionViewItem : public QStyleOption
{
public:
enum StyleOptionType { Type = SO_ViewItem };
- enum StyleOptionVersion { Version = 1 };
+ enum StyleOptionVersion { Version = 4 };
enum Position { Left, Right, Top, Bottom };
@@ -552,18 +443,6 @@ public:
QFont font;
bool showDecorationSelected;
- QStyleOptionViewItem();
- QStyleOptionViewItem(const QStyleOptionViewItem &other) : QStyleOption(Version, Type) { *this = other; }
-
-protected:
- QStyleOptionViewItem(int version);
-};
-
-class Q_WIDGETS_EXPORT QStyleOptionViewItemV2 : public QStyleOptionViewItem
-{
-public:
- enum StyleOptionVersion { Version = 2 };
-
enum ViewItemFeature {
None = 0x00,
WrapText = 0x01,
@@ -576,40 +455,9 @@ public:
ViewItemFeatures features;
- QStyleOptionViewItemV2();
- QStyleOptionViewItemV2(const QStyleOptionViewItemV2 &other) : QStyleOptionViewItem(Version) { *this = other; }
- QStyleOptionViewItemV2(const QStyleOptionViewItem &other);
- QStyleOptionViewItemV2 &operator=(const QStyleOptionViewItem &other);
-
-protected:
- QStyleOptionViewItemV2(int version);
-};
-
-Q_DECLARE_OPERATORS_FOR_FLAGS(QStyleOptionViewItemV2::ViewItemFeatures)
-
-class Q_WIDGETS_EXPORT QStyleOptionViewItemV3 : public QStyleOptionViewItemV2
-{
-public:
- enum StyleOptionVersion { Version = 3 };
-
QLocale locale;
const QWidget *widget;
- QStyleOptionViewItemV3();
- QStyleOptionViewItemV3(const QStyleOptionViewItemV3 &other)
- : QStyleOptionViewItemV2(Version) { *this = other; }
- QStyleOptionViewItemV3(const QStyleOptionViewItem &other);
- QStyleOptionViewItemV3 &operator = (const QStyleOptionViewItem &other);
-
-protected:
- QStyleOptionViewItemV3(int version);
-};
-
-#ifndef QT_NO_ITEMVIEWS
-class Q_WIDGETS_EXPORT QStyleOptionViewItemV4 : public QStyleOptionViewItemV3
-{
-public:
- enum StyleOptionVersion { Version = 4 };
enum ViewItemPosition { Invalid, Beginning, Middle, End, OnlyOne };
QModelIndex index;
@@ -619,52 +467,45 @@ public:
ViewItemPosition viewItemPosition;
QBrush backgroundBrush;
- QStyleOptionViewItemV4();
- QStyleOptionViewItemV4(const QStyleOptionViewItemV4 &other)
- : QStyleOptionViewItemV3(Version) { *this = other; }
- QStyleOptionViewItemV4(const QStyleOptionViewItem &other);
- QStyleOptionViewItemV4 &operator = (const QStyleOptionViewItem &other);
+ QStyleOptionViewItem();
+ QStyleOptionViewItem(const QStyleOptionViewItem &other) : QStyleOption(Version, Type) { *this = other; }
protected:
- QStyleOptionViewItemV4(int version);
+ QStyleOptionViewItem(int version);
};
-#endif
+
+Q_DECLARE_OPERATORS_FOR_FLAGS(QStyleOptionViewItem::ViewItemFeatures)
+
+typedef QStyleOptionViewItem QStyleOptionViewItemV2;
+typedef QStyleOptionViewItem QStyleOptionViewItemV3;
+typedef QStyleOptionViewItem QStyleOptionViewItemV4;
+
+#endif // QT_NO_ITEMVIEWS
class Q_WIDGETS_EXPORT QStyleOptionToolBox : public QStyleOption
{
public:
enum StyleOptionType { Type = SO_ToolBox };
- enum StyleOptionVersion { Version = 1 };
+ enum StyleOptionVersion { Version = 2 };
QString text;
QIcon icon;
- QStyleOptionToolBox();
- QStyleOptionToolBox(const QStyleOptionToolBox &other) : QStyleOption(Version, Type) { *this = other; }
-
-protected:
- QStyleOptionToolBox(int version);
-};
-
-class Q_WIDGETS_EXPORT QStyleOptionToolBoxV2 : public QStyleOptionToolBox
-{
-public:
- enum StyleOptionVersion { Version = 2 };
enum TabPosition { Beginning, Middle, End, OnlyOneTab };
enum SelectedPosition { NotAdjacent, NextIsSelected, PreviousIsSelected };
TabPosition position;
SelectedPosition selectedPosition;
- QStyleOptionToolBoxV2();
- QStyleOptionToolBoxV2(const QStyleOptionToolBoxV2 &other) : QStyleOptionToolBox(Version) { *this = other; }
- QStyleOptionToolBoxV2(const QStyleOptionToolBox &other);
- QStyleOptionToolBoxV2 &operator=(const QStyleOptionToolBox &other);
+ QStyleOptionToolBox();
+ QStyleOptionToolBox(const QStyleOptionToolBox &other) : QStyleOption(Version, Type) { *this = other; }
protected:
- QStyleOptionToolBoxV2(int version);
+ QStyleOptionToolBox(int version);
};
+typedef QStyleOptionToolBox QStyleOptionToolBoxV2;
+
#ifndef QT_NO_RUBBERBAND
class Q_WIDGETS_EXPORT QStyleOptionRubberBand : public QStyleOption
{
diff --git a/src/widgets/styles/qstylepainter.cpp b/src/widgets/styles/qstylepainter.cpp
index 9870f01dd0..b15b9d1a38 100644
--- a/src/widgets/styles/qstylepainter.cpp
+++ b/src/widgets/styles/qstylepainter.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/styles/qstylepainter.h b/src/widgets/styles/qstylepainter.h
index 56c6684507..f30124aa25 100644
--- a/src/widgets/styles/qstylepainter.h
+++ b/src/widgets/styles/qstylepainter.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -50,7 +50,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
class QStylePainter : public QPainter
{
diff --git a/src/widgets/styles/qstyleplugin.cpp b/src/widgets/styles/qstyleplugin.cpp
index 8a169d9797..74c29f39c8 100644
--- a/src/widgets/styles/qstyleplugin.cpp
+++ b/src/widgets/styles/qstyleplugin.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/styles/qstyleplugin.h b/src/widgets/styles/qstyleplugin.h
index c9a35caaa4..883952eced 100644
--- a/src/widgets/styles/qstyleplugin.h
+++ b/src/widgets/styles/qstyleplugin.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -49,7 +49,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
class QStyle;
@@ -58,7 +57,7 @@ struct Q_WIDGETS_EXPORT QStyleFactoryInterface : public QFactoryInterface
virtual QStyle *create(const QString &key) = 0;
};
-#define QStyleFactoryInterface_iid "com.trolltech.Qt.QStyleFactoryInterface"
+#define QStyleFactoryInterface_iid "org.qt-project.Qt.QStyleFactoryInterface"
Q_DECLARE_INTERFACE(QStyleFactoryInterface, QStyleFactoryInterface_iid)
diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp
index b384ff7681..30c6ed5e74 100644
--- a/src/widgets/styles/qstylesheetstyle.cpp
+++ b/src/widgets/styles/qstylesheetstyle.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/styles/qstylesheetstyle_default.cpp b/src/widgets/styles/qstylesheetstyle_default.cpp
index 580232f326..f22a6d16b5 100644
--- a/src/widgets/styles/qstylesheetstyle_default.cpp
+++ b/src/widgets/styles/qstylesheetstyle_default.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -158,8 +158,7 @@ StyleSheet QStyleSheetStyle::getDefaultStyleSheet() const
// pixmap based style doesn't support any features
bool styleIsPixmapBased = baseStyle()->inherits("QMacStyle")
|| baseStyle()->inherits("QWindowsXPStyle")
- || baseStyle()->inherits("QGtkStyle")
- || baseStyle()->inherits("QS60Style");
+ || baseStyle()->inherits("QGtkStyle");
/*QLineEdit {
diff --git a/src/widgets/styles/qstylesheetstyle_p.h b/src/widgets/styles/qstylesheetstyle_p.h
index 2d89f784d4..42a29b82f2 100644
--- a/src/widgets/styles/qstylesheetstyle_p.h
+++ b/src/widgets/styles/qstylesheetstyle_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/styles/qwindowscestyle.cpp b/src/widgets/styles/qwindowscestyle.cpp
index fd3a391e54..72f7426268 100644
--- a/src/widgets/styles/qwindowscestyle.cpp
+++ b/src/widgets/styles/qwindowscestyle.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/styles/qwindowscestyle.h b/src/widgets/styles/qwindowscestyle.h
index dbb83a910e..70d2c3c7c2 100644
--- a/src/widgets/styles/qwindowscestyle.h
+++ b/src/widgets/styles/qwindowscestyle.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -48,7 +48,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
#if !defined(QT_NO_STYLE_WINDOWSCE)
diff --git a/src/widgets/styles/qwindowscestyle_p.h b/src/widgets/styles/qwindowscestyle_p.h
index 6b3b9a8bfe..505826ecf3 100644
--- a/src/widgets/styles/qwindowscestyle_p.h
+++ b/src/widgets/styles/qwindowscestyle_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/styles/qwindowsmobilestyle.cpp b/src/widgets/styles/qwindowsmobilestyle.cpp
index efba73fe80..284d42dacc 100644
--- a/src/widgets/styles/qwindowsmobilestyle.cpp
+++ b/src/widgets/styles/qwindowsmobilestyle.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/styles/qwindowsmobilestyle.h b/src/widgets/styles/qwindowsmobilestyle.h
index 65eb08707f..e80c8251a5 100644
--- a/src/widgets/styles/qwindowsmobilestyle.h
+++ b/src/widgets/styles/qwindowsmobilestyle.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -48,7 +48,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
#if !defined(QT_NO_STYLE_WINDOWSMOBILE)
diff --git a/src/widgets/styles/qwindowsmobilestyle_p.h b/src/widgets/styles/qwindowsmobilestyle_p.h
index 23b395e3a6..d536afe50e 100644
--- a/src/widgets/styles/qwindowsmobilestyle_p.h
+++ b/src/widgets/styles/qwindowsmobilestyle_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/styles/qwindowsstyle.cpp b/src/widgets/styles/qwindowsstyle.cpp
index 1029433fe6..295d46963e 100644
--- a/src/widgets/styles/qwindowsstyle.cpp
+++ b/src/widgets/styles/qwindowsstyle.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/styles/qwindowsstyle.h b/src/widgets/styles/qwindowsstyle.h
index 5392409882..3f0f99dee6 100644
--- a/src/widgets/styles/qwindowsstyle.h
+++ b/src/widgets/styles/qwindowsstyle.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -48,7 +48,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
#if !defined(QT_NO_STYLE_WINDOWS)
diff --git a/src/widgets/styles/qwindowsstyle_p.h b/src/widgets/styles/qwindowsstyle_p.h
index 9861172873..c1bcd28c2a 100644
--- a/src/widgets/styles/qwindowsstyle_p.h
+++ b/src/widgets/styles/qwindowsstyle_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/styles/qwindowsvistastyle.cpp b/src/widgets/styles/qwindowsvistastyle.cpp
index bbc07a5bd9..1aecb64acf 100644
--- a/src/widgets/styles/qwindowsvistastyle.cpp
+++ b/src/widgets/styles/qwindowsvistastyle.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/styles/qwindowsvistastyle.h b/src/widgets/styles/qwindowsvistastyle.h
index dec8f16aee..139a125a52 100644
--- a/src/widgets/styles/qwindowsvistastyle.h
+++ b/src/widgets/styles/qwindowsvistastyle.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -48,7 +48,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
#if !defined(QT_NO_STYLE_WINDOWSVISTA)
diff --git a/src/widgets/styles/qwindowsvistastyle_p.h b/src/widgets/styles/qwindowsvistastyle_p.h
index 8ed2ec421e..7205ad2d19 100644
--- a/src/widgets/styles/qwindowsvistastyle_p.h
+++ b/src/widgets/styles/qwindowsvistastyle_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/styles/qwindowsxpstyle.cpp b/src/widgets/styles/qwindowsxpstyle.cpp
index d8b33f3b0f..63d275a391 100644
--- a/src/widgets/styles/qwindowsxpstyle.cpp
+++ b/src/widgets/styles/qwindowsxpstyle.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -136,7 +136,24 @@ static const int windowsRightBorder = 12; // right border on windows
extern Q_WIDGETS_EXPORT HDC qt_win_display_dc();
extern QRegion qt_region_from_HRGN(HRGN rgn);
+static inline QBackingStore *backingStoreForWidget(const QWidget *widget)
+{
+ if (QBackingStore *backingStore = widget->backingStore())
+ return backingStore;
+ if (const QWidget *topLevel = widget->nativeParentWidget())
+ if (QBackingStore *topLevelBackingStore = topLevel->backingStore())
+ return topLevelBackingStore;
+ return 0;
+}
+static inline HDC hdcForWidgetBackingStore(const QWidget *widget)
+{
+ if (QBackingStore *backingStore = backingStoreForWidget(widget)) {
+ QPlatformNativeInterface *nativeInterface = QGuiApplication::platformNativeInterface();
+ return static_cast<HDC>(nativeInterface->nativeResourceForBackingStore(QByteArrayLiteral("getDC"), backingStore));
+ }
+ return 0;
+}
// Theme data helper ------------------------------------------------------------------------------
/* \internal
@@ -159,14 +176,14 @@ HTHEME XPThemeData::handle()
return 0;
if (!htheme && QWindowsXPStylePrivate::handleMap)
- htheme = QWindowsXPStylePrivate::handleMap->operator[](name);
+ htheme = QWindowsXPStylePrivate::handleMap->value(name);
if (!htheme) {
htheme = pOpenThemeData(QWindowsXPStylePrivate::winId(widget), (wchar_t*)name.utf16());
if (htheme) {
if (!QWindowsXPStylePrivate::handleMap)
- QWindowsXPStylePrivate::handleMap = new QMap<QString, HTHEME>;
- QWindowsXPStylePrivate::handleMap->operator[](name) = htheme;
+ QWindowsXPStylePrivate::handleMap = new QWindowsXPStylePrivate::ThemeHandleMap;
+ QWindowsXPStylePrivate::handleMap->insert(name, htheme);
}
}
@@ -197,11 +214,8 @@ HRGN XPThemeData::mask(QWidget *widget)
HRGN hrgn;
HDC dc = 0;
- if (widget) {
- QBackingStore *backingStore = widget->backingStore();
- QPlatformNativeInterface *nativeInterface = QGuiApplication::platformNativeInterface();
- dc = static_cast<HDC>(nativeInterface->nativeResourceForBackingStore("getDC", backingStore));
- }
+ if (widget)
+ dc = hdcForWidgetBackingStore(widget);
RECT nativeRect = toRECT(rect);
pGetThemeBackgroundRegion(handle(), dc, partId, stateId, &nativeRect, &hrgn);
return hrgn;
@@ -209,7 +223,6 @@ HRGN XPThemeData::mask(QWidget *widget)
// QWindowsXPStylePrivate -------------------------------------------------------------------------
// Static initializations
-QWidget *QWindowsXPStylePrivate::limboWidget = 0;
QPixmap *QWindowsXPStylePrivate::tabbody = 0;
QMap<QString,HTHEME> *QWindowsXPStylePrivate::handleMap = 0;
bool QWindowsXPStylePrivate::use_xp = false;
@@ -289,14 +302,7 @@ void QWindowsXPStylePrivate::cleanup(bool force)
use_xp = false;
cleanupHandleMap();
- if (limboWidget) {
- if (QApplication::closingDown())
- delete limboWidget;
- else
- limboWidget->deleteLater();
- }
delete tabbody;
- limboWidget = 0;
tabbody = 0;
}
@@ -307,11 +313,13 @@ void QWindowsXPStylePrivate::cleanup(bool force)
*/
void QWindowsXPStylePrivate::cleanupHandleMap()
{
+ typedef ThemeHandleMap::const_iterator ConstIterator;
+
if (!handleMap)
return;
- QMap<QString, HTHEME>::Iterator it;
- for (it = handleMap->begin(); it != handleMap->end(); ++it)
+ const ConstIterator cend = handleMap->constEnd();
+ for (ConstIterator it = handleMap->constBegin(); it != cend; ++it)
pCloseThemeData(it.value());
delete handleMap;
handleMap = 0;
@@ -325,20 +333,22 @@ void QWindowsXPStylePrivate::cleanupHandleMap()
*/
HWND QWindowsXPStylePrivate::winId(const QWidget *widget)
{
- if (widget && widget->internalWinId()) {
- QWidget *w = const_cast<QWidget *>(widget);
- return QApplicationPrivate::getHWNDForWidget(w);
- }
- if (!limboWidget) {
- limboWidget = new QWidget(0);
- limboWidget->createWinId();
- limboWidget->setObjectName(QLatin1String("xp_limbo_widget"));
- // We don't need this internal widget to appear in QApplication::topLevelWidgets()
- if (QWidgetPrivate::allWidgets)
- QWidgetPrivate::allWidgets->remove(limboWidget);
- }
+ if (widget)
+ if (const HWND hwnd = QApplicationPrivate::getHWNDForWidget(const_cast<QWidget *>(widget)))
+ return hwnd;
- return QApplicationPrivate::getHWNDForWidget(limboWidget);
+ const QWidgetList toplevels = QApplication::topLevelWidgets();
+ if (!toplevels.isEmpty())
+ if (const HWND topLevelHwnd = QApplicationPrivate::getHWNDForWidget(toplevels.front()))
+ return topLevelHwnd;
+
+ if (QDesktopWidget *desktop = qApp->desktop())
+ if (const HWND desktopHwnd = QApplicationPrivate::getHWNDForWidget(desktop))
+ return desktopHwnd;
+
+ Q_ASSERT(false);
+
+ return 0;
}
/*! \internal
@@ -686,25 +696,18 @@ void QWindowsXPStylePrivate::drawBackground(XPThemeData &themeData)
translucentToplevel = win->testAttribute(Qt::WA_TranslucentBackground);
}
- HDC dc = 0;
- if (themeData.widget) {
- QBackingStore *backingStore = themeData.widget->backingStore();
- QPlatformNativeInterface *nativeInterface = QGuiApplication::platformNativeInterface();
- dc = static_cast<HDC>(nativeInterface->nativeResourceForBackingStore("getDC", backingStore ));
- }
-
- bool useFallback = dc == 0
- || painter->opacity() != 1.0
- || themeData.rotate
- || complexXForm
- || themeData.mirrorVertically
- || (themeData.mirrorHorizontally && pDrawThemeBackgroundEx == 0)
- || translucentToplevel;
-
- if (!useFallback)
+ // Draw on backing store DC only for real widgets.
+ const bool useFallback = !themeData.widget || painter->device()->devType() != QInternal::Widget
+ || painter->opacity() != 1.0 || themeData.rotate
+ || complexXForm || themeData.mirrorVertically
+ || (themeData.mirrorHorizontally && pDrawThemeBackgroundEx == 0)
+ || translucentToplevel;
+ const HDC dc = useFallback ? HDC(0) : hdcForWidgetBackingStore(themeData.widget);
+ if (dc && !useFallback) {
drawBackgroundDirectly(themeData);
- else
+ } else {
drawBackgroundThruNativeBuffer(themeData);
+ }
painter->restore();
}
@@ -718,11 +721,8 @@ void QWindowsXPStylePrivate::drawBackgroundDirectly(XPThemeData &themeData)
{
QPainter *painter = themeData.painter;
HDC dc = 0;
- if (themeData.widget) {
- QBackingStore *backingStore = themeData.widget->backingStore();
- QPlatformNativeInterface *nativeInterface = QGuiApplication::platformNativeInterface();
- dc = static_cast<HDC>(nativeInterface->nativeResourceForBackingStore("getDC", backingStore));
- }
+ if (themeData.widget)
+ dc = hdcForWidgetBackingStore(themeData.widget);
QPoint redirectionDelta(int(painter->deviceMatrix().dx()),
int(painter->deviceMatrix().dy()));
diff --git a/src/widgets/styles/qwindowsxpstyle.h b/src/widgets/styles/qwindowsxpstyle.h
index 87bccc2271..6e0eb57688 100644
--- a/src/widgets/styles/qwindowsxpstyle.h
+++ b/src/widgets/styles/qwindowsxpstyle.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -48,7 +48,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
#if !defined(QT_NO_STYLE_WINDOWSXP)
diff --git a/src/widgets/styles/qwindowsxpstyle_p.h b/src/widgets/styles/qwindowsxpstyle_p.h
index 1fb89cb478..0e42bbfa39 100644
--- a/src/widgets/styles/qwindowsxpstyle_p.h
+++ b/src/widgets/styles/qwindowsxpstyle_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -286,6 +286,8 @@ class QWindowsXPStylePrivate : public QWindowsStylePrivate
{
Q_DECLARE_PUBLIC(QWindowsXPStyle)
public:
+ typedef QMap<QString, HTHEME> ThemeHandleMap;
+
QWindowsXPStylePrivate()
: QWindowsStylePrivate(), hasInitColors(false), bufferDC(0), bufferBitmap(0), nullBitmap(0),
bufferPixels(0), bufferW(0), bufferH(0)
@@ -326,7 +328,7 @@ public:
QRgb sliderTickColor;
bool hasInitColors;
- static QMap<QString,HTHEME> *handleMap;
+ static ThemeHandleMap *handleMap;
QIcon dockFloat, dockClose;
@@ -338,7 +340,6 @@ private:
static QBasicAtomicInt ref;
static bool use_xp;
- static QWidget *limboWidget;
static QPixmap *tabbody;
QHash<ThemeMapKey, ThemeMapData> alphaCache;
diff --git a/src/widgets/util/qcolormap.h b/src/widgets/util/qcolormap.h
index c0c3643985..3e7dc96222 100644
--- a/src/widgets/util/qcolormap.h
+++ b/src/widgets/util/qcolormap.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -51,7 +51,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
class QColor;
class QColormapPrivate;
diff --git a/src/widgets/util/qcolormap.qdoc b/src/widgets/util/qcolormap.qdoc
index fd6da862ec..86e7162cc9 100644
--- a/src/widgets/util/qcolormap.qdoc
+++ b/src/widgets/util/qcolormap.qdoc
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the documentation of the Qt Toolkit.
**
@@ -21,6 +20,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/util/qcolormap_qpa.cpp b/src/widgets/util/qcolormap_qpa.cpp
index 284809af24..8c24a25b66 100644
--- a/src/widgets/util/qcolormap_qpa.cpp
+++ b/src/widgets/util/qcolormap_qpa.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/util/qcompleter.cpp b/src/widgets/util/qcompleter.cpp
index aa38aba08e..503e5aa596 100644
--- a/src/widgets/util/qcompleter.cpp
+++ b/src/widgets/util/qcompleter.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -494,7 +494,7 @@ QMatchData QCompletionEngine::filterHistory()
for (int i = 0; i < source->rowCount(); i++) {
QString str = source->index(i, c->column).data().toString();
if (str.startsWith(c->prefix, c->cs)
-#if (!defined(Q_OS_WIN) || defined(Q_OS_WINCE)) && !defined(Q_OS_SYMBIAN)
+#if !defined(Q_OS_WIN) || defined(Q_OS_WINCE)
&& ((!isFsModel && !isDirModel) || QDir::toNativeSeparators(str) != QDir::separator())
#endif
)
@@ -1036,7 +1036,7 @@ void QCompleter::setModel(QAbstractItemModel *model)
delete oldModel;
#ifndef QT_NO_DIRMODEL
if (qobject_cast<QDirModel *>(model)) {
-#if (defined(Q_OS_WIN) && !defined(Q_OS_WINCE)) || defined(Q_OS_SYMBIAN)
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
setCaseSensitivity(Qt::CaseInsensitive);
#else
setCaseSensitivity(Qt::CaseSensitive);
@@ -1046,7 +1046,7 @@ void QCompleter::setModel(QAbstractItemModel *model)
#ifndef QT_NO_FILESYSTEMMODEL
QFileSystemModel *fsModel = qobject_cast<QFileSystemModel *>(model);
if (fsModel) {
-#if (defined(Q_OS_WIN) && !defined(Q_OS_WINCE)) || defined(Q_OS_SYMBIAN)
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
setCaseSensitivity(Qt::CaseInsensitive);
#else
setCaseSensitivity(Qt::CaseSensitive);
@@ -1725,7 +1725,7 @@ QString QCompleter::pathFromIndex(const QModelIndex& index) const
idx = parent.sibling(parent.row(), index.column());
} while (idx.isValid());
-#if (!defined(Q_OS_WIN) || defined(Q_OS_WINCE)) && !defined(Q_OS_SYMBIAN)
+#if !defined(Q_OS_WIN) || defined(Q_OS_WINCE)
if (list.count() == 1) // only the separator or some other text
return list[0];
list[0].clear() ; // the join below will provide the separator
@@ -1766,10 +1766,7 @@ QStringList QCompleter::splitPath(const QString& path) const
QString pathCopy = QDir::toNativeSeparators(path);
QString sep = QDir::separator();
-#if defined(Q_OS_SYMBIAN)
- if (pathCopy == QLatin1String("\\"))
- return QStringList(pathCopy);
-#elif defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
if (pathCopy == QLatin1String("\\") || pathCopy == QLatin1String("\\\\"))
return QStringList(pathCopy);
QString doubleSlash(QLatin1String("\\\\"));
@@ -1782,9 +1779,7 @@ QStringList QCompleter::splitPath(const QString& path) const
QRegExp re(QLatin1Char('[') + QRegExp::escape(sep) + QLatin1Char(']'));
QStringList parts = pathCopy.split(re);
-#if defined(Q_OS_SYMBIAN)
- // Do nothing
-#elif defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
if (!doubleSlash.isEmpty())
parts[0].prepend(doubleSlash);
#else
diff --git a/src/widgets/util/qcompleter.h b/src/widgets/util/qcompleter.h
index 68fe22f88f..c5420897f8 100644
--- a/src/widgets/util/qcompleter.h
+++ b/src/widgets/util/qcompleter.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -52,7 +52,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
#ifndef QT_NO_COMPLETER
diff --git a/src/widgets/util/qcompleter_p.h b/src/widgets/util/qcompleter_p.h
index 94287c1ebf..619b40d126 100644
--- a/src/widgets/util/qcompleter_p.h
+++ b/src/widgets/util/qcompleter_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/util/qflickgesture.cpp b/src/widgets/util/qflickgesture.cpp
index 843a2fa95c..b8352c63b6 100644
--- a/src/widgets/util/qflickgesture.cpp
+++ b/src/widgets/util/qflickgesture.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/util/qflickgesture_p.h b/src/widgets/util/qflickgesture_p.h
index 6a9630ede6..b806e9ac22 100644
--- a/src/widgets/util/qflickgesture_p.h
+++ b/src/widgets/util/qflickgesture_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/util/qscroller.cpp b/src/widgets/util/qscroller.cpp
index fac6809ac6..4482134c7b 100644
--- a/src/widgets/util/qscroller.cpp
+++ b/src/widgets/util/qscroller.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -568,7 +568,7 @@ void QScroller::stop()
\note Please note that this value should be physically correct. The actual DPI settings
that Qt returns for the display may be reported wrongly on purpose by the underlying
- windowing system, for example on Mac OS X or Maemo 5.
+ windowing system, for example on Mac OS X.
*/
QPointF QScroller::pixelPerMeter() const
{
@@ -1018,16 +1018,7 @@ bool QScroller::handleInput(Input input, const QPointF &position, qint64 timesta
QPointF QScrollerPrivate::realDpi(int screen)
{
-# ifdef Q_WS_MAEMO_5
- Q_UNUSED(screen);
-
- // The DPI value is hardcoded to 96 on Maemo5:
- // https://projects.maemo.org/bugzilla/show_bug.cgi?id=152525
- // This value (260) is only correct for the N900 though, but
- // there's no way to get the real DPI at run time.
- return QPointF(260, 260);
-
-# elif defined(Q_WS_X11) && !defined(QT_NO_XRANDR)
+# if defined(Q_WS_X11) && !defined(QT_NO_XRANDR)
if (X11 && X11->use_xrandr && X11->ptrXRRSizes && X11->ptrXRRRootToScreen) {
int nsizes = 0;
// QDesktopWidget is based on Xinerama screens, which do not always
diff --git a/src/widgets/util/qscroller.h b/src/widgets/util/qscroller.h
index 01d45a908e..c345f740d2 100644
--- a/src/widgets/util/qscroller.h
+++ b/src/widgets/util/qscroller.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -50,7 +50,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
class QWidget;
class QScrollerPrivate;
diff --git a/src/widgets/util/qscroller_mac.mm b/src/widgets/util/qscroller_mac.mm
index 495469a04b..cf166b7799 100644
--- a/src/widgets/util/qscroller_mac.mm
+++ b/src/widgets/util/qscroller_mac.mm
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/util/qscroller_p.h b/src/widgets/util/qscroller_p.h
index 3b9fa988fe..6463f03573 100644
--- a/src/widgets/util/qscroller_p.h
+++ b/src/widgets/util/qscroller_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/util/qscrollerproperties.cpp b/src/widgets/util/qscrollerproperties.cpp
index 3a41aa7eb9..6a61e4dfd1 100644
--- a/src/widgets/util/qscrollerproperties.cpp
+++ b/src/widgets/util/qscrollerproperties.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/util/qscrollerproperties.h b/src/widgets/util/qscrollerproperties.h
index e7bcdbebe3..76d301894e 100644
--- a/src/widgets/util/qscrollerproperties.h
+++ b/src/widgets/util/qscrollerproperties.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -50,7 +50,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
class QScroller;
class QScrollerPrivate;
diff --git a/src/widgets/util/qscrollerproperties_p.h b/src/widgets/util/qscrollerproperties_p.h
index 8c51f7aa4b..a241ec54b1 100644
--- a/src/widgets/util/qscrollerproperties_p.h
+++ b/src/widgets/util/qscrollerproperties_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/util/qsystemtrayicon.cpp b/src/widgets/util/qsystemtrayicon.cpp
index 5803c2fef4..321323733b 100644
--- a/src/widgets/util/qsystemtrayicon.cpp
+++ b/src/widgets/util/qsystemtrayicon.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/util/qsystemtrayicon.h b/src/widgets/util/qsystemtrayicon.h
index 0f1e7d74ee..96f9a1d2f4 100644
--- a/src/widgets/util/qsystemtrayicon.h
+++ b/src/widgets/util/qsystemtrayicon.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -52,7 +52,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
class QSystemTrayIconPrivate;
diff --git a/src/widgets/util/qsystemtrayicon_mac.mm b/src/widgets/util/qsystemtrayicon_mac.mm
index 278fa72a1a..59342cb8a4 100644
--- a/src/widgets/util/qsystemtrayicon_mac.mm
+++ b/src/widgets/util/qsystemtrayicon_mac.mm
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/util/qsystemtrayicon_p.h b/src/widgets/util/qsystemtrayicon_p.h
index 7b743021e0..cf7d794696 100644
--- a/src/widgets/util/qsystemtrayicon_p.h
+++ b/src/widgets/util/qsystemtrayicon_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/util/qsystemtrayicon_qpa.cpp b/src/widgets/util/qsystemtrayicon_qpa.cpp
index ce0e067648..be1da708f5 100644
--- a/src/widgets/util/qsystemtrayicon_qpa.cpp
+++ b/src/widgets/util/qsystemtrayicon_qpa.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/util/qsystemtrayicon_win.cpp b/src/widgets/util/qsystemtrayicon_win.cpp
index 6045116da5..fdb308c3d6 100644
--- a/src/widgets/util/qsystemtrayicon_win.cpp
+++ b/src/widgets/util/qsystemtrayicon_win.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/util/qsystemtrayicon_wince.cpp b/src/widgets/util/qsystemtrayicon_wince.cpp
index b1dbb8b85e..817c651fe1 100644
--- a/src/widgets/util/qsystemtrayicon_wince.cpp
+++ b/src/widgets/util/qsystemtrayicon_wince.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/util/qsystemtrayicon_x11.cpp b/src/widgets/util/qsystemtrayicon_x11.cpp
index 3ac3755f84..c5071b339d 100644
--- a/src/widgets/util/qsystemtrayicon_x11.cpp
+++ b/src/widgets/util/qsystemtrayicon_x11.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/util/qundogroup.cpp b/src/widgets/util/qundogroup.cpp
index fd063b7e9f..c08c824bdf 100644
--- a/src/widgets/util/qundogroup.cpp
+++ b/src/widgets/util/qundogroup.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/util/qundogroup.h b/src/widgets/util/qundogroup.h
index fe06a678eb..3fb66d2d85 100644
--- a/src/widgets/util/qundogroup.h
+++ b/src/widgets/util/qundogroup.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -53,7 +53,6 @@ class QUndoGroupPrivate;
class QUndoStack;
class QAction;
-QT_MODULE(Gui)
#ifndef QT_NO_UNDOGROUP
diff --git a/src/widgets/util/qundostack.cpp b/src/widgets/util/qundostack.cpp
index 5f2ba870e0..7cd77678e6 100644
--- a/src/widgets/util/qundostack.cpp
+++ b/src/widgets/util/qundostack.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/util/qundostack.h b/src/widgets/util/qundostack.h
index fc2c82ecf4..ceb997e6da 100644
--- a/src/widgets/util/qundostack.h
+++ b/src/widgets/util/qundostack.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -49,7 +49,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
class QAction;
class QUndoCommandPrivate;
diff --git a/src/widgets/util/qundostack_p.h b/src/widgets/util/qundostack_p.h
index 31dff8452c..2b9735b7a7 100644
--- a/src/widgets/util/qundostack_p.h
+++ b/src/widgets/util/qundostack_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/util/qundoview.cpp b/src/widgets/util/qundoview.cpp
index c498355f1f..4b09d5fc70 100644
--- a/src/widgets/util/qundoview.cpp
+++ b/src/widgets/util/qundoview.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/util/qundoview.h b/src/widgets/util/qundoview.h
index ee944dd259..4e117297a4 100644
--- a/src/widgets/util/qundoview.h
+++ b/src/widgets/util/qundoview.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -56,7 +56,6 @@ class QUndoStack;
class QUndoGroup;
class QIcon;
-QT_MODULE(Gui)
class Q_WIDGETS_EXPORT QUndoView : public QListView
{
diff --git a/src/widgets/widgets/qabstractbutton.cpp b/src/widgets/widgets/qabstractbutton.cpp
index efe0ff3389..a398cc1567 100644
--- a/src/widgets/widgets/qabstractbutton.cpp
+++ b/src/widgets/widgets/qabstractbutton.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -503,7 +503,7 @@ void QAbstractButtonPrivate::refresh()
return;
q->update();
#ifndef QT_NO_ACCESSIBILITY
- QAccessible::updateAccessibility(q, 0, QAccessible::StateChanged);
+ QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::StateChanged, q, 0));
#endif
}
@@ -645,7 +645,7 @@ void QAbstractButton::setText(const QString &text)
update();
updateGeometry();
#ifndef QT_NO_ACCESSIBILITY
- QAccessible::updateAccessibility(this, 0, QAccessible::NameChanged);
+ QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::NameChanged, this, 0));
#endif
}
diff --git a/src/widgets/widgets/qabstractbutton.h b/src/widgets/widgets/qabstractbutton.h
index 9b3aa5642a..37a37f6de4 100644
--- a/src/widgets/widgets/qabstractbutton.h
+++ b/src/widgets/widgets/qabstractbutton.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -50,7 +50,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
class QButtonGroup;
class QAbstractButtonPrivate;
diff --git a/src/widgets/widgets/qabstractbutton_p.h b/src/widgets/widgets/qabstractbutton_p.h
index 9688d27773..8d55712772 100644
--- a/src/widgets/widgets/qabstractbutton_p.h
+++ b/src/widgets/widgets/qabstractbutton_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/widgets/qabstractscrollarea.cpp b/src/widgets/widgets/qabstractscrollarea.cpp
index 655ed83069..03ec21680d 100644
--- a/src/widgets/widgets/qabstractscrollarea.cpp
+++ b/src/widgets/widgets/qabstractscrollarea.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -64,9 +64,9 @@
#include <private/qt_mac_p.h>
#include <private/qt_cocoa_helpers_mac_p.h>
#endif
-#ifdef Q_WS_WIN
+#ifdef Q_OS_WIN
# include <qlibrary.h>
-# include <windows.h>
+# include <qt_windows.h>
#endif
QT_BEGIN_NAMESPACE
@@ -306,11 +306,6 @@ void QAbstractScrollAreaPrivate::init()
viewport->grabGesture(Qt::PanGesture);
# endif
#endif
-#ifdef Q_WS_MAEMO_5
-# ifndef QT_NO_GESTURES
- // viewport->grabGesture(Qt::TouchFlickGesture);
-# endif
-#endif
}
#ifdef Q_WS_WIN
@@ -564,11 +559,6 @@ void QAbstractScrollArea::setViewport(QWidget *widget)
d->viewport->grabGesture(Qt::PanGesture);
#endif
#endif
-#ifdef Q_WS_MAEMO_5
-#ifndef QT_NO_GESTURES
-// d->viewport->grabGesture(Qt::TouchFlickGesture);
-#endif
-#endif
d->layoutChildren();
if (isVisible())
d->viewport->show();
diff --git a/src/widgets/widgets/qabstractscrollarea.h b/src/widgets/widgets/qabstractscrollarea.h
index fe602468f9..f155f52920 100644
--- a/src/widgets/widgets/qabstractscrollarea.h
+++ b/src/widgets/widgets/qabstractscrollarea.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -48,7 +48,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
#ifndef QT_NO_SCROLLAREA
diff --git a/src/widgets/widgets/qabstractscrollarea_p.h b/src/widgets/widgets/qabstractscrollarea_p.h
index 2fe7e4423a..25c91359ae 100644
--- a/src/widgets/widgets/qabstractscrollarea_p.h
+++ b/src/widgets/widgets/qabstractscrollarea_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/widgets/qabstractslider.cpp b/src/widgets/widgets/qabstractslider.cpp
index d3dddde409..be193f64f0 100644
--- a/src/widgets/widgets/qabstractslider.cpp
+++ b/src/widgets/widgets/qabstractslider.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -538,7 +538,7 @@ void QAbstractSlider::setValue(int value)
emit sliderMoved((d->position = value));
}
#ifndef QT_NO_ACCESSIBILITY
- QAccessible::updateAccessibility(this, 0, QAccessible::ValueChanged);
+ QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::ValueChanged, this, 0));
#endif
sliderChange(SliderValueChange);
emit valueChanged(value);
diff --git a/src/widgets/widgets/qabstractslider.h b/src/widgets/widgets/qabstractslider.h
index a19fc37451..dbcd14cb67 100644
--- a/src/widgets/widgets/qabstractslider.h
+++ b/src/widgets/widgets/qabstractslider.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -48,7 +48,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
class QAbstractSliderPrivate;
diff --git a/src/widgets/widgets/qabstractslider_p.h b/src/widgets/widgets/qabstractslider_p.h
index a4589c5d18..d940a5da30 100644
--- a/src/widgets/widgets/qabstractslider_p.h
+++ b/src/widgets/widgets/qabstractslider_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/widgets/qabstractspinbox.cpp b/src/widgets/widgets/qabstractspinbox.cpp
index 4f5a135842..331b4918bd 100644
--- a/src/widgets/widgets/qabstractspinbox.cpp
+++ b/src/widgets/widgets/qabstractspinbox.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -976,7 +976,7 @@ void QAbstractSpinBox::keyPressEvent(QKeyEvent *event)
}
}
#ifndef QT_NO_ACCESSIBILITY
- QAccessible::updateAccessibility(this, 0, QAccessible::ValueChanged);
+ QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::ValueChanged, this, 0));
#endif
return;
}
@@ -1595,7 +1595,7 @@ void QAbstractSpinBoxPrivate::updateState(bool up, bool fromKeyboard /* = false
buttonState = (up ? Up : Down) | (fromKeyboard ? Keyboard : Mouse);
q->stepBy(up ? 1 : -1);
#ifndef QT_NO_ACCESSIBILITY
- QAccessible::updateAccessibility(q, 0, QAccessible::ValueChanged);
+ QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::ValueChanged, q, 0));
#endif
}
}
diff --git a/src/widgets/widgets/qabstractspinbox.h b/src/widgets/widgets/qabstractspinbox.h
index 8f963dce0d..891260c61c 100644
--- a/src/widgets/widgets/qabstractspinbox.h
+++ b/src/widgets/widgets/qabstractspinbox.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -49,7 +49,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
#ifndef QT_NO_SPINBOX
diff --git a/src/widgets/widgets/qabstractspinbox_p.h b/src/widgets/widgets/qabstractspinbox_p.h
index 67a09622a2..71e46d89b6 100644
--- a/src/widgets/widgets/qabstractspinbox_p.h
+++ b/src/widgets/widgets/qabstractspinbox_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/widgets/qbuttongroup.cpp b/src/widgets/widgets/qbuttongroup.cpp
index 992c542674..381e32d96b 100644
--- a/src/widgets/widgets/qbuttongroup.cpp
+++ b/src/widgets/widgets/qbuttongroup.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/widgets/qbuttongroup.h b/src/widgets/widgets/qbuttongroup.h
index 17c60e9609..e24ac8bbc3 100644
--- a/src/widgets/widgets/qbuttongroup.h
+++ b/src/widgets/widgets/qbuttongroup.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -48,7 +48,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
#ifndef QT_NO_BUTTONGROUP
diff --git a/src/widgets/widgets/qcalendartextnavigator_p.h b/src/widgets/widgets/qcalendartextnavigator_p.h
index 2ce5233cec..7e705a407a 100644
--- a/src/widgets/widgets/qcalendartextnavigator_p.h
+++ b/src/widgets/widgets/qcalendartextnavigator_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/widgets/qcalendarwidget.cpp b/src/widgets/widgets/qcalendarwidget.cpp
index 3bd1e3ec4f..1541010646 100644
--- a/src/widgets/widgets/qcalendarwidget.cpp
+++ b/src/widgets/widgets/qcalendarwidget.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/widgets/qcalendarwidget.h b/src/widgets/widgets/qcalendarwidget.h
index 1ab519386e..ae78d84a93 100644
--- a/src/widgets/widgets/qcalendarwidget.h
+++ b/src/widgets/widgets/qcalendarwidget.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -49,7 +49,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
#ifndef QT_NO_CALENDARWIDGET
diff --git a/src/widgets/widgets/qcheckbox.cpp b/src/widgets/widgets/qcheckbox.cpp
index 386bd2b169..3bf2e39ef1 100644
--- a/src/widgets/widgets/qcheckbox.cpp
+++ b/src/widgets/widgets/qcheckbox.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/widgets/qcheckbox.h b/src/widgets/widgets/qcheckbox.h
index 37461f1f10..cef6f6d7cf 100644
--- a/src/widgets/widgets/qcheckbox.h
+++ b/src/widgets/widgets/qcheckbox.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -48,7 +48,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
class QCheckBoxPrivate;
class QStyleOptionButton;
diff --git a/src/widgets/widgets/qcocoatoolbardelegate_mac.mm b/src/widgets/widgets/qcocoatoolbardelegate_mac.mm
index 1127d01b19..d290e854a0 100644
--- a/src/widgets/widgets/qcocoatoolbardelegate_mac.mm
+++ b/src/widgets/widgets/qcocoatoolbardelegate_mac.mm
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -71,7 +71,7 @@ QT_FORWARD_DECLARE_CLASS(QCFString);
- (NSArray *)toolbarAllowedItemIdentifiers:(NSToolbar *)toolbar
{
Q_UNUSED(toolbar);
- return [NSArray arrayWithObject:@"com.trolltech.qt.nstoolbar-qtoolbar"];
+ return [NSArray arrayWithObject:@"org.qt-project.qt.nstoolbar-qtoolbar"];
}
- (NSArray *)toolbarDefaultItemIdentifiers:(NSToolbar *)toolbar
diff --git a/src/widgets/widgets/qcocoatoolbardelegate_mac_p.h b/src/widgets/widgets/qcocoatoolbardelegate_mac_p.h
index 56a4f4f062..787926fe5d 100644
--- a/src/widgets/widgets/qcocoatoolbardelegate_mac_p.h
+++ b/src/widgets/widgets/qcocoatoolbardelegate_mac_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/widgets/qcombobox.cpp b/src/widgets/widgets/qcombobox.cpp
index 4cbd7eab7d..d6af8d6044 100644
--- a/src/widgets/widgets/qcombobox.cpp
+++ b/src/widgets/widgets/qcombobox.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -74,9 +74,6 @@
#ifndef QT_NO_EFFECTS
# include <private/qeffects_p.h>
#endif
-#if defined(Q_WS_S60)
-#include "private/qt_s60_p.h"
-#endif
#ifndef QT_NO_ACCESSIBILITY
#include "qaccessible.h"
#endif
@@ -549,11 +546,9 @@ void QComboBoxPrivateContainer::setItemView(QAbstractItemView *itemView)
QStyleOptionComboBox opt = comboStyleOption();
const bool usePopup = combo->style()->styleHint(QStyle::SH_ComboBox_Popup, &opt, combo);
#ifndef QT_NO_SCROLLBAR
-#ifndef Q_WS_S60
if (usePopup)
view->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
#endif
-#endif
if (combo->style()->styleHint(QStyle::SH_ComboBox_ListMouseTracking, &opt, combo) ||
usePopup) {
view->setMouseTracking(true);
@@ -992,7 +987,7 @@ void QComboBoxPrivate::_q_dataChanged(const QModelIndex &topLeft, const QModelIn
q->update();
}
#ifndef QT_NO_ACCESSIBILITY
- QAccessible::updateAccessibility(q, 0, QAccessible::NameChanged);
+ QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::NameChanged, q, 0));
#endif
}
@@ -1248,7 +1243,7 @@ void QComboBoxPrivate::_q_emitCurrentIndexChanged(const QModelIndex &index)
emit q->currentIndexChanged(index.row());
emit q->currentIndexChanged(itemText(index));
#ifndef QT_NO_ACCESSIBILITY
- QAccessible::updateAccessibility(q, 0, QAccessible::NameChanged);
+ QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::NameChanged, q, 0));
#endif
}
@@ -2339,11 +2334,7 @@ void QComboBox::showPopup()
initStyleOption(&opt);
QRect listRect(style->subControlRect(QStyle::CC_ComboBox, &opt,
QStyle::SC_ComboBoxListBoxPopup, this));
-#ifndef Q_WS_S60
QRect screen = d->popupGeometry(QApplication::desktop()->screenNumber(this));
-#else
- QRect screen = qt_TRect2QRect(static_cast<CEikAppUi*>(S60->appUi())->ClientRect());
-#endif
QPoint below = mapToGlobal(listRect.bottomLeft());
int belowHeight = screen.bottom() - below.y();
@@ -2436,14 +2427,11 @@ void QComboBox::showPopup()
// Position horizontally.
listRect.moveLeft(above.x());
-#ifndef Q_WS_S60
// Position vertically so the curently selected item lines up
// with the combo box.
const QRect currentItemRect = view()->visualRect(view()->currentIndex());
const int offset = listRect.top() - currentItemRect.top();
listRect.moveTop(above.y() + offset - listRect.top());
-#endif
-
// Clamp the listRect height and vertical position so we don't expand outside the
// available screen geometry.This may override the vertical position, but it is more
@@ -2457,23 +2445,6 @@ void QComboBox::showPopup()
if (listRect.bottom() > screen.bottom())
listRect.moveBottom(screen.bottom());
}
-#ifdef Q_WS_S60
- if (screen.width() < screen.height()) {
- // in portait, menu should be positioned above softkeys
- listRect.moveBottom(screen.bottom());
- } else {
- TRect staConTopRect = TRect();
- AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EStaconTop, staConTopRect);
- listRect.setWidth(listRect.height());
- //by default popup is centered on screen in landscape
- listRect.moveCenter(screen.center());
- if (staConTopRect.IsEmpty() && AknLayoutUtils::CbaLocation() != AknLayoutUtils::EAknCbaLocationBottom) {
- // landscape without stacon, menu should be at the right
- (opt.direction == Qt::LeftToRight) ? listRect.setRight(screen.right()) :
- listRect.setLeft(screen.left());
- }
- }
-#endif
} else if (!boundToScreen || listRect.height() <= belowHeight) {
listRect.moveTopLeft(below);
} else if (listRect.height() <= aboveHeight) {
@@ -2487,7 +2458,7 @@ void QComboBox::showPopup()
}
if (qApp) {
- qApp->inputPanel()->reset();
+ qApp->inputMethod()->reset();
}
QScrollBar *sb = view()->horizontalScrollBar();
@@ -2612,7 +2583,7 @@ void QComboBox::clear()
Q_D(QComboBox);
d->model->removeRows(0, d->model->rowCount(d->root), d->root);
#ifndef QT_NO_ACCESSIBILITY
- QAccessible::updateAccessibility(this, 0, QAccessible::NameChanged);
+ QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::NameChanged, this, 0));
#endif
}
@@ -2631,7 +2602,7 @@ void QComboBox::clearEditText()
if (d->lineEdit)
d->lineEdit->clear();
#ifndef QT_NO_ACCESSIBILITY
- QAccessible::updateAccessibility(this, 0, QAccessible::NameChanged);
+ QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::NameChanged, this, 0));
#endif
}
@@ -2644,7 +2615,7 @@ void QComboBox::setEditText(const QString &text)
if (d->lineEdit)
d->lineEdit->setText(text);
#ifndef QT_NO_ACCESSIBILITY
- QAccessible::updateAccessibility(this, 0, QAccessible::NameChanged);
+ QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::NameChanged, this, 0));
#endif
}
@@ -2692,39 +2663,6 @@ void QComboBox::changeEvent(QEvent *e)
d->updateLineEditGeometry();
d->setLayoutItemMargins(QStyle::SE_ComboBoxLayoutItem);
-#ifdef Q_WS_S60
- if (d->container) {
- QStyleOptionComboBox opt;
- initStyleOption(&opt);
-
- if (style()->styleHint(QStyle::SH_ComboBox_Popup, &opt, this)) {
- QRect screen = qt_TRect2QRect(static_cast<CEikAppUi*>(S60->appUi())->ClientRect());
-
- QRect listRect(style()->subControlRect(QStyle::CC_ComboBox, &opt,
- QStyle::SC_ComboBoxListBoxPopup, this));
- listRect.setHeight(qMin(screen.height(), screen.width()));
-
- if (screen.width() < screen.height()) {
- // in portait, menu should be positioned above softkeys
- listRect.moveBottom(screen.bottom());
- } else {
- TRect staConTopRect = TRect();
- AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EStaconTop, staConTopRect);
- listRect.setWidth(listRect.height());
- //by default popup is centered on screen in landscape
- listRect.moveCenter(screen.center());
- if (staConTopRect.IsEmpty() && AknLayoutUtils::CbaLocation() != AknLayoutUtils::EAknCbaLocationBottom) {
- // landscape without stacon, menu should be at the right
- (opt.direction == Qt::LeftToRight) ? listRect.setRight(screen.right()) :
- listRect.setLeft(screen.left());
- }
- }
-
- d->container->setGeometry(listRect);
- }
- }
-#endif
-
// ### need to update scrollers etc. as well here
break;
case QEvent::EnabledChange:
@@ -2753,10 +2691,6 @@ void QComboBox::changeEvent(QEvent *e)
void QComboBox::resizeEvent(QResizeEvent *)
{
Q_D(QComboBox);
-#ifdef Q_WS_S60
- if (d->viewContainer() && d->viewContainer()->isVisible())
- showPopup();
-#endif
d->updateLineEditGeometry();
}
diff --git a/src/widgets/widgets/qcombobox.h b/src/widgets/widgets/qcombobox.h
index 4a5050b945..1442cd983e 100644
--- a/src/widgets/widgets/qcombobox.h
+++ b/src/widgets/widgets/qcombobox.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -51,7 +51,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
#ifndef QT_NO_COMBOBOX
class QAbstractItemView;
diff --git a/src/widgets/widgets/qcombobox_p.h b/src/widgets/widgets/qcombobox_p.h
index a9d792f07d..68b52aeac2 100644
--- a/src/widgets/widgets/qcombobox_p.h
+++ b/src/widgets/widgets/qcombobox_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -200,9 +200,7 @@ protected:
menuOpt.menuItemType = QStyleOptionMenuItem::Scroller;
if (sliderAction == QAbstractSlider::SliderSingleStepAdd)
menuOpt.state |= QStyle::State_DownArrow;
-#ifndef Q_WS_S60
p.eraseRect(rect());
-#endif
style()->drawControl(QStyle::CE_MenuScroller, &menuOpt, &p);
}
@@ -272,9 +270,7 @@ protected:
const QStyleOptionViewItem &option,
const QModelIndex &index) const {
QStyleOptionMenuItem opt = getStyleOption(option, index);
-#ifndef Q_WS_S60
painter->fillRect(option.rect, opt.palette.background());
-#endif
mCombo->style()->drawControl(QStyle::CE_MenuItem, &opt, painter, mCombo);
}
QSize sizeHint(const QStyleOptionViewItem &option,
diff --git a/src/widgets/widgets/qcommandlinkbutton.cpp b/src/widgets/widgets/qcommandlinkbutton.cpp
index d61eeb6131..e392aaa1a5 100644
--- a/src/widgets/widgets/qcommandlinkbutton.cpp
+++ b/src/widgets/widgets/qcommandlinkbutton.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/widgets/qcommandlinkbutton.h b/src/widgets/widgets/qcommandlinkbutton.h
index 726e0360d2..8bf2180046 100644
--- a/src/widgets/widgets/qcommandlinkbutton.h
+++ b/src/widgets/widgets/qcommandlinkbutton.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -48,7 +48,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
class QCommandLinkButtonPrivate;
diff --git a/src/widgets/widgets/qdatetimeedit.cpp b/src/widgets/widgets/qdatetimeedit.cpp
index 871a394a80..5761c1299c 100644
--- a/src/widgets/widgets/qdatetimeedit.cpp
+++ b/src/widgets/widgets/qdatetimeedit.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/widgets/qdatetimeedit.h b/src/widgets/widgets/qdatetimeedit.h
index 77c76c483e..9a57175716 100644
--- a/src/widgets/widgets/qdatetimeedit.h
+++ b/src/widgets/widgets/qdatetimeedit.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -50,7 +50,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
#ifndef QT_NO_DATETIMEEDIT
diff --git a/src/widgets/widgets/qdatetimeedit_p.h b/src/widgets/widgets/qdatetimeedit_p.h
index 0669c7c330..35f0f57f54 100644
--- a/src/widgets/widgets/qdatetimeedit_p.h
+++ b/src/widgets/widgets/qdatetimeedit_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/widgets/qdial.cpp b/src/widgets/widgets/qdial.cpp
index 26cea362c2..566652b8f5 100644
--- a/src/widgets/widgets/qdial.cpp
+++ b/src/widgets/widgets/qdial.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/widgets/qdial.h b/src/widgets/widgets/qdial.h
index 724028d129..411fbfa7ef 100644
--- a/src/widgets/widgets/qdial.h
+++ b/src/widgets/widgets/qdial.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -49,7 +49,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
#ifndef QT_NO_DIAL
diff --git a/src/widgets/widgets/qdialogbuttonbox.cpp b/src/widgets/widgets/qdialogbuttonbox.cpp
index e53bd55129..d1084168a9 100644
--- a/src/widgets/widgets/qdialogbuttonbox.cpp
+++ b/src/widgets/widgets/qdialogbuttonbox.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/widgets/qdialogbuttonbox.h b/src/widgets/widgets/qdialogbuttonbox.h
index 2fca5a5791..a0591dcd71 100644
--- a/src/widgets/widgets/qdialogbuttonbox.h
+++ b/src/widgets/widgets/qdialogbuttonbox.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -48,7 +48,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
class QAbstractButton;
class QPushButton;
diff --git a/src/widgets/widgets/qdockarealayout.cpp b/src/widgets/widgets/qdockarealayout.cpp
index 1acd93ed60..df083ccbfe 100644
--- a/src/widgets/widgets/qdockarealayout.cpp
+++ b/src/widgets/widgets/qdockarealayout.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/widgets/qdockarealayout_p.h b/src/widgets/widgets/qdockarealayout_p.h
index 46ac966798..17078f3709 100644
--- a/src/widgets/widgets/qdockarealayout_p.h
+++ b/src/widgets/widgets/qdockarealayout_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/widgets/qdockwidget.cpp b/src/widgets/widgets/qdockwidget.cpp
index 32a73c54ed..6da7605f4c 100644
--- a/src/widgets/widgets/qdockwidget.cpp
+++ b/src/widgets/widgets/qdockwidget.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/widgets/qdockwidget.h b/src/widgets/widgets/qdockwidget.h
index d6270e4a99..21872fa404 100644
--- a/src/widgets/widgets/qdockwidget.h
+++ b/src/widgets/widgets/qdockwidget.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -48,7 +48,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
#ifndef QT_NO_DOCKWIDGET
diff --git a/src/widgets/widgets/qdockwidget_p.h b/src/widgets/widgets/qdockwidget_p.h
index 2bf50d8aa6..7b31e4e951 100644
--- a/src/widgets/widgets/qdockwidget_p.h
+++ b/src/widgets/widgets/qdockwidget_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/widgets/qeffects.cpp b/src/widgets/widgets/qeffects.cpp
index ab04e2314f..486905658d 100644
--- a/src/widgets/widgets/qeffects.cpp
+++ b/src/widgets/widgets/qeffects.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/widgets/qeffects_p.h b/src/widgets/widgets/qeffects_p.h
index e26810835e..5629672759 100644
--- a/src/widgets/widgets/qeffects_p.h
+++ b/src/widgets/widgets/qeffects_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/widgets/qfocusframe.cpp b/src/widgets/widgets/qfocusframe.cpp
index 62dc8b64f2..2caa9a0b6f 100644
--- a/src/widgets/widgets/qfocusframe.cpp
+++ b/src/widgets/widgets/qfocusframe.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/widgets/qfocusframe.h b/src/widgets/widgets/qfocusframe.h
index ed117ddd6c..d12cc42a53 100644
--- a/src/widgets/widgets/qfocusframe.h
+++ b/src/widgets/widgets/qfocusframe.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -48,7 +48,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
class QFocusFramePrivate;
class QStyleOption;
diff --git a/src/widgets/widgets/qfontcombobox.cpp b/src/widgets/widgets/qfontcombobox.cpp
index 845f37ccf1..5a8e083e44 100644
--- a/src/widgets/widgets/qfontcombobox.cpp
+++ b/src/widgets/widgets/qfontcombobox.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/widgets/qfontcombobox.h b/src/widgets/widgets/qfontcombobox.h
index 33eec561af..5ed35df8a7 100644
--- a/src/widgets/widgets/qfontcombobox.h
+++ b/src/widgets/widgets/qfontcombobox.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -51,7 +51,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
class QFontComboBoxPrivate;
diff --git a/src/widgets/widgets/qframe.cpp b/src/widgets/widgets/qframe.cpp
index d0de825467..cae4137803 100644
--- a/src/widgets/widgets/qframe.cpp
+++ b/src/widgets/widgets/qframe.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/widgets/qframe.h b/src/widgets/widgets/qframe.h
index 51cd391185..4bb3a75e58 100644
--- a/src/widgets/widgets/qframe.h
+++ b/src/widgets/widgets/qframe.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -48,7 +48,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
class QFramePrivate;
diff --git a/src/widgets/widgets/qframe_p.h b/src/widgets/widgets/qframe_p.h
index a74780fa60..8bb585f2ec 100644
--- a/src/widgets/widgets/qframe_p.h
+++ b/src/widgets/widgets/qframe_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/widgets/qgroupbox.cpp b/src/widgets/widgets/qgroupbox.cpp
index 1bad9a5b56..17f3a9323a 100644
--- a/src/widgets/widgets/qgroupbox.cpp
+++ b/src/widgets/widgets/qgroupbox.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -249,7 +249,7 @@ void QGroupBox::setTitle(const QString &title)
update();
updateGeometry();
#ifndef QT_NO_ACCESSIBILITY
- QAccessible::updateAccessibility(this, 0, QAccessible::NameChanged);
+ QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::NameChanged, this, 0));
#endif
}
diff --git a/src/widgets/widgets/qgroupbox.h b/src/widgets/widgets/qgroupbox.h
index 70bc4cde38..249f4262cf 100644
--- a/src/widgets/widgets/qgroupbox.h
+++ b/src/widgets/widgets/qgroupbox.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -48,7 +48,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
#ifndef QT_NO_GROUPBOX
diff --git a/src/widgets/widgets/qlabel.cpp b/src/widgets/widgets/qlabel.cpp
index 1503085661..d23fab4083 100644
--- a/src/widgets/widgets/qlabel.cpp
+++ b/src/widgets/widgets/qlabel.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -316,7 +316,7 @@ void QLabel::setText(const QString &text)
#ifndef QT_NO_ACCESSIBILITY
if (accessibleName().isEmpty())
- QAccessible::updateAccessibility(this, 0, QAccessible::NameChanged);
+ QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::NameChanged, this, 0));
#endif
}
diff --git a/src/widgets/widgets/qlabel.h b/src/widgets/widgets/qlabel.h
index 5d61cafab0..7da369b071 100644
--- a/src/widgets/widgets/qlabel.h
+++ b/src/widgets/widgets/qlabel.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -48,7 +48,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
class QLabelPrivate;
diff --git a/src/widgets/widgets/qlabel_p.h b/src/widgets/widgets/qlabel_p.h
index 8de0e301fd..c0cfc984f4 100644
--- a/src/widgets/widgets/qlabel_p.h
+++ b/src/widgets/widgets/qlabel_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/widgets/qlcdnumber.cpp b/src/widgets/widgets/qlcdnumber.cpp
index 48836a52d7..71e08fdaeb 100644
--- a/src/widgets/widgets/qlcdnumber.cpp
+++ b/src/widgets/widgets/qlcdnumber.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -398,18 +398,6 @@ QLCDNumber::~QLCDNumber()
/*!
- \deprecated
- \property QLCDNumber::numDigits
- \brief the current number of digits displayed
- \sa digitCount
-*/
-
-void QLCDNumber::setNumDigits(int numDigits)
-{
- setDigitCount(numDigits);
-}
-
-/*!
\since 4.6
\property QLCDNumber::digitCount
\brief the current number of digits displayed
@@ -476,12 +464,6 @@ void QLCDNumber::setDigitCount(int numDigits)
}
}
-int QLCDNumber::numDigits() const
-{
- Q_D(const QLCDNumber);
- return d->ndigits;
-}
-
/*!
Returns the current number of digits.
*/
diff --git a/src/widgets/widgets/qlcdnumber.h b/src/widgets/widgets/qlcdnumber.h
index fcea53ef28..585c965282 100644
--- a/src/widgets/widgets/qlcdnumber.h
+++ b/src/widgets/widgets/qlcdnumber.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -49,7 +49,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
#ifndef QT_NO_LCDNUMBER
@@ -59,7 +58,7 @@ class Q_WIDGETS_EXPORT QLCDNumber : public QFrame // LCD number widget
Q_OBJECT
Q_ENUMS(Mode SegmentStyle)
Q_PROPERTY(bool smallDecimalPoint READ smallDecimalPoint WRITE setSmallDecimalPoint)
- Q_PROPERTY(int numDigits READ numDigits WRITE setNumDigits)
+ Q_PROPERTY(int numDigits READ digitCount WRITE setDigitCount)
Q_PROPERTY(int digitCount READ digitCount WRITE setDigitCount)
Q_PROPERTY(Mode mode READ mode WRITE setMode)
Q_PROPERTY(SegmentStyle segmentStyle READ segmentStyle WRITE setSegmentStyle)
@@ -79,10 +78,6 @@ public:
};
bool smallDecimalPoint() const;
-#ifdef QT_DEPRECATED
- QT_DEPRECATED int numDigits() const;
- QT_DEPRECATED void setNumDigits(int nDigits);
-#endif
int digitCount() const;
void setDigitCount(int nDigits);
diff --git a/src/widgets/widgets/qlineedit.cpp b/src/widgets/widgets/qlineedit.cpp
index 5714052059..77d6f5422a 100644
--- a/src/widgets/widgets/qlineedit.cpp
+++ b/src/widgets/widgets/qlineedit.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -1202,7 +1202,7 @@ void QLineEdit::insert(const QString &newText)
void QLineEdit::clear()
{
Q_D(QLineEdit);
- d->resetInputPanel();
+ d->resetInputMethod();
d->control->clear();
}
@@ -1215,7 +1215,7 @@ void QLineEdit::clear()
void QLineEdit::undo()
{
Q_D(QLineEdit);
- d->resetInputPanel();
+ d->resetInputMethod();
d->control->undo();
}
@@ -1226,7 +1226,7 @@ void QLineEdit::undo()
void QLineEdit::redo()
{
Q_D(QLineEdit);
- d->resetInputPanel();
+ d->resetInputMethod();
d->control->redo();
}
diff --git a/src/widgets/widgets/qlineedit.h b/src/widgets/widgets/qlineedit.h
index 2daa893b3b..6901ec8bdf 100644
--- a/src/widgets/widgets/qlineedit.h
+++ b/src/widgets/widgets/qlineedit.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -51,7 +51,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
#ifndef QT_NO_LINEEDIT
diff --git a/src/widgets/widgets/qlineedit_p.cpp b/src/widgets/widgets/qlineedit_p.cpp
index c54f60f62e..e3404a62de 100644
--- a/src/widgets/widgets/qlineedit_p.cpp
+++ b/src/widgets/widgets/qlineedit_p.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -51,7 +51,7 @@
#include "qaccessible.h"
#endif
#ifndef QT_NO_IM
-#include "qinputpanel.h"
+#include "qinputmethod.h"
#include "qlist.h"
#endif
@@ -133,7 +133,7 @@ void QLineEditPrivate::_q_editFocusChange(bool e)
void QLineEditPrivate::_q_selectionChanged()
{
Q_Q(QLineEdit);
- if (!control->text().isEmpty() && control->preeditAreaText().isEmpty()) {
+ if (control->preeditAreaText().isEmpty()) {
QStyleOptionFrameV2 opt;
q->initStyleOption(&opt);
bool showCursor = control->hasSelectedText() ?
@@ -143,6 +143,9 @@ void QLineEditPrivate::_q_selectionChanged()
}
emit q->selectionChanged();
+#ifndef QT_NO_ACCESSIBILITY
+ QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::TextSelectionChanged, q, 0));
+#endif
}
void QLineEditPrivate::_q_updateNeeded(const QRect &rect)
@@ -239,17 +242,17 @@ void QLineEditPrivate::updatePasswordEchoEditing(bool editing)
q->setAttribute(Qt::WA_InputMethodEnabled, shouldEnableInputMethod());
}
-void QLineEditPrivate::resetInputPanel()
+void QLineEditPrivate::resetInputMethod()
{
Q_Q(QLineEdit);
if (q->hasFocus() && qApp) {
- qApp->inputPanel()->reset();
+ qApp->inputMethod()->reset();
}
}
/*!
This function is not intended as polymorphic usage. Just a shared code
- fragment that calls QInputPanel::invokeAction for this
+ fragment that calls QInputMethod::invokeAction for this
class.
*/
bool QLineEditPrivate::sendMouseEventToInputContext( QMouseEvent *e )
@@ -263,7 +266,7 @@ bool QLineEditPrivate::sendMouseEventToInputContext( QMouseEvent *e )
if (mousePos >= 0) {
if (e->type() == QEvent::MouseButtonRelease)
- qApp->inputPanel()->invokeAction(QInputPanel::Click, mousePos);
+ qApp->inputMethod()->invokeAction(QInputMethod::Click, mousePos);
return true;
}
diff --git a/src/widgets/widgets/qlineedit_p.h b/src/widgets/widgets/qlineedit_p.h
index 206e835a74..3b7a0d1b91 100644
--- a/src/widgets/widgets/qlineedit_p.h
+++ b/src/widgets/widgets/qlineedit_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -102,7 +102,7 @@ public:
void updatePasswordEchoEditing(bool);
- void resetInputPanel();
+ void resetInputMethod();
inline bool shouldEnableInputMethod() const
{
diff --git a/src/widgets/widgets/qmaccocoaviewcontainer_mac.h b/src/widgets/widgets/qmaccocoaviewcontainer_mac.h
index 8824fde912..88d823fc91 100644
--- a/src/widgets/widgets/qmaccocoaviewcontainer_mac.h
+++ b/src/widgets/widgets/qmaccocoaviewcontainer_mac.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -48,7 +48,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
class QMacCocoaViewContainerPrivate;
diff --git a/src/widgets/widgets/qmaccocoaviewcontainer_mac.mm b/src/widgets/widgets/qmaccocoaviewcontainer_mac.mm
index 8facb4db61..1c8e6ba0e8 100644
--- a/src/widgets/widgets/qmaccocoaviewcontainer_mac.mm
+++ b/src/widgets/widgets/qmaccocoaviewcontainer_mac.mm
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/widgets/qmacnativewidget_mac.h b/src/widgets/widgets/qmacnativewidget_mac.h
index 2b4d4fbdae..61127dcea4 100644
--- a/src/widgets/widgets/qmacnativewidget_mac.h
+++ b/src/widgets/widgets/qmacnativewidget_mac.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -48,7 +48,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
class QMacNativeWidgetPrivate;
class Q_WIDGETS_EXPORT QMacNativeWidget : public QWidget
diff --git a/src/widgets/widgets/qmacnativewidget_mac.mm b/src/widgets/widgets/qmacnativewidget_mac.mm
index 925ef3d8a9..7974e93d88 100644
--- a/src/widgets/widgets/qmacnativewidget_mac.mm
+++ b/src/widgets/widgets/qmacnativewidget_mac.mm
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/widgets/qmainwindow.cpp b/src/widgets/widgets/qmainwindow.cpp
index ad1890a708..73ba0cc15e 100644
--- a/src/widgets/widgets/qmainwindow.cpp
+++ b/src/widgets/widgets/qmainwindow.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/widgets/qmainwindow.h b/src/widgets/widgets/qmainwindow.h
index 43d269ef6f..d902f73aa0 100644
--- a/src/widgets/widgets/qmainwindow.h
+++ b/src/widgets/widgets/qmainwindow.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -49,7 +49,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
#ifndef QT_NO_MAINWINDOW
diff --git a/src/widgets/widgets/qmainwindowlayout.cpp b/src/widgets/widgets/qmainwindowlayout.cpp
index 32d893630f..c67881e652 100644
--- a/src/widgets/widgets/qmainwindowlayout.cpp
+++ b/src/widgets/widgets/qmainwindowlayout.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/widgets/qmainwindowlayout_mac.mm b/src/widgets/widgets/qmainwindowlayout_mac.mm
index b6fcca88fa..f90029c7b3 100644
--- a/src/widgets/widgets/qmainwindowlayout_mac.mm
+++ b/src/widgets/widgets/qmainwindowlayout_mac.mm
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -54,10 +54,10 @@ QT_BEGIN_NAMESPACE
// namespace up the stuff
#define SS(x) #x
#define S0(x) SS(x)
-#define S "com.trolltech.qt-" S0(QT_NAMESPACE) ".qmainwindow.qtoolbarInHIToolbar"
-#define SToolbar "com.trolltech.qt-" S0(QT_NAMESPACE) ".hitoolbar-qtoolbar"
-#define SNSToolbar "com.trolltech.qt-" S0(QT_NAMESPACE) ".qtoolbarInNSToolbar"
-#define MacToolbar "com.trolltech.qt-" S0(QT_NAMESPACE) ".qmainwindow.mactoolbar"
+#define S "org.qt-project.qt-" S0(QT_NAMESPACE) ".qmainwindow.qtoolbarInHIToolbar"
+#define SToolbar "org.qt-project.qt-" S0(QT_NAMESPACE) ".hitoolbar-qtoolbar"
+#define SNSToolbar "org.qt-project.qt-" S0(QT_NAMESPACE) ".qtoolbarInNSToolbar"
+#define MacToolbar "org.qt-project.qt-" S0(QT_NAMESPACE) ".qmainwindow.mactoolbar"
static NSString *kQToolBarNSToolbarIdentifier = @SNSToolbar;
static CFStringRef kQMainWindowMacToolbarID = CFSTR(MacToolbar);
@@ -69,8 +69,8 @@ static CFStringRef kQMainWindowMacToolbarID = CFSTR(MacToolbar);
#undef MacToolbar
#else
-static NSString *kQToolBarNSToolbarIdentifier = @"com.trolltech.qt.qmainwindow.qtoolbarInNSToolbar";
-static CFStringRef kQMainWindowMacToolbarID = CFSTR("com.trolltech.qt.qmainwindow.mactoolbar");
+static NSString *kQToolBarNSToolbarIdentifier = @"org.qt-project.qt.qmainwindow.qtoolbarInNSToolbar";
+static CFStringRef kQMainWindowMacToolbarID = CFSTR("org.qt-project.qt.qmainwindow.mactoolbar");
#endif // QT_NAMESPACE
diff --git a/src/widgets/widgets/qmainwindowlayout_p.h b/src/widgets/widgets/qmainwindowlayout_p.h
index 34d94119ad..e8de9f18f1 100644
--- a/src/widgets/widgets/qmainwindowlayout_p.h
+++ b/src/widgets/widgets/qmainwindowlayout_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/widgets/qmdiarea.cpp b/src/widgets/widgets/qmdiarea.cpp
index 021af9be0b..7d73a66c5c 100644
--- a/src/widgets/widgets/qmdiarea.cpp
+++ b/src/widgets/widgets/qmdiarea.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/widgets/qmdiarea.h b/src/widgets/widgets/qmdiarea.h
index fbd07ad249..54cac67eff 100644
--- a/src/widgets/widgets/qmdiarea.h
+++ b/src/widgets/widgets/qmdiarea.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -49,7 +49,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
#ifndef QT_NO_MDIAREA
diff --git a/src/widgets/widgets/qmdiarea_p.h b/src/widgets/widgets/qmdiarea_p.h
index e80c6b5ecb..d94645c538 100644
--- a/src/widgets/widgets/qmdiarea_p.h
+++ b/src/widgets/widgets/qmdiarea_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/widgets/qmdisubwindow.cpp b/src/widgets/widgets/qmdisubwindow.cpp
index f2190313e9..cca39a6502 100644
--- a/src/widgets/widgets/qmdisubwindow.cpp
+++ b/src/widgets/widgets/qmdisubwindow.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/widgets/qmdisubwindow.h b/src/widgets/widgets/qmdisubwindow.h
index 332619c3b4..1e68ca15a3 100644
--- a/src/widgets/widgets/qmdisubwindow.h
+++ b/src/widgets/widgets/qmdisubwindow.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -48,7 +48,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
#ifndef QT_NO_MDIAREA
diff --git a/src/widgets/widgets/qmdisubwindow_p.h b/src/widgets/widgets/qmdisubwindow_p.h
index 83a91fb39b..1d1d01093a 100644
--- a/src/widgets/widgets/qmdisubwindow_p.h
+++ b/src/widgets/widgets/qmdisubwindow_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/widgets/qmenu.cpp b/src/widgets/widgets/qmenu.cpp
index a255b840dc..1ad697c430 100644
--- a/src/widgets/widgets/qmenu.cpp
+++ b/src/widgets/widgets/qmenu.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -74,12 +74,6 @@
# include <private/qt_x11_p.h>
#endif
-#if defined(Q_OS_MAC) && !defined(QT_NO_EFFECTS)
-# include <private/qcore_mac_p.h>
-# include <private/qt_cocoa_helpers_mac_p.h>
-#endif
-
-
QT_BEGIN_NAMESPACE
QMenu *QMenuPrivate::mouseDown = 0;
@@ -1091,8 +1085,8 @@ void QMenuPrivate::activateAction(QAction *action, QAction::ActionEvent action_e
#ifndef QT_NO_ACCESSIBILITY
if (QAccessible::isActive()) {
int actionIndex = indexOf(action) + 1;
- QAccessible::updateAccessibility(q, actionIndex, QAccessible::Focus);
- QAccessible::updateAccessibility(q, actionIndex, QAccessible::Selection);
+ QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::Focus, q, actionIndex));
+ QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::Selection, q, actionIndex));
}
#endif
action->showStatusText(topCausedWidget());
@@ -1977,7 +1971,7 @@ void QMenu::popup(const QPoint &p, QAction *atAction)
}
#ifndef QT_NO_ACCESSIBILITY
- QAccessible::updateAccessibility(this, 0, QAccessible::PopupMenuStart);
+ QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::PopupMenuStart, this ,0));
#endif
}
@@ -2123,7 +2117,7 @@ void QMenu::hideEvent(QHideEvent *)
d->eventLoop->exit();
d->setCurrentAction(0);
#ifndef QT_NO_ACCESSIBILITY
- QAccessible::updateAccessibility(this, 0, QAccessible::PopupMenuEnd);
+ QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::PopupMenuEnd, this, 0));
#endif
#ifndef QT_NO_MENUBAR
if (QMenuBar *mb = qobject_cast<QMenuBar*>(d->causedPopup.widget))
@@ -2899,16 +2893,6 @@ void QMenu::actionEvent(QActionEvent *e)
d->wce_menu->syncAction(e->action());
#endif
-#ifdef Q_WS_S60
- if (!d->symbian_menu)
- d->symbian_menu = new QMenuPrivate::QSymbianMenuPrivate;
- if (e->type() == QEvent::ActionAdded)
- d->symbian_menu->addAction(e->action(), d->symbian_menu->findAction(e->before()));
- else if (e->type() == QEvent::ActionRemoved)
- d->symbian_menu->removeAction(e->action());
- else if (e->type() == QEvent::ActionChanged)
- d->symbian_menu->syncAction(e->action());
-#endif
if (isVisible()) {
d->updateActionRects();
resize(sizeHint());
diff --git a/src/widgets/widgets/qmenu.h b/src/widgets/widgets/qmenu.h
index 645a15bdc8..fa0542b6c2 100644
--- a/src/widgets/widgets/qmenu.h
+++ b/src/widgets/widgets/qmenu.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -56,7 +56,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
#ifndef QT_NO_MENU
diff --git a/src/widgets/widgets/qmenu_p.h b/src/widgets/widgets/qmenu_p.h
index a6e700b528..af236c1c8f 100644
--- a/src/widgets/widgets/qmenu_p.h
+++ b/src/widgets/widgets/qmenu_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -55,31 +55,16 @@
#include "QtWidgets/qmenubar.h"
#include "QtWidgets/qstyleoption.h"
-#ifdef Q_OS_MAC
-#include "QtWidgets/qmacdefines_mac.h"
-#endif
#include "QtCore/qdatetime.h"
#include "QtCore/qmap.h"
#include "QtCore/qhash.h"
#include "QtCore/qbasictimer.h"
#include "private/qwidget_p.h"
-
-#ifdef Q_WS_S60
-class CEikMenuPane;
-#define QT_SYMBIAN_FIRST_MENU_ITEM 32000
-#define QT_SYMBIAN_LAST_MENU_ITEM 41999 // 10000 items ought to be enough for anybody...
-#endif
QT_BEGIN_NAMESPACE
#ifndef QT_NO_MENU
-#ifdef Q_WS_S60
-void qt_symbian_next_menu_from_action(QWidget* actionContainer);
-void qt_symbian_show_toplevel(CEikMenuPane* menuPane);
-void qt_symbian_show_submenu(CEikMenuPane* menuPane, int id);
-#endif // Q_WS_S60
-
class QTornOffMenu;
class QEventLoop;
@@ -91,15 +76,6 @@ struct QWceMenuAction {
QWceMenuAction() : menuHandle(0), command(0) {}
};
#endif
-#ifdef Q_WS_S60
-struct QSymbianMenuAction {
- uint command;
- int parent;
- CEikMenuPane* menuPane;
- QPointer<QAction> action;
- QSymbianMenuAction() : command(0) {}
-};
-#endif
class QMenuPrivate : public QWidgetPrivate
{
@@ -118,9 +94,6 @@ public:
#if defined(Q_WS_WINCE) && !defined(QT_NO_MENUBAR)
,wce_menu(0)
#endif
-#ifdef Q_WS_S60
- ,symbian_menu(0)
-#endif
{ }
~QMenuPrivate()
{
@@ -129,10 +102,6 @@ public:
#if defined(Q_WS_WINCE) && !defined(QT_NO_MENUBAR)
delete wce_menu;
#endif
-#ifdef Q_WS_S60
- delete symbian_menu;
-#endif
-
}
void init();
@@ -284,28 +253,6 @@ public:
HMENU wceMenu();
QAction* wceCommands(uint command);
#endif
-#if defined(Q_WS_S60)
- struct QSymbianMenuPrivate {
- QList<QSymbianMenuAction*> actionItems;
- QSymbianMenuPrivate();
- ~QSymbianMenuPrivate();
- void addAction(QAction *, QSymbianMenuAction* =0);
- void addAction(QSymbianMenuAction *, QSymbianMenuAction* =0);
- void syncAction(QSymbianMenuAction *);
- inline void syncAction(QAction *a) { syncAction(findAction(a)); }
- void removeAction(QSymbianMenuAction *);
- void rebuild(bool reCreate = false);
- inline void removeAction(QAction *a) { removeAction(findAction(a)); }
- inline QSymbianMenuAction *findAction(QAction *a) {
- for(int i = 0; i < actionItems.size(); i++) {
- QSymbianMenuAction *act = actionItems[i];
- if(a == act->action)
- return act;
- }
- return 0;
- }
- } *symbian_menu;
-#endif
QPointer<QWidget> noReplayFor;
};
diff --git a/src/widgets/widgets/qmenu_wince.cpp b/src/widgets/widgets/qmenu_wince.cpp
index 26a9302efb..ae90d23b28 100644
--- a/src/widgets/widgets/qmenu_wince.cpp
+++ b/src/widgets/widgets/qmenu_wince.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/widgets/qmenu_wince_resource_p.h b/src/widgets/widgets/qmenu_wince_resource_p.h
index b40a9526e5..589ccf8cfe 100644
--- a/src/widgets/widgets/qmenu_wince_resource_p.h
+++ b/src/widgets/widgets/qmenu_wince_resource_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/widgets/qmenubar.cpp b/src/widgets/widgets/qmenubar.cpp
index 2908d4723e..f1269fde0f 100644
--- a/src/widgets/widgets/qmenubar.cpp
+++ b/src/widgets/widgets/qmenubar.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -531,8 +531,8 @@ void QMenuBarPrivate::_q_actionHovered()
if (QAccessible::isActive()) {
int actionIndex = actions.indexOf(action);
++actionIndex;
- QAccessible::updateAccessibility(q, actionIndex, QAccessible::Focus);
- QAccessible::updateAccessibility(q, actionIndex, QAccessible::Selection);
+ QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::Focus, q, actionIndex));
+ QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::Selection, q, actionIndex));
}
#endif //QT_NO_ACCESSIBILITY
}
@@ -788,10 +788,6 @@ QMenuBar::~QMenuBar()
if (qt_wince_is_mobile())
d->wceDestroyMenuBar();
#endif
-#ifdef Q_WS_S60
- Q_D(QMenuBar);
- d->symbianDestroyMenuBar();
-#endif
}
/*!
@@ -1043,7 +1039,7 @@ void QMenuBar::paintEvent(QPaintEvent *e)
*/
void QMenuBar::setVisible(bool visible)
{
-#if defined(Q_OS_MAC) || defined(Q_OS_WINCE) || defined(Q_WS_S60)
+#if defined(Q_OS_MAC) || defined(Q_OS_WINCE)
if (isNativeMenuBar()) {
if (!visible)
QWidget::setVisible(false);
@@ -1249,9 +1245,7 @@ void QMenuBar::actionEvent(QActionEvent *e)
if (d->platformMenuBar) {
QPlatformMenuBar *nativeMenuBar = d->platformMenuBar;
-#if defined(Q_WS_S60)
- QMenuBarPrivate::QSymbianMenuBarPrivate *nativeMenuBar = d->symbian_menubar;
-#elif defined(Q_WS_WINCE)
+#if defined(Q_WS_WINCE)
QMenuBarPrivate::QWceMenuBarPrivate *nativeMenuBar = d->wce_menubar;
#endif
if (!nativeMenuBar)
@@ -1348,38 +1342,6 @@ void QMenuBarPrivate::handleReparent()
if (qt_wince_is_mobile() && wce_menubar)
wce_menubar->rebuild();
#endif
-#ifdef Q_WS_S60
-
- // Construct symbian_menubar when this code path is entered first time
- // and when newParent != NULL
- if (!symbian_menubar)
- symbianCreateMenuBar(newParent);
-
- // Reparent and rebuild menubar when parent is changed
- if (symbian_menubar) {
- if (oldParent != newParent)
- reparentMenuBar(oldParent, newParent);
- q->hide();
- symbian_menubar->rebuild();
- }
-
-#ifdef QT_SOFTKEYS_ENABLED
- // Constuct menuBarAction when this code path is entered first time
- if (!menuBarAction) {
- if (newParent) {
- menuBarAction = QSoftKeyManager::createAction(QSoftKeyManager::MenuSoftKey, newParent);
- newParent->addAction(menuBarAction);
- }
- } else {
- // If reparenting i.e. we already have menuBarAction, remove it from old parent
- // and add for a new parent
- if (oldParent)
- oldParent->removeAction(menuBarAction);
- if (newParent)
- newParent->addAction(menuBarAction);
- }
-#endif // QT_SOFTKEYS_ENABLED
-#endif // Q_WS_S60
}
/*!
@@ -1564,7 +1526,7 @@ QRect QMenuBar::actionGeometry(QAction *act) const
QSize QMenuBar::minimumSizeHint() const
{
Q_D(const QMenuBar);
-#if defined(Q_OS_MAC) || defined(Q_WS_WINCE) || defined(Q_WS_S60)
+#if defined(Q_OS_MAC) || defined(Q_WS_WINCE)
const bool as_gui_menubar = !isNativeMenuBar();
#else
const bool as_gui_menubar = true;
@@ -1620,7 +1582,7 @@ QSize QMenuBar::minimumSizeHint() const
QSize QMenuBar::sizeHint() const
{
Q_D(const QMenuBar);
-#if defined(Q_OS_MAC) || defined(Q_WS_WINCE) || defined(Q_WS_S60)
+#if defined(Q_OS_MAC) || defined(Q_WS_WINCE)
const bool as_gui_menubar = !isNativeMenuBar();
#else
const bool as_gui_menubar = true;
@@ -1679,7 +1641,7 @@ QSize QMenuBar::sizeHint() const
int QMenuBar::heightForWidth(int) const
{
Q_D(const QMenuBar);
-#if defined(Q_OS_MAC) || defined(Q_WS_WINCE) || defined(Q_WS_S60)
+#if defined(Q_OS_MAC) || defined(Q_WS_WINCE)
const bool as_gui_menubar = !isNativeMenuBar();
#else
const bool as_gui_menubar = true;
@@ -1823,6 +1785,8 @@ QWidget *QMenuBar::cornerWidget(Qt::Corner corner) const
The default is to follow whether the Qt::AA_DontUseNativeMenuBar attribute
is set for the application. Explicitly settings this property overrides
the presence (or abscence) of the attribute.
+
+ \sa void-qt-mac-set-native-menubar-bool-enable
*/
void QMenuBar::setNativeMenuBar(bool nativeMenuBar)
@@ -1920,6 +1884,8 @@ QAction *QMenuBar::defaultAction() const
is triggered as a result of a mouse click; \a action is the action that
caused the signal to be emitted.
+ \note QMenuBar has to have ownership of the QMenu in order this signal to work.
+
Normally, you connect each menu action to a single slot using
QAction::triggered(), but sometimes you will want to connect
several items to a single slot (most often if the user selects
diff --git a/src/widgets/widgets/qmenubar.h b/src/widgets/widgets/qmenubar.h
index 84fb378064..b20682ef6c 100644
--- a/src/widgets/widgets/qmenubar.h
+++ b/src/widgets/widgets/qmenubar.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -43,16 +43,11 @@
#define QMENUBAR_H
#include <QtWidgets/qmenu.h>
-#ifdef Q_OS_MAC
-#include "QtWidgets/qmacdefines_mac.h"
-#endif
-
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
#ifndef QT_NO_MENUBAR
@@ -157,12 +152,6 @@ private:
friend class QMenu;
friend class QMenuPrivate;
friend class QWindowsStyle;
-
-#ifdef Q_OS_MAC
- friend class QApplicationPrivate;
- friend class QWidgetPrivate;
- friend bool qt_mac_activate_action(MenuRef, uint, QAction::ActionEvent, bool);
-#endif
};
#endif // QT_NO_MENUBAR
diff --git a/src/widgets/widgets/qmenubar_p.h b/src/widgets/widgets/qmenubar_p.h
index de1ab37a19..a15a1e432e 100644
--- a/src/widgets/widgets/qmenubar_p.h
+++ b/src/widgets/widgets/qmenubar_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -61,13 +61,6 @@
#include "qguifunctions_wince.h"
#endif
-#ifndef QT_NO_MENUBAR
-#ifdef Q_WS_S60
-class CCoeControl;
-class CEikMenuBar;
-#endif
-#endif
-
QT_BEGIN_NAMESPACE
#ifndef QT_NO_MENUBAR
@@ -83,10 +76,6 @@ public:
#ifdef Q_WS_WINCE
, wce_menubar(0), wceClassicMenu(false)
#endif
-#ifdef Q_WS_S60
- , symbian_menubar(0)
-#endif
-
{ }
~QMenuBarPrivate()
{
@@ -94,9 +83,6 @@ public:
#ifdef Q_WS_WINCE
delete wce_menubar;
#endif
-#ifdef Q_WS_S60
- delete symbian_menubar;
-#endif
}
void init();
@@ -203,35 +189,6 @@ public:
void wceRefresh();
bool wceEmitSignals(QList<QWceMenuAction*> actions, uint command);
#endif
-#ifdef Q_WS_S60
- void symbianCreateMenuBar(QWidget *);
- void symbianDestroyMenuBar();
- void reparentMenuBar(QWidget *oldParent, QWidget *newParent);
- struct QSymbianMenuBarPrivate {
- QList<QSymbianMenuAction*> actionItems;
- QMenuBarPrivate *d;
- QSymbianMenuBarPrivate(QMenuBarPrivate *menubar);
- ~QSymbianMenuBarPrivate();
- void addAction(QAction *, QSymbianMenuAction* =0);
- void addAction(QSymbianMenuAction *, QSymbianMenuAction* =0);
- void syncAction(QSymbianMenuAction *);
- inline void syncAction(QAction *a) { syncAction(findAction(a)); }
- void removeAction(QSymbianMenuAction *);
- void rebuild();
- inline void removeAction(QAction *a) { removeAction(findAction(a)); }
- inline QSymbianMenuAction *findAction(QAction *a) {
- for(int i = 0; i < actionItems.size(); i++) {
- QSymbianMenuAction *act = actionItems[i];
- if(a == act->action)
- return act;
- }
- return 0;
- }
- void insertNativeMenuItems(const QList<QAction*> &actions);
-
- } *symbian_menubar;
- static int symbianCommands(int command);
-#endif
#ifdef QT_SOFTKEYS_ENABLED
QAction *menuBarAction;
#endif
diff --git a/src/widgets/widgets/qplaintextedit.cpp b/src/widgets/widgets/qplaintextedit.cpp
index 9f92406a04..674a818052 100644
--- a/src/widgets/widgets/qplaintextedit.cpp
+++ b/src/widgets/widgets/qplaintextedit.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/widgets/qplaintextedit.h b/src/widgets/widgets/qplaintextedit.h
index 9860914b98..3d53aeb1d5 100644
--- a/src/widgets/widgets/qplaintextedit.h
+++ b/src/widgets/widgets/qplaintextedit.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -57,7 +57,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
class QStyleSheet;
class QTextDocument;
diff --git a/src/widgets/widgets/qplaintextedit_p.h b/src/widgets/widgets/qplaintextedit_p.h
index 8f880d9772..b825bff9fd 100644
--- a/src/widgets/widgets/qplaintextedit_p.h
+++ b/src/widgets/widgets/qplaintextedit_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/widgets/qprogressbar.cpp b/src/widgets/widgets/qprogressbar.cpp
index e731b63c66..eabed2ee62 100644
--- a/src/widgets/widgets/qprogressbar.cpp
+++ b/src/widgets/widgets/qprogressbar.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -314,7 +314,7 @@ void QProgressBar::setValue(int value)
d->value = value;
emit valueChanged(value);
#ifndef QT_NO_ACCESSIBILITY
- QAccessible::updateAccessibility(this, 0, QAccessible::ValueChanged);
+ QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::ValueChanged, this, 0));
#endif
if (d->repaintRequired())
repaint();
diff --git a/src/widgets/widgets/qprogressbar.h b/src/widgets/widgets/qprogressbar.h
index cdb6d36dfd..fad1ee4e0b 100644
--- a/src/widgets/widgets/qprogressbar.h
+++ b/src/widgets/widgets/qprogressbar.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -48,7 +48,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
#ifndef QT_NO_PROGRESSBAR
diff --git a/src/widgets/widgets/qpushbutton.cpp b/src/widgets/widgets/qpushbutton.cpp
index ff477ec1d7..99252c43dc 100644
--- a/src/widgets/widgets/qpushbutton.cpp
+++ b/src/widgets/widgets/qpushbutton.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -376,7 +376,7 @@ void QPushButton::setDefault(bool enable)
}
update();
#ifndef QT_NO_ACCESSIBILITY
- QAccessible::updateAccessibility(this, 0, QAccessible::StateChanged);
+ QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::StateChanged, this, 0));
#endif
}
diff --git a/src/widgets/widgets/qpushbutton.h b/src/widgets/widgets/qpushbutton.h
index 1dc0a19542..125a679d6d 100644
--- a/src/widgets/widgets/qpushbutton.h
+++ b/src/widgets/widgets/qpushbutton.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -48,7 +48,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
class QPushButtonPrivate;
class QMenu;
diff --git a/src/widgets/widgets/qpushbutton_p.h b/src/widgets/widgets/qpushbutton_p.h
index d77b69a341..a35847a8dd 100644
--- a/src/widgets/widgets/qpushbutton_p.h
+++ b/src/widgets/widgets/qpushbutton_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/widgets/qradiobutton.cpp b/src/widgets/widgets/qradiobutton.cpp
index 1cf321bd16..792550949b 100644
--- a/src/widgets/widgets/qradiobutton.cpp
+++ b/src/widgets/widgets/qradiobutton.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/widgets/qradiobutton.h b/src/widgets/widgets/qradiobutton.h
index aa3458bf95..cb011bc92b 100644
--- a/src/widgets/widgets/qradiobutton.h
+++ b/src/widgets/widgets/qradiobutton.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -48,7 +48,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
class QRadioButtonPrivate;
class QStyleOptionButton;
diff --git a/src/widgets/widgets/qrubberband.cpp b/src/widgets/widgets/qrubberband.cpp
index bb67b292af..0f95f0188a 100644
--- a/src/widgets/widgets/qrubberband.cpp
+++ b/src/widgets/widgets/qrubberband.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/widgets/qrubberband.h b/src/widgets/widgets/qrubberband.h
index 05b35a772b..fc2d295c0e 100644
--- a/src/widgets/widgets/qrubberband.h
+++ b/src/widgets/widgets/qrubberband.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -48,7 +48,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
#ifndef QT_NO_RUBBERBAND
diff --git a/src/widgets/widgets/qscrollarea.cpp b/src/widgets/widgets/qscrollarea.cpp
index 9912b5e211..490dea0d2d 100644
--- a/src/widgets/widgets/qscrollarea.cpp
+++ b/src/widgets/widgets/qscrollarea.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/widgets/qscrollarea.h b/src/widgets/widgets/qscrollarea.h
index 0dcd280894..8d94ffb995 100644
--- a/src/widgets/widgets/qscrollarea.h
+++ b/src/widgets/widgets/qscrollarea.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -48,7 +48,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
#ifndef QT_NO_SCROLLAREA
diff --git a/src/widgets/widgets/qscrollarea_p.h b/src/widgets/widgets/qscrollarea_p.h
index e36e99add2..12f208dff6 100644
--- a/src/widgets/widgets/qscrollarea_p.h
+++ b/src/widgets/widgets/qscrollarea_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/widgets/qscrollbar.cpp b/src/widgets/widgets/qscrollbar.cpp
index 47a10de702..bca5517d8a 100644
--- a/src/widgets/widgets/qscrollbar.cpp
+++ b/src/widgets/widgets/qscrollbar.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/widgets/qscrollbar.h b/src/widgets/widgets/qscrollbar.h
index ac6146cc3f..1a30428edd 100644
--- a/src/widgets/widgets/qscrollbar.h
+++ b/src/widgets/widgets/qscrollbar.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -49,7 +49,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
#ifndef QT_NO_SCROLLBAR
diff --git a/src/widgets/widgets/qsizegrip.cpp b/src/widgets/widgets/qsizegrip.cpp
index 9f02c131ea..145bdf02d4 100644
--- a/src/widgets/widgets/qsizegrip.cpp
+++ b/src/widgets/widgets/qsizegrip.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -52,11 +52,6 @@
#include "qdebug.h"
#include <QDesktopWidget>
-#if defined(Q_WS_X11)
-#include <private/qt_x11_p.h>
-#elif defined (Q_WS_WIN)
-#include "qt_windows.h"
-#endif
#ifdef Q_WS_MAC
#include <private/qt_mac_p.h>
#endif
@@ -64,13 +59,23 @@
#include <private/qwidget_p.h>
#include <QtWidgets/qabstractscrollarea.h>
-#define SZ_SIZEBOTTOMRIGHT 0xf008
-#define SZ_SIZEBOTTOMLEFT 0xf007
-#define SZ_SIZETOPLEFT 0xf004
-#define SZ_SIZETOPRIGHT 0xf005
+#ifdef Q_OS_WIN
+# include <QtCore/qt_windows.h>
+# include "private/qapplication_p.h"
+#endif
QT_BEGIN_NAMESPACE
+#if defined (Q_OS_WIN)
+# define SZ_SIZEBOTTOMRIGHT 0xf008
+# define SZ_SIZEBOTTOMLEFT 0xf007
+# define SZ_SIZETOPLEFT 0xf004
+# define SZ_SIZETOPRIGHT 0xf005
+
+HMENU qt_getWindowsSystemMenu(const QWidget *w);
+
+#endif
+
static QWidget *qt_sizegrip_topLevelWidget(QWidget* w)
{
while (w && !w->isWindow() && w->windowType() != Qt::SubWindow)
@@ -317,7 +322,7 @@ void QSizeGrip::mousePressEvent(QMouseEvent * e)
return;
}
#endif // Q_WS_X11
-#ifdef Q_WS_WIN
+#ifdef Q_OS_WIN
if (tlw->isWindow() && !tlw->testAttribute(Qt::WA_DontShowOnScreen) && !qt_widget_private(tlw)->hasHeightForWidth()) {
uint orientation = 0;
if (d->atBottom())
@@ -326,10 +331,10 @@ void QSizeGrip::mousePressEvent(QMouseEvent * e)
orientation = d->atLeft() ? SZ_SIZETOPLEFT : SZ_SIZETOPRIGHT;
ReleaseCapture();
- PostMessage(tlw->winId(), WM_SYSCOMMAND, orientation, 0);
+ PostMessage(QApplicationPrivate::getHWNDForWidget(tlw), WM_SYSCOMMAND, orientation, 0);
return;
}
-#endif // Q_WS_WIN
+#endif // Q_OS_WIN
// Find available desktop/workspace geometry.
QRect availableGeometry;
@@ -411,12 +416,13 @@ void QSizeGrip::mouseMoveEvent(QMouseEvent * e)
&& !tlw->testAttribute(Qt::WA_DontShowOnScreen) && !qt_widget_private(tlw)->hasHeightForWidth())
return;
#endif
-#ifdef Q_WS_WIN
- if (tlw->isWindow() && GetSystemMenu(tlw->winId(), FALSE) != 0 && internalWinId()
- && !tlw->testAttribute(Qt::WA_DontShowOnScreen) && !qt_widget_private(tlw)->hasHeightForWidth()) {
- MSG msg;
- while(PeekMessage(&msg, winId(), WM_MOUSEMOVE, WM_MOUSEMOVE, PM_REMOVE));
- return;
+#ifdef Q_OS_WIN
+ if (tlw->isWindow() && qt_getWindowsSystemMenu(tlw) && !tlw->testAttribute(Qt::WA_DontShowOnScreen) && !qt_widget_private(tlw)->hasHeightForWidth()) {
+ if (const HWND hwnd = QApplicationPrivate::getHWNDForWidget(tlw)) {
+ MSG msg;
+ while (PeekMessage(&msg, hwnd, WM_MOUSEMOVE, WM_MOUSEMOVE, PM_REMOVE)) ;
+ return;
+ }
}
#endif
@@ -541,14 +547,6 @@ bool QSizeGrip::event(QEvent *event)
return QWidget::event(event);
}
-#ifdef Q_WS_WIN
-/*! \reimp */
-bool QSizeGrip::winEvent( MSG *m, long *result )
-{
- return QWidget::winEvent(m, result);
-}
-#endif
-
QT_END_NAMESPACE
#include "moc_qsizegrip.cpp"
diff --git a/src/widgets/widgets/qsizegrip.h b/src/widgets/widgets/qsizegrip.h
index acac950b44..bd8302e860 100644
--- a/src/widgets/widgets/qsizegrip.h
+++ b/src/widgets/widgets/qsizegrip.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -48,7 +48,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
#ifndef QT_NO_SIZEGRIP
class QSizeGripPrivate;
@@ -72,9 +71,6 @@ protected:
void hideEvent(QHideEvent *hideEvent);
bool eventFilter(QObject *, QEvent *);
bool event(QEvent *);
-#ifdef Q_WS_WIN
- bool winEvent(MSG *m, long *result);
-#endif
public:
diff --git a/src/widgets/widgets/qslider.cpp b/src/widgets/widgets/qslider.cpp
index 0f646fc19d..b05726c965 100644
--- a/src/widgets/widgets/qslider.cpp
+++ b/src/widgets/widgets/qslider.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/widgets/qslider.h b/src/widgets/widgets/qslider.h
index a050f229fb..55d1b939ba 100644
--- a/src/widgets/widgets/qslider.h
+++ b/src/widgets/widgets/qslider.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -48,7 +48,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
#ifndef QT_NO_SLIDER
diff --git a/src/widgets/widgets/qspinbox.cpp b/src/widgets/widgets/qspinbox.cpp
index 89743740de..ee94368690 100644
--- a/src/widgets/widgets/qspinbox.cpp
+++ b/src/widgets/widgets/qspinbox.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -990,11 +990,11 @@ QVariant QSpinBoxPrivate::validateAndInterpret(QString &input, int &pos,
state = QValidator::Invalid; // special-case -0 will be interpreted as 0 and thus not be invalid with a range from 0-100
} else {
bool ok = false;
- num = locale.toInt(copy, &ok, 10);
+ num = locale.toInt(copy, &ok);
if (!ok && copy.contains(locale.groupSeparator()) && (max >= 1000 || min <= -1000)) {
QString copy2 = copy;
copy2.remove(locale.groupSeparator());
- num = locale.toInt(copy2, &ok, 10);
+ num = locale.toInt(copy2, &ok);
}
QSBDEBUG() << __FILE__ << __LINE__<< "num is set to" << num;
if (!ok) {
diff --git a/src/widgets/widgets/qspinbox.h b/src/widgets/widgets/qspinbox.h
index bfc91b1ecf..305013d4fa 100644
--- a/src/widgets/widgets/qspinbox.h
+++ b/src/widgets/widgets/qspinbox.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -48,7 +48,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
#ifndef QT_NO_SPINBOX
diff --git a/src/widgets/widgets/qsplashscreen.cpp b/src/widgets/widgets/qsplashscreen.cpp
index 4fb0f3fa76..5a7d6376ca 100644
--- a/src/widgets/widgets/qsplashscreen.cpp
+++ b/src/widgets/widgets/qsplashscreen.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/widgets/qsplashscreen.h b/src/widgets/widgets/qsplashscreen.h
index f58b78adcb..742ee989bb 100644
--- a/src/widgets/widgets/qsplashscreen.h
+++ b/src/widgets/widgets/qsplashscreen.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -49,7 +49,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
#ifndef QT_NO_SPLASHSCREEN
class QSplashScreenPrivate;
diff --git a/src/widgets/widgets/qsplitter.cpp b/src/widgets/widgets/qsplitter.cpp
index ca22e0718a..285099a4cb 100644
--- a/src/widgets/widgets/qsplitter.cpp
+++ b/src/widgets/widgets/qsplitter.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/widgets/qsplitter.h b/src/widgets/widgets/qsplitter.h
index ee62ab76f2..3d1b4e3d83 100644
--- a/src/widgets/widgets/qsplitter.h
+++ b/src/widgets/widgets/qsplitter.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -49,7 +49,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
#ifndef QT_NO_SPLITTER
diff --git a/src/widgets/widgets/qsplitter_p.h b/src/widgets/widgets/qsplitter_p.h
index a06b65c5d3..c9db6ef9af 100644
--- a/src/widgets/widgets/qsplitter_p.h
+++ b/src/widgets/widgets/qsplitter_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/widgets/qstackedwidget.cpp b/src/widgets/widgets/qstackedwidget.cpp
index 5544f241a9..5a8a382a58 100644
--- a/src/widgets/widgets/qstackedwidget.cpp
+++ b/src/widgets/widgets/qstackedwidget.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/widgets/qstackedwidget.h b/src/widgets/widgets/qstackedwidget.h
index 8dc24dd56f..9233634746 100644
--- a/src/widgets/widgets/qstackedwidget.h
+++ b/src/widgets/widgets/qstackedwidget.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -48,7 +48,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
#ifndef QT_NO_STACKEDWIDGET
diff --git a/src/widgets/widgets/qstatusbar.cpp b/src/widgets/widgets/qstatusbar.cpp
index 357c3c72d1..9f170626da 100644
--- a/src/widgets/widgets/qstatusbar.cpp
+++ b/src/widgets/widgets/qstatusbar.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/widgets/qstatusbar.h b/src/widgets/widgets/qstatusbar.h
index e24e9da150..b05bf627ad 100644
--- a/src/widgets/widgets/qstatusbar.h
+++ b/src/widgets/widgets/qstatusbar.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -48,7 +48,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
#ifndef QT_NO_STATUSBAR
diff --git a/src/widgets/widgets/qtabbar.cpp b/src/widgets/widgets/qtabbar.cpp
index c939c4aa7c..580aea10b9 100644
--- a/src/widgets/widgets/qtabbar.cpp
+++ b/src/widgets/widgets/qtabbar.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -67,10 +67,6 @@
#include <private/qt_cocoa_helpers_mac_p.h>
#endif
-#ifndef QT_NO_STYLE_S60
-#include "qs60style.h"
-#endif
-
QT_BEGIN_NAMESPACE
@@ -495,9 +491,6 @@ void QTabBarPrivate::layoutTabs()
if (useScrollButtons && tabList.count() && last > available) {
int extra = extraWidth();
-#ifndef QT_NO_STYLE_S60
- QS60Style *s60Style = qobject_cast<QS60Style*>(QApplication::style());
-#endif
if (!vertTabs) {
Qt::LayoutDirection ld = q->layoutDirection();
QRect arrows = QStyle::visualRect(ld, q->rect(),
@@ -505,57 +498,25 @@ void QTabBarPrivate::layoutTabs()
int buttonOverlap = q->style()->pixelMetric(QStyle::PM_TabBar_ScrollButtonOverlap, 0, q);
if (ld == Qt::LeftToRight) {
-// In S60style, tab scroll buttons are layoutted separately, on the sides of the tabbar.
-#ifndef QT_NO_STYLE_S60
- if (s60Style) {
- rightB->setGeometry(arrows.left() + extra / 2, arrows.top(), extra / 2, arrows.height());
- leftB->setGeometry(0, arrows.top(), extra / 2, arrows.height());
- } else {
-#endif
leftB->setGeometry(arrows.left(), arrows.top(), extra/2, arrows.height());
rightB->setGeometry(arrows.right() - extra/2 + buttonOverlap, arrows.top(),
extra/2, arrows.height());
-#ifndef QT_NO_STYLE_S60
- }
-#endif
leftB->setArrowType(Qt::LeftArrow);
rightB->setArrowType(Qt::RightArrow);
} else {
-#ifndef QT_NO_STYLE_S60
- if (s60Style) {
- rightB->setGeometry(arrows.left() + extra / 2, arrows.top(), extra / 2, arrows.height());
- leftB->setGeometry(0, arrows.top(), extra / 2, arrows.height());
- } else {
-#endif
rightB->setGeometry(arrows.left(), arrows.top(), extra/2, arrows.height());
leftB->setGeometry(arrows.right() - extra/2 + buttonOverlap, arrows.top(),
extra/2, arrows.height());
-#ifndef QT_NO_STYLE_S60
- }
-#endif
rightB->setArrowType(Qt::LeftArrow);
leftB->setArrowType(Qt::RightArrow);
}
} else {
-#ifndef QT_NO_STYLE_S60
- if (s60Style) {
- QRect arrows = QRect(0, 0, size.width(), available );
- leftB->setGeometry(arrows.left(), arrows.top(), arrows.width(), extra / 2);
- leftB->setArrowType(Qt::UpArrow);
- rightB->setGeometry(arrows.left(), arrows.bottom() - extra / 2 + 1,
- arrows.width(), extra / 2);
- rightB->setArrowType(Qt::DownArrow);
- } else {
-#endif
QRect arrows = QRect(0, available - extra, size.width(), extra );
leftB->setGeometry(arrows.left(), arrows.top(), arrows.width(), extra/2);
leftB->setArrowType(Qt::UpArrow);
rightB->setGeometry(arrows.left(), arrows.bottom() - extra/2 + 1,
arrows.width(), extra/2);
rightB->setArrowType(Qt::DownArrow);
-#ifndef QT_NO_STYLE_S60
- }
-#endif
}
leftB->setEnabled(scrollOffset > 0);
rightB->setEnabled(last - scrollOffset >= available - extra);
@@ -1222,8 +1183,8 @@ void QTabBar::setCurrentIndex(int index)
d->layoutTab(index);
#ifndef QT_NO_ACCESSIBILITY
if (QAccessible::isActive()) {
- QAccessible::updateAccessibility(this, index + 1, QAccessible::Focus);
- QAccessible::updateAccessibility(this, index + 1, QAccessible::Selection);
+ QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::Focus, this, index + 1));
+ QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::Selection, this, index + 1));
}
#endif
emit currentChanged(index);
diff --git a/src/widgets/widgets/qtabbar.h b/src/widgets/widgets/qtabbar.h
index cfe9a90b47..3a4b9198d3 100644
--- a/src/widgets/widgets/qtabbar.h
+++ b/src/widgets/widgets/qtabbar.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -48,7 +48,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
#ifndef QT_NO_TABBAR
diff --git a/src/widgets/widgets/qtabbar_p.h b/src/widgets/widgets/qtabbar_p.h
index 2060e169f2..c907b48eeb 100644
--- a/src/widgets/widgets/qtabbar_p.h
+++ b/src/widgets/widgets/qtabbar_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/widgets/qtabwidget.cpp b/src/widgets/widgets/qtabwidget.cpp
index 636a68994a..66d31e72c7 100644
--- a/src/widgets/widgets/qtabwidget.cpp
+++ b/src/widgets/widgets/qtabwidget.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/widgets/qtabwidget.h b/src/widgets/widgets/qtabwidget.h
index 432870df25..1865ddf897 100644
--- a/src/widgets/widgets/qtabwidget.h
+++ b/src/widgets/widgets/qtabwidget.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -49,7 +49,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
#ifndef QT_NO_TABWIDGET
diff --git a/src/widgets/widgets/qtextbrowser.cpp b/src/widgets/widgets/qtextbrowser.cpp
index dbda9e3b94..d9229c12e8 100644
--- a/src/widgets/widgets/qtextbrowser.cpp
+++ b/src/widgets/widgets/qtextbrowser.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/widgets/qtextbrowser.h b/src/widgets/widgets/qtextbrowser.h
index ee977be23b..7ebcffa951 100644
--- a/src/widgets/widgets/qtextbrowser.h
+++ b/src/widgets/widgets/qtextbrowser.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -49,7 +49,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
#ifndef QT_NO_TEXTBROWSER
diff --git a/src/widgets/widgets/qtextedit.cpp b/src/widgets/widgets/qtextedit.cpp
index acd663eb8c..002d7860cd 100644
--- a/src/widgets/widgets/qtextedit.cpp
+++ b/src/widgets/widgets/qtextedit.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/widgets/qtextedit.h b/src/widgets/widgets/qtextedit.h
index b86c0e0999..3148c7a0cf 100644
--- a/src/widgets/widgets/qtextedit.h
+++ b/src/widgets/widgets/qtextedit.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -55,7 +55,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
class QStyleSheet;
class QTextDocument;
diff --git a/src/widgets/widgets/qtextedit_p.h b/src/widgets/widgets/qtextedit_p.h
index e7f172ec0f..ca74bc3737 100644
--- a/src/widgets/widgets/qtextedit_p.h
+++ b/src/widgets/widgets/qtextedit_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/widgets/qtoolbar.cpp b/src/widgets/widgets/qtoolbar.cpp
index 6b1d414830..c9fe4f7cc2 100644
--- a/src/widgets/widgets/qtoolbar.cpp
+++ b/src/widgets/widgets/qtoolbar.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/widgets/qtoolbar.h b/src/widgets/widgets/qtoolbar.h
index 4f51cf045d..ac59d9803a 100644
--- a/src/widgets/widgets/qtoolbar.h
+++ b/src/widgets/widgets/qtoolbar.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -48,7 +48,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
#ifndef QT_NO_TOOLBAR
diff --git a/src/widgets/widgets/qtoolbar_p.h b/src/widgets/widgets/qtoolbar_p.h
index 14ec575dc5..4a5009575f 100644
--- a/src/widgets/widgets/qtoolbar_p.h
+++ b/src/widgets/widgets/qtoolbar_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/widgets/qtoolbararealayout.cpp b/src/widgets/widgets/qtoolbararealayout.cpp
index 2650f7676e..789d1561c4 100644
--- a/src/widgets/widgets/qtoolbararealayout.cpp
+++ b/src/widgets/widgets/qtoolbararealayout.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/widgets/qtoolbararealayout_p.h b/src/widgets/widgets/qtoolbararealayout_p.h
index b61b2c76c9..7502cc7e90 100644
--- a/src/widgets/widgets/qtoolbararealayout_p.h
+++ b/src/widgets/widgets/qtoolbararealayout_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/widgets/qtoolbarextension.cpp b/src/widgets/widgets/qtoolbarextension.cpp
index 341bd9cbb3..44275e8b36 100644
--- a/src/widgets/widgets/qtoolbarextension.cpp
+++ b/src/widgets/widgets/qtoolbarextension.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/widgets/qtoolbarextension_p.h b/src/widgets/widgets/qtoolbarextension_p.h
index a60584f755..6c9ea4d9a4 100644
--- a/src/widgets/widgets/qtoolbarextension_p.h
+++ b/src/widgets/widgets/qtoolbarextension_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/widgets/qtoolbarlayout.cpp b/src/widgets/widgets/qtoolbarlayout.cpp
index 2e5aaa61f2..7255a6e538 100644
--- a/src/widgets/widgets/qtoolbarlayout.cpp
+++ b/src/widgets/widgets/qtoolbarlayout.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/widgets/qtoolbarlayout_p.h b/src/widgets/widgets/qtoolbarlayout_p.h
index 7c2a60d51a..248c13bfe1 100644
--- a/src/widgets/widgets/qtoolbarlayout_p.h
+++ b/src/widgets/widgets/qtoolbarlayout_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/widgets/qtoolbarseparator.cpp b/src/widgets/widgets/qtoolbarseparator.cpp
index 4dd11679fa..39fbde78a3 100644
--- a/src/widgets/widgets/qtoolbarseparator.cpp
+++ b/src/widgets/widgets/qtoolbarseparator.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/widgets/qtoolbarseparator_p.h b/src/widgets/widgets/qtoolbarseparator_p.h
index 5807c9f0b8..4269cbb6d5 100644
--- a/src/widgets/widgets/qtoolbarseparator_p.h
+++ b/src/widgets/widgets/qtoolbarseparator_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/widgets/qtoolbox.cpp b/src/widgets/widgets/qtoolbox.cpp
index 2bf0dc0d9d..69ff2ffd7e 100644
--- a/src/widgets/widgets/qtoolbox.cpp
+++ b/src/widgets/widgets/qtoolbox.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/widgets/qtoolbox.h b/src/widgets/widgets/qtoolbox.h
index 8e7ac52646..5732668b8f 100644
--- a/src/widgets/widgets/qtoolbox.h
+++ b/src/widgets/widgets/qtoolbox.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -49,7 +49,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
#ifndef QT_NO_TOOLBOX
diff --git a/src/widgets/widgets/qtoolbutton.cpp b/src/widgets/widgets/qtoolbutton.cpp
index 5b3a328dcc..015419a879 100644
--- a/src/widgets/widgets/qtoolbutton.cpp
+++ b/src/widgets/widgets/qtoolbutton.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/widgets/qtoolbutton.h b/src/widgets/widgets/qtoolbutton.h
index c451e2cc13..0cfadf0e1c 100644
--- a/src/widgets/widgets/qtoolbutton.h
+++ b/src/widgets/widgets/qtoolbutton.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -48,7 +48,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
#ifndef QT_NO_TOOLBUTTON
diff --git a/src/widgets/widgets/qwidgetanimator.cpp b/src/widgets/widgets/qwidgetanimator.cpp
index de92a53257..086f0f0cb2 100644
--- a/src/widgets/widgets/qwidgetanimator.cpp
+++ b/src/widgets/widgets/qwidgetanimator.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/widgets/qwidgetanimator_p.h b/src/widgets/widgets/qwidgetanimator_p.h
index d6e7a86e7b..e2054401d6 100644
--- a/src/widgets/widgets/qwidgetanimator_p.h
+++ b/src/widgets/widgets/qwidgetanimator_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/widgets/qwidgetlinecontrol.cpp b/src/widgets/widgets/qwidgetlinecontrol.cpp
index e52193e20c..2f5793bcba 100644
--- a/src/widgets/widgets/qwidgetlinecontrol.cpp
+++ b/src/widgets/widgets/qwidgetlinecontrol.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -206,7 +206,7 @@ void QWidgetLineControl::commitPreedit()
if (!composeMode())
return;
- qApp->inputPanel()->reset();
+ qApp->inputMethod()->reset();
if (!m_tentativeCommit.isEmpty()) {
internalInsert(m_tentativeCommit);
@@ -758,7 +758,7 @@ void QWidgetLineControl::internalSetText(const QString &txt, int pos, bool edite
#ifndef QT_NO_ACCESSIBILITY
if (changed)
- QAccessible::updateAccessibility(parent(), 0, QAccessible::TextUpdated);
+ QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::TextUpdated, parent(), 0));
#endif
}
@@ -1357,7 +1357,7 @@ void QWidgetLineControl::emitCursorPositionChanged()
m_lastCursorPos = m_cursor;
cursorPositionChanged(oldLast, m_cursor);
#ifndef QT_NO_ACCESSIBILITY
- QAccessible::updateAccessibility(parent(), 0, QAccessible::TextCaretMoved);
+ QAccessible::updateAccessibility(QAccessibleEvent(QAccessible::TextCaretMoved, parent(), 0));
#endif
}
}
diff --git a/src/widgets/widgets/qwidgetlinecontrol_p.h b/src/widgets/widgets/qwidgetlinecontrol_p.h
index d8f27a4003..1d955363e6 100644
--- a/src/widgets/widgets/qwidgetlinecontrol_p.h
+++ b/src/widgets/widgets/qwidgetlinecontrol_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -62,7 +62,7 @@
#include "QtWidgets/qstyleoption.h"
#include "QtCore/qpointer.h"
#include "QtGui/qclipboard.h"
-#include "QtGui/qinputpanel.h"
+#include "QtGui/qinputmethod.h"
#include "QtCore/qpoint.h"
#include "QtWidgets/qcompleter.h"
#include "QtCore/qthread.h"
@@ -79,7 +79,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
class Q_WIDGETS_EXPORT QWidgetLineControl : public QObject
{
@@ -233,7 +232,7 @@ public:
void setText(const QString &txt)
{
if (composeMode())
- qApp->inputPanel()->reset();
+ qApp->inputMethod()->reset();
m_tentativeCommit.clear();
internalSetText(txt, -1, false);
}
@@ -319,7 +318,7 @@ public:
Qt::LayoutDirection layoutDirection() const {
if (m_layoutDirection == Qt::LayoutDirectionAuto) {
if (m_text.isEmpty())
- return qApp->inputPanel()->inputDirection();
+ return qApp->inputMethod()->inputDirection();
return m_text.isRightToLeft() ? Qt::RightToLeft : Qt::LeftToRight;
}
return m_layoutDirection;
diff --git a/src/widgets/widgets/qwidgetresizehandler.cpp b/src/widgets/widgets/qwidgetresizehandler.cpp
index 5881d2360d..aba0ca58c6 100644
--- a/src/widgets/widgets/qwidgetresizehandler.cpp
+++ b/src/widgets/widgets/qwidgetresizehandler.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -48,9 +48,6 @@
#include "qcursor.h"
#include "qsizegrip.h"
#include "qevent.h"
-#if defined(Q_WS_WIN)
-#include "qt_windows.h"
-#endif
#include "qdebug.h"
#include "private/qlayoutengine_p.h"
diff --git a/src/widgets/widgets/qwidgetresizehandler_p.h b/src/widgets/widgets/qwidgetresizehandler_p.h
index 5a355611fd..e5f219904a 100644
--- a/src/widgets/widgets/qwidgetresizehandler_p.h
+++ b/src/widgets/widgets/qwidgetresizehandler_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/widgets/qwidgettextcontrol.cpp b/src/widgets/widgets/qwidgettextcontrol.cpp
index 628848b0d7..96389b8333 100644
--- a/src/widgets/widgets/qwidgettextcontrol.cpp
+++ b/src/widgets/widgets/qwidgettextcontrol.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -75,7 +75,7 @@
#include <qvariant.h>
#include <qurl.h>
#include <qdesktopservices.h>
-#include <qinputpanel.h>
+#include <qinputmethod.h>
#include <qtooltip.h>
#include <qstyleoption.h>
#include <QtWidgets/qlineedit.h>
@@ -1689,7 +1689,7 @@ void QWidgetTextControlPrivate::mouseMoveEvent(QEvent *e, Qt::MouseButton button
_q_updateCurrentCharFormatAndSelection();
#ifndef QT_NO_IM
if (contextWidget)
- qApp->inputPanel()->update(Qt::ImQueryInput);
+ qApp->inputMethod()->update(Qt::ImQueryInput);
#endif //QT_NO_IM
} else {
//emit q->visibilityRequest(QRectF(mousePos, QSizeF(1, 1)));
@@ -1836,7 +1836,7 @@ bool QWidgetTextControlPrivate::sendMouseEventToInputContext(
if (cursorPos >= 0) {
if (e->type() == QEvent::MouseButtonRelease)
- qApp->inputPanel()->invokeAction(QInputPanel::Click, cursorPos);
+ qApp->inputMethod()->invokeAction(QInputMethod::Click, cursorPos);
e->setAccepted(true);
return true;
@@ -2755,7 +2755,7 @@ void QWidgetTextControlPrivate::commitPreedit()
return;
cursor.beginEditBlock();
- qApp->inputPanel()->reset();
+ qApp->inputMethod()->reset();
if (!tentativeCommit.isEmpty()) {
cursor.insertText(tentativeCommit);
diff --git a/src/widgets/widgets/qwidgettextcontrol_p.h b/src/widgets/widgets/qwidgettextcontrol_p.h
index 7425a7d878..f153267386 100644
--- a/src/widgets/widgets/qwidgettextcontrol_p.h
+++ b/src/widgets/widgets/qwidgettextcontrol_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -69,7 +69,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
class QStyleSheet;
class QTextDocument;
diff --git a/src/widgets/widgets/qwidgettextcontrol_p_p.h b/src/widgets/widgets/qwidgettextcontrol_p_p.h
index 7e49be7f7b..d0d940e521 100644
--- a/src/widgets/widgets/qwidgettextcontrol_p_p.h
+++ b/src/widgets/widgets/qwidgettextcontrol_p_p.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/widgets/qworkspace.cpp b/src/widgets/widgets/qworkspace.cpp
index 7aaeeb7282..be3f7836d5 100644
--- a/src/widgets/widgets/qworkspace.cpp
+++ b/src/widgets/widgets/qworkspace.cpp
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
diff --git a/src/widgets/widgets/qworkspace.h b/src/widgets/widgets/qworkspace.h
index 66fa57f5a4..9c18f3fce0 100644
--- a/src/widgets/widgets/qworkspace.h
+++ b/src/widgets/widgets/qworkspace.h
@@ -1,8 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Contact: http://www.qt-project.org/
**
** This file is part of the QtGui module of the Qt Toolkit.
**
@@ -35,6 +34,7 @@
**
**
**
+**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -48,7 +48,6 @@ QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
-QT_MODULE(Gui)
#ifndef QT_NO_WORKSPACE