summaryrefslogtreecommitdiffstats
path: root/src/widgets
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@digia.com>2013-03-20 13:46:57 +0100
committerOswald Buddenhagen <oswald.buddenhagen@digia.com>2013-03-20 13:49:28 +0100
commit76c0be34cd4ff4564693162fa7528463e23ce9d8 (patch)
treef165b7bc319548fb0082365411a871028f92e89e /src/widgets
parent27b4fe96b59e9e63d1e570e802c072e9afdfb2d4 (diff)
parent36cb3f3f655a9090c82de609010cbfb88651a0f3 (diff)
Merge branch 'dev' into stable
This starts Qt 5.1 release cycle Conflicts: src/gui/text/qfontdatabase.cpp src/gui/text/qharfbuzz_copy_p.h src/widgets/kernel/qapplication.cpp src/widgets/kernel/qcoreapplication.cpp Change-Id: I72fbf83ab3c2206aeea1b089428b0fc2a89bd62b
Diffstat (limited to 'src/widgets')
-rw-r--r--src/widgets/accessible/accessible.pri2
-rw-r--r--src/widgets/accessible/qaccessiblewidget.cpp8
-rw-r--r--src/widgets/accessible/qaccessiblewidget_p.h (renamed from src/widgets/accessible/qaccessiblewidget.h)7
-rw-r--r--src/widgets/dialogs/qcolordialog.cpp7
-rw-r--r--src/widgets/dialogs/qcolordialog.h6
-rw-r--r--src/widgets/dialogs/qcolordialog_p.h2
-rw-r--r--src/widgets/dialogs/qdialog.cpp2
-rw-r--r--src/widgets/dialogs/qdialog.h6
-rw-r--r--src/widgets/dialogs/qdialog_p.h2
-rw-r--r--src/widgets/dialogs/qerrormessage.cpp2
-rw-r--r--src/widgets/dialogs/qerrormessage.h6
-rw-r--r--src/widgets/dialogs/qfiledialog.cpp6
-rw-r--r--src/widgets/dialogs/qfiledialog.h6
-rw-r--r--src/widgets/dialogs/qfiledialog.ui2
-rw-r--r--src/widgets/dialogs/qfiledialog_embedded.ui2
-rw-r--r--src/widgets/dialogs/qfiledialog_p.h4
-rw-r--r--src/widgets/dialogs/qfileinfogatherer.cpp2
-rw-r--r--src/widgets/dialogs/qfileinfogatherer_p.h2
-rw-r--r--src/widgets/dialogs/qfilesystemmodel.cpp4
-rw-r--r--src/widgets/dialogs/qfilesystemmodel.h6
-rw-r--r--src/widgets/dialogs/qfilesystemmodel_p.h2
-rw-r--r--src/widgets/dialogs/qfontdialog.cpp2
-rw-r--r--src/widgets/dialogs/qfontdialog.h6
-rw-r--r--src/widgets/dialogs/qfontdialog_p.h2
-rw-r--r--src/widgets/dialogs/qfscompleter_p.h2
-rw-r--r--src/widgets/dialogs/qinputdialog.cpp2
-rw-r--r--src/widgets/dialogs/qinputdialog.h6
-rw-r--r--src/widgets/dialogs/qmessagebox.cpp26
-rw-r--r--src/widgets/dialogs/qmessagebox.h10
-rw-r--r--src/widgets/dialogs/qprogressdialog.cpp6
-rw-r--r--src/widgets/dialogs/qprogressdialog.h6
-rw-r--r--src/widgets/dialogs/qsidebar.cpp2
-rw-r--r--src/widgets/dialogs/qsidebar_p.h2
-rw-r--r--src/widgets/dialogs/qwizard.cpp44
-rw-r--r--src/widgets/dialogs/qwizard.h6
-rw-r--r--src/widgets/dialogs/qwizard_win.cpp181
-rw-r--r--src/widgets/dialogs/qwizard_win_p.h17
-rw-r--r--src/widgets/doc/snippets/code/src_gui_itemviews_qdatawidgetmapper.cpp2
-rw-r--r--src/widgets/doc/snippets/customviewstyle.cpp2
-rw-r--r--src/widgets/doc/snippets/javastyle.cpp20
-rw-r--r--src/widgets/doc/snippets/layouts/layouts.cpp6
-rw-r--r--src/widgets/doc/snippets/mainwindowsnippet.cpp8
-rw-r--r--src/widgets/doc/snippets/mdiareasnippets.cpp2
-rw-r--r--src/widgets/doc/snippets/myscrollarea.cpp2
-rw-r--r--src/widgets/doc/snippets/qtablewidget-using/mainwindow.cpp2
-rw-r--r--src/widgets/doc/snippets/simplemodel-use/main.cpp2
-rw-r--r--src/widgets/doc/snippets/stringlistmodel/model.cpp4
-rw-r--r--src/widgets/doc/snippets/timeline/main.cpp8
-rw-r--r--src/widgets/doc/src/model-view-programming.qdoc2
-rw-r--r--src/widgets/doc/src/widgets-and-layouts/focus.qdoc6
-rw-r--r--src/widgets/doc/src/widgets-and-layouts/layout.qdoc14
-rw-r--r--src/widgets/doc/src/windows-and-dialogs/dialogs.qdoc4
-rw-r--r--src/widgets/doc/src/windows-and-dialogs/mainwindow.qdoc2
-rw-r--r--src/widgets/effects/qgraphicseffect.cpp2
-rw-r--r--src/widgets/effects/qgraphicseffect.h5
-rw-r--r--src/widgets/effects/qgraphicseffect_p.h2
-rw-r--r--src/widgets/effects/qpixmapfilter.cpp2
-rw-r--r--src/widgets/effects/qpixmapfilter_p.h6
-rw-r--r--src/widgets/graphicsview/qgraph_p.h2
-rw-r--r--src/widgets/graphicsview/qgraphicsanchorlayout.cpp2
-rw-r--r--src/widgets/graphicsview/qgraphicsanchorlayout.h6
-rw-r--r--src/widgets/graphicsview/qgraphicsanchorlayout_p.cpp2
-rw-r--r--src/widgets/graphicsview/qgraphicsanchorlayout_p.h2
-rw-r--r--src/widgets/graphicsview/qgraphicsgridlayout.cpp2
-rw-r--r--src/widgets/graphicsview/qgraphicsgridlayout.h6
-rw-r--r--src/widgets/graphicsview/qgraphicsitem.cpp75
-rw-r--r--src/widgets/graphicsview/qgraphicsitem.h6
-rw-r--r--src/widgets/graphicsview/qgraphicsitem_p.h2
-rw-r--r--src/widgets/graphicsview/qgraphicsitemanimation.cpp2
-rw-r--r--src/widgets/graphicsview/qgraphicsitemanimation.h6
-rw-r--r--src/widgets/graphicsview/qgraphicslayout.cpp2
-rw-r--r--src/widgets/graphicsview/qgraphicslayout.h6
-rw-r--r--src/widgets/graphicsview/qgraphicslayout_p.cpp4
-rw-r--r--src/widgets/graphicsview/qgraphicslayout_p.h2
-rw-r--r--src/widgets/graphicsview/qgraphicslayoutitem.cpp2
-rw-r--r--src/widgets/graphicsview/qgraphicslayoutitem.h6
-rw-r--r--src/widgets/graphicsview/qgraphicslayoutitem_p.h2
-rw-r--r--src/widgets/graphicsview/qgraphicslinearlayout.cpp2
-rw-r--r--src/widgets/graphicsview/qgraphicslinearlayout.h6
-rw-r--r--src/widgets/graphicsview/qgraphicsproxywidget.cpp2
-rw-r--r--src/widgets/graphicsview/qgraphicsproxywidget.h6
-rw-r--r--src/widgets/graphicsview/qgraphicsproxywidget_p.h2
-rw-r--r--src/widgets/graphicsview/qgraphicsscene.cpp102
-rw-r--r--src/widgets/graphicsview/qgraphicsscene.h7
-rw-r--r--src/widgets/graphicsview/qgraphicsscene_bsp.cpp2
-rw-r--r--src/widgets/graphicsview/qgraphicsscene_bsp_p.h2
-rw-r--r--src/widgets/graphicsview/qgraphicsscene_p.h5
-rw-r--r--src/widgets/graphicsview/qgraphicsscenebsptreeindex.cpp2
-rw-r--r--src/widgets/graphicsview/qgraphicssceneevent.cpp2
-rw-r--r--src/widgets/graphicsview/qgraphicssceneevent.h6
-rw-r--r--src/widgets/graphicsview/qgraphicssceneindex.cpp2
-rw-r--r--src/widgets/graphicsview/qgraphicssceneindex_p.h4
-rw-r--r--src/widgets/graphicsview/qgraphicsscenelinearindex.cpp2
-rw-r--r--src/widgets/graphicsview/qgraphicsscenelinearindex_p.h4
-rw-r--r--src/widgets/graphicsview/qgraphicstransform.h5
-rw-r--r--src/widgets/graphicsview/qgraphicstransform_p.h2
-rw-r--r--src/widgets/graphicsview/qgraphicsview.cpp135
-rw-r--r--src/widgets/graphicsview/qgraphicsview.h12
-rw-r--r--src/widgets/graphicsview/qgraphicsview_p.h5
-rw-r--r--src/widgets/graphicsview/qgraphicswidget.cpp2
-rw-r--r--src/widgets/graphicsview/qgraphicswidget.h6
-rw-r--r--src/widgets/graphicsview/qgraphicswidget_p.cpp106
-rw-r--r--src/widgets/graphicsview/qgraphicswidget_p.h2
-rw-r--r--src/widgets/graphicsview/qgridlayoutengine.cpp2
-rw-r--r--src/widgets/graphicsview/qgridlayoutengine_p.h2
-rw-r--r--src/widgets/graphicsview/qsimplex_p.cpp2
-rw-r--r--src/widgets/graphicsview/qsimplex_p.h2
-rw-r--r--src/widgets/itemviews/qabstractitemdelegate.cpp2
-rw-r--r--src/widgets/itemviews/qabstractitemdelegate.h6
-rw-r--r--src/widgets/itemviews/qabstractitemview.cpp27
-rw-r--r--src/widgets/itemviews/qabstractitemview.h6
-rw-r--r--src/widgets/itemviews/qabstractitemview_p.h2
-rw-r--r--src/widgets/itemviews/qbsptree.cpp2
-rw-r--r--src/widgets/itemviews/qbsptree_p.h2
-rw-r--r--src/widgets/itemviews/qcolumnview.cpp2
-rw-r--r--src/widgets/itemviews/qcolumnview.h6
-rw-r--r--src/widgets/itemviews/qcolumnview_p.h2
-rw-r--r--src/widgets/itemviews/qcolumnviewgrip.cpp2
-rw-r--r--src/widgets/itemviews/qcolumnviewgrip_p.h2
-rw-r--r--src/widgets/itemviews/qdatawidgetmapper.cpp2
-rw-r--r--src/widgets/itemviews/qdatawidgetmapper.h6
-rw-r--r--src/widgets/itemviews/qdirmodel.cpp2
-rw-r--r--src/widgets/itemviews/qdirmodel.h6
-rw-r--r--src/widgets/itemviews/qfileiconprovider.cpp2
-rw-r--r--src/widgets/itemviews/qfileiconprovider.h6
-rw-r--r--src/widgets/itemviews/qheaderview.cpp2
-rw-r--r--src/widgets/itemviews/qheaderview.h6
-rw-r--r--src/widgets/itemviews/qheaderview_p.h2
-rw-r--r--src/widgets/itemviews/qitemdelegate.cpp2
-rw-r--r--src/widgets/itemviews/qitemdelegate.h6
-rw-r--r--src/widgets/itemviews/qitemeditorfactory.cpp2
-rw-r--r--src/widgets/itemviews/qitemeditorfactory.h6
-rw-r--r--src/widgets/itemviews/qitemeditorfactory_p.h2
-rw-r--r--src/widgets/itemviews/qlistview.cpp2
-rw-r--r--src/widgets/itemviews/qlistview.h6
-rw-r--r--src/widgets/itemviews/qlistview_p.h2
-rw-r--r--src/widgets/itemviews/qlistwidget.cpp2
-rw-r--r--src/widgets/itemviews/qlistwidget.h6
-rw-r--r--src/widgets/itemviews/qlistwidget_p.h2
-rw-r--r--src/widgets/itemviews/qstyleditemdelegate.cpp2
-rw-r--r--src/widgets/itemviews/qstyleditemdelegate.h6
-rw-r--r--src/widgets/itemviews/qtableview.cpp2
-rw-r--r--src/widgets/itemviews/qtableview.h6
-rw-r--r--src/widgets/itemviews/qtableview_p.h2
-rw-r--r--src/widgets/itemviews/qtablewidget.cpp2
-rw-r--r--src/widgets/itemviews/qtablewidget.h6
-rw-r--r--src/widgets/itemviews/qtablewidget_p.h2
-rw-r--r--src/widgets/itemviews/qtreeview.cpp52
-rw-r--r--src/widgets/itemviews/qtreeview.h6
-rw-r--r--src/widgets/itemviews/qtreeview_p.h4
-rw-r--r--src/widgets/itemviews/qtreewidget.cpp2
-rw-r--r--src/widgets/itemviews/qtreewidget.h6
-rw-r--r--src/widgets/itemviews/qtreewidget_p.h2
-rw-r--r--src/widgets/itemviews/qtreewidgetitemiterator.cpp11
-rw-r--r--src/widgets/itemviews/qtreewidgetitemiterator.h6
-rw-r--r--src/widgets/itemviews/qtreewidgetitemiterator_p.h2
-rw-r--r--src/widgets/itemviews/qwidgetitemdata_p.h2
-rw-r--r--src/widgets/kernel/kernel.pri6
-rw-r--r--src/widgets/kernel/mac.pri2
-rw-r--r--src/widgets/kernel/qaction.cpp2
-rw-r--r--src/widgets/kernel/qaction.h6
-rw-r--r--src/widgets/kernel/qaction_p.h2
-rw-r--r--src/widgets/kernel/qactiongroup.cpp2
-rw-r--r--src/widgets/kernel/qactiongroup.h6
-rw-r--r--src/widgets/kernel/qapplication.cpp36
-rw-r--r--src/widgets/kernel/qapplication.h6
-rw-r--r--src/widgets/kernel/qapplication_p.h5
-rw-r--r--src/widgets/kernel/qapplication_qpa.cpp2
-rw-r--r--src/widgets/kernel/qboxlayout.cpp8
-rw-r--r--src/widgets/kernel/qboxlayout.h6
-rw-r--r--src/widgets/kernel/qdesktopwidget.cpp2
-rw-r--r--src/widgets/kernel/qdesktopwidget.h6
-rw-r--r--src/widgets/kernel/qdesktopwidget.qdoc8
-rw-r--r--src/widgets/kernel/qdesktopwidget_qpa.cpp2
-rw-r--r--src/widgets/kernel/qdesktopwidget_qpa_p.h5
-rw-r--r--src/widgets/kernel/qformlayout.cpp2
-rw-r--r--src/widgets/kernel/qformlayout.h6
-rw-r--r--src/widgets/kernel/qgesture.cpp4
-rw-r--r--src/widgets/kernel/qgesture.h6
-rw-r--r--src/widgets/kernel/qgesture_p.h2
-rw-r--r--src/widgets/kernel/qgesturemanager.cpp2
-rw-r--r--src/widgets/kernel/qgesturemanager_p.h2
-rw-r--r--src/widgets/kernel/qgesturerecognizer.cpp2
-rw-r--r--src/widgets/kernel/qgesturerecognizer.h6
-rw-r--r--src/widgets/kernel/qgridlayout.cpp2
-rw-r--r--src/widgets/kernel/qgridlayout.h6
-rw-r--r--src/widgets/kernel/qlayout.cpp4
-rw-r--r--src/widgets/kernel/qlayout.h6
-rw-r--r--src/widgets/kernel/qlayout_p.h2
-rw-r--r--src/widgets/kernel/qlayoutengine.cpp2
-rw-r--r--src/widgets/kernel/qlayoutengine_p.h2
-rw-r--r--src/widgets/kernel/qlayoutitem.cpp36
-rw-r--r--src/widgets/kernel/qlayoutitem.h8
-rw-r--r--src/widgets/kernel/qshortcut.cpp2
-rw-r--r--src/widgets/kernel/qshortcut.h6
-rw-r--r--src/widgets/kernel/qsizepolicy.h6
-rw-r--r--src/widgets/kernel/qstackedlayout.cpp2
-rw-r--r--src/widgets/kernel/qstackedlayout.h6
-rw-r--r--src/widgets/kernel/qstandardgestures.cpp2
-rw-r--r--src/widgets/kernel/qstandardgestures_p.h2
-rw-r--r--src/widgets/kernel/qt_widgets_pch.h2
-rw-r--r--src/widgets/kernel/qtooltip.cpp2
-rw-r--r--src/widgets/kernel/qtooltip.h6
-rw-r--r--src/widgets/kernel/qwhatsthis.cpp2
-rw-r--r--src/widgets/kernel/qwhatsthis.h6
-rw-r--r--src/widgets/kernel/qwidget.cpp43
-rw-r--r--src/widgets/kernel/qwidget.h8
-rw-r--r--src/widgets/kernel/qwidget_p.h2
-rw-r--r--src/widgets/kernel/qwidget_qpa.cpp19
-rw-r--r--src/widgets/kernel/qwidgetaction.cpp2
-rw-r--r--src/widgets/kernel/qwidgetaction.h10
-rw-r--r--src/widgets/kernel/qwidgetaction_p.h4
-rw-r--r--src/widgets/kernel/qwidgetbackingstore.cpp2
-rw-r--r--src/widgets/kernel/qwidgetbackingstore_p.h2
-rw-r--r--src/widgets/kernel/qwidgetsfunctions_wince.h5
-rw-r--r--src/widgets/kernel/qwidgetsvariant.cpp2
-rw-r--r--src/widgets/kernel/qwidgetwindow.cpp63
-rw-r--r--src/widgets/kernel/qwidgetwindow_qpa_p.h13
-rw-r--r--src/widgets/kernel/qwindowcontainer.cpp218
-rw-r--r--src/widgets/kernel/qwindowcontainer_p.h (renamed from src/widgets/styles/qmacstylepixmaps_mac_p.h)57
-rw-r--r--src/widgets/statemachine/qbasickeyeventtransition.cpp2
-rw-r--r--src/widgets/statemachine/qbasickeyeventtransition_p.h2
-rw-r--r--src/widgets/statemachine/qbasicmouseeventtransition.cpp2
-rw-r--r--src/widgets/statemachine/qbasicmouseeventtransition_p.h2
-rw-r--r--src/widgets/statemachine/qguistatemachine.cpp4
-rw-r--r--src/widgets/statemachine/qkeyeventtransition.cpp2
-rw-r--r--src/widgets/statemachine/qkeyeventtransition.h6
-rw-r--r--src/widgets/statemachine/qmouseeventtransition.cpp2
-rw-r--r--src/widgets/statemachine/qmouseeventtransition.h6
-rw-r--r--src/widgets/styles/images/toolbar-ext.pngbin0 -> 516 bytes
-rw-r--r--src/widgets/styles/images/toolbar-ext@2x.pngbin0 -> 505 bytes
-rw-r--r--src/widgets/styles/qandroidstyle.cpp1601
-rw-r--r--src/widgets/styles/qandroidstyle_p.h382
-rw-r--r--src/widgets/styles/qcommonstyle.cpp27
-rw-r--r--src/widgets/styles/qcommonstyle.h8
-rw-r--r--src/widgets/styles/qcommonstyle_p.h2
-rw-r--r--src/widgets/styles/qcommonstylepixmaps_p.h4
-rw-r--r--src/widgets/styles/qdrawutil.cpp6
-rw-r--r--src/widgets/styles/qdrawutil.h6
-rw-r--r--src/widgets/styles/qfusionstyle.cpp13
-rw-r--r--src/widgets/styles/qfusionstyle_p.h6
-rw-r--r--src/widgets/styles/qfusionstyle_p_p.h6
-rw-r--r--src/widgets/styles/qgtk2painter.cpp2
-rw-r--r--src/widgets/styles/qgtk2painter_p.h2
-rw-r--r--src/widgets/styles/qgtkglobal_p.h2
-rw-r--r--src/widgets/styles/qgtkpainter.cpp2
-rw-r--r--src/widgets/styles/qgtkpainter_p.h2
-rw-r--r--src/widgets/styles/qgtkstyle.cpp11
-rw-r--r--src/widgets/styles/qgtkstyle_p.cpp2
-rw-r--r--src/widgets/styles/qgtkstyle_p.h6
-rw-r--r--src/widgets/styles/qgtkstyle_p_p.h2
-rw-r--r--src/widgets/styles/qmacstyle.qdoc38
-rw-r--r--src/widgets/styles/qmacstyle_mac.mm109
-rw-r--r--src/widgets/styles/qmacstyle_mac_p.h6
-rw-r--r--src/widgets/styles/qmacstyle_mac_p_p.h2
-rw-r--r--src/widgets/styles/qproxystyle.cpp31
-rw-r--r--src/widgets/styles/qproxystyle.h9
-rw-r--r--src/widgets/styles/qproxystyle_p.h2
-rw-r--r--src/widgets/styles/qstyle.cpp7
-rw-r--r--src/widgets/styles/qstyle.h7
-rw-r--r--src/widgets/styles/qstyle.qrc2
-rw-r--r--src/widgets/styles/qstyle_p.h2
-rw-r--r--src/widgets/styles/qstyleanimation.cpp8
-rw-r--r--src/widgets/styles/qstyleanimation_p.h2
-rw-r--r--src/widgets/styles/qstylefactory.cpp14
-rw-r--r--src/widgets/styles/qstylefactory.h6
-rw-r--r--src/widgets/styles/qstylehelper.cpp2
-rw-r--r--src/widgets/styles/qstylehelper_p.h2
-rw-r--r--src/widgets/styles/qstyleoption.cpp24
-rw-r--r--src/widgets/styles/qstyleoption.h6
-rw-r--r--src/widgets/styles/qstylepainter.cpp2
-rw-r--r--src/widgets/styles/qstylepainter.h6
-rw-r--r--src/widgets/styles/qstyleplugin.cpp2
-rw-r--r--src/widgets/styles/qstyleplugin.h6
-rw-r--r--src/widgets/styles/qstylesheetstyle.cpp2
-rw-r--r--src/widgets/styles/qstylesheetstyle_default.cpp2
-rw-r--r--src/widgets/styles/qstylesheetstyle_p.h2
-rw-r--r--src/widgets/styles/qwindowscestyle.cpp2
-rw-r--r--src/widgets/styles/qwindowscestyle_p.h6
-rw-r--r--src/widgets/styles/qwindowscestyle_p_p.h2
-rw-r--r--src/widgets/styles/qwindowsmobilestyle.cpp126
-rw-r--r--src/widgets/styles/qwindowsmobilestyle_p.h6
-rw-r--r--src/widgets/styles/qwindowsmobilestyle_p_p.h2
-rw-r--r--src/widgets/styles/qwindowsstyle.cpp3
-rw-r--r--src/widgets/styles/qwindowsstyle_p.h6
-rw-r--r--src/widgets/styles/qwindowsstyle_p_p.h2
-rw-r--r--src/widgets/styles/qwindowsvistastyle.cpp32
-rw-r--r--src/widgets/styles/qwindowsvistastyle_p.h6
-rw-r--r--src/widgets/styles/qwindowsvistastyle_p_p.h2
-rw-r--r--src/widgets/styles/qwindowsxpstyle.cpp2
-rw-r--r--src/widgets/styles/qwindowsxpstyle_p.h6
-rw-r--r--src/widgets/styles/qwindowsxpstyle_p_p.h2
-rw-r--r--src/widgets/styles/styles.pri10
-rw-r--r--src/widgets/util/qcolormap.cpp2
-rw-r--r--src/widgets/util/qcolormap.h6
-rw-r--r--src/widgets/util/qcolormap.qdoc2
-rw-r--r--src/widgets/util/qcompleter.cpp4
-rw-r--r--src/widgets/util/qcompleter.h6
-rw-r--r--src/widgets/util/qcompleter_p.h2
-rw-r--r--src/widgets/util/qflickgesture.cpp2
-rw-r--r--src/widgets/util/qflickgesture_p.h2
-rw-r--r--src/widgets/util/qscroller.cpp4
-rw-r--r--src/widgets/util/qscroller.h6
-rw-r--r--src/widgets/util/qscroller_mac.mm2
-rw-r--r--src/widgets/util/qscroller_p.h2
-rw-r--r--src/widgets/util/qscrollerproperties.cpp4
-rw-r--r--src/widgets/util/qscrollerproperties.h6
-rw-r--r--src/widgets/util/qscrollerproperties_p.h2
-rw-r--r--src/widgets/util/qsystemtrayicon.cpp6
-rw-r--r--src/widgets/util/qsystemtrayicon.h6
-rw-r--r--src/widgets/util/qsystemtrayicon_p.h2
-rw-r--r--src/widgets/util/qsystemtrayicon_qpa.cpp2
-rw-r--r--src/widgets/util/qsystemtrayicon_win.cpp26
-rw-r--r--src/widgets/util/qsystemtrayicon_wince.cpp4
-rw-r--r--src/widgets/util/qsystemtrayicon_x11.cpp2
-rw-r--r--src/widgets/util/qundogroup.cpp2
-rw-r--r--src/widgets/util/qundogroup.h6
-rw-r--r--src/widgets/util/qundostack.cpp8
-rw-r--r--src/widgets/util/qundostack.h6
-rw-r--r--src/widgets/util/qundostack_p.h2
-rw-r--r--src/widgets/util/qundoview.cpp2
-rw-r--r--src/widgets/util/qundoview.h6
-rw-r--r--src/widgets/util/util.pri2
-rw-r--r--src/widgets/widgets/qabstractbutton.cpp4
-rw-r--r--src/widgets/widgets/qabstractbutton.h6
-rw-r--r--src/widgets/widgets/qabstractbutton_p.h2
-rw-r--r--src/widgets/widgets/qabstractscrollarea.cpp4
-rw-r--r--src/widgets/widgets/qabstractscrollarea.h6
-rw-r--r--src/widgets/widgets/qabstractscrollarea_p.h2
-rw-r--r--src/widgets/widgets/qabstractslider.cpp4
-rw-r--r--src/widgets/widgets/qabstractslider.h6
-rw-r--r--src/widgets/widgets/qabstractslider_p.h4
-rw-r--r--src/widgets/widgets/qabstractspinbox.cpp40
-rw-r--r--src/widgets/widgets/qabstractspinbox.h6
-rw-r--r--src/widgets/widgets/qabstractspinbox_p.h2
-rw-r--r--src/widgets/widgets/qbuttongroup.cpp6
-rw-r--r--src/widgets/widgets/qbuttongroup.h6
-rw-r--r--src/widgets/widgets/qcalendartextnavigator_p.h2
-rw-r--r--src/widgets/widgets/qcalendarwidget.cpp4
-rw-r--r--src/widgets/widgets/qcalendarwidget.h6
-rw-r--r--src/widgets/widgets/qcheckbox.cpp2
-rw-r--r--src/widgets/widgets/qcheckbox.h6
-rw-r--r--src/widgets/widgets/qcocoatoolbardelegate_mac.mm2
-rw-r--r--src/widgets/widgets/qcocoatoolbardelegate_mac_p.h2
-rw-r--r--src/widgets/widgets/qcombobox.cpp2
-rw-r--r--src/widgets/widgets/qcombobox.h6
-rw-r--r--src/widgets/widgets/qcombobox_p.h6
-rw-r--r--src/widgets/widgets/qcommandlinkbutton.cpp2
-rw-r--r--src/widgets/widgets/qcommandlinkbutton.h6
-rw-r--r--src/widgets/widgets/qdatetimeedit.cpp18
-rw-r--r--src/widgets/widgets/qdatetimeedit.h6
-rw-r--r--src/widgets/widgets/qdatetimeedit_p.h2
-rw-r--r--src/widgets/widgets/qdial.cpp2
-rw-r--r--src/widgets/widgets/qdial.h6
-rw-r--r--src/widgets/widgets/qdialogbuttonbox.cpp2
-rw-r--r--src/widgets/widgets/qdialogbuttonbox.h6
-rw-r--r--src/widgets/widgets/qdockarealayout.cpp4
-rw-r--r--src/widgets/widgets/qdockarealayout_p.h2
-rw-r--r--src/widgets/widgets/qdockwidget.cpp2
-rw-r--r--src/widgets/widgets/qdockwidget.h6
-rw-r--r--src/widgets/widgets/qdockwidget_p.h2
-rw-r--r--src/widgets/widgets/qeffects.cpp6
-rw-r--r--src/widgets/widgets/qeffects_p.h2
-rw-r--r--src/widgets/widgets/qfocusframe.cpp2
-rw-r--r--src/widgets/widgets/qfocusframe.h6
-rw-r--r--src/widgets/widgets/qfontcombobox.cpp39
-rw-r--r--src/widgets/widgets/qfontcombobox.h6
-rw-r--r--src/widgets/widgets/qframe.cpp2
-rw-r--r--src/widgets/widgets/qframe.h6
-rw-r--r--src/widgets/widgets/qframe_p.h2
-rw-r--r--src/widgets/widgets/qgroupbox.cpp6
-rw-r--r--src/widgets/widgets/qgroupbox.h8
-rw-r--r--src/widgets/widgets/qlabel.cpp16
-rw-r--r--src/widgets/widgets/qlabel.h6
-rw-r--r--src/widgets/widgets/qlabel_p.h2
-rw-r--r--src/widgets/widgets/qlcdnumber.cpp2
-rw-r--r--src/widgets/widgets/qlcdnumber.h6
-rw-r--r--src/widgets/widgets/qlineedit.cpp13
-rw-r--r--src/widgets/widgets/qlineedit.h6
-rw-r--r--src/widgets/widgets/qlineedit_p.cpp4
-rw-r--r--src/widgets/widgets/qlineedit_p.h2
-rw-r--r--src/widgets/widgets/qmaccocoaviewcontainer_mac.h6
-rw-r--r--src/widgets/widgets/qmaccocoaviewcontainer_mac.mm4
-rw-r--r--src/widgets/widgets/qmacnativewidget_mac.h6
-rw-r--r--src/widgets/widgets/qmacnativewidget_mac.mm2
-rw-r--r--src/widgets/widgets/qmainwindow.cpp2
-rw-r--r--src/widgets/widgets/qmainwindow.h6
-rw-r--r--src/widgets/widgets/qmainwindowlayout.cpp2
-rw-r--r--src/widgets/widgets/qmainwindowlayout_mac.mm2
-rw-r--r--src/widgets/widgets/qmainwindowlayout_p.h2
-rw-r--r--src/widgets/widgets/qmdiarea.cpp2
-rw-r--r--src/widgets/widgets/qmdiarea.h6
-rw-r--r--src/widgets/widgets/qmdiarea_p.h2
-rw-r--r--src/widgets/widgets/qmdisubwindow.cpp10
-rw-r--r--src/widgets/widgets/qmdisubwindow.h6
-rw-r--r--src/widgets/widgets/qmdisubwindow_p.h2
-rw-r--r--src/widgets/widgets/qmenu.cpp149
-rw-r--r--src/widgets/widgets/qmenu.h15
-rw-r--r--src/widgets/widgets/qmenu_p.h6
-rw-r--r--src/widgets/widgets/qmenu_wince.cpp26
-rw-r--r--src/widgets/widgets/qmenu_wince.rc32
-rw-r--r--src/widgets/widgets/qmenu_wince_resource_p.h5
-rw-r--r--src/widgets/widgets/qmenubar.cpp2
-rw-r--r--src/widgets/widgets/qmenubar.h6
-rw-r--r--src/widgets/widgets/qmenubar_p.h2
-rw-r--r--src/widgets/widgets/qplaintextedit.cpp2
-rw-r--r--src/widgets/widgets/qplaintextedit.h6
-rw-r--r--src/widgets/widgets/qplaintextedit_p.h2
-rw-r--r--src/widgets/widgets/qprogressbar.cpp48
-rw-r--r--src/widgets/widgets/qprogressbar.h9
-rw-r--r--src/widgets/widgets/qpushbutton.cpp2
-rw-r--r--src/widgets/widgets/qpushbutton.h8
-rw-r--r--src/widgets/widgets/qpushbutton_p.h2
-rw-r--r--src/widgets/widgets/qradiobutton.cpp2
-rw-r--r--src/widgets/widgets/qradiobutton.h6
-rw-r--r--src/widgets/widgets/qrubberband.cpp2
-rw-r--r--src/widgets/widgets/qrubberband.h6
-rw-r--r--src/widgets/widgets/qscrollarea.cpp4
-rw-r--r--src/widgets/widgets/qscrollarea.h6
-rw-r--r--src/widgets/widgets/qscrollarea_p.h4
-rw-r--r--src/widgets/widgets/qscrollbar.cpp2
-rw-r--r--src/widgets/widgets/qscrollbar.h6
-rw-r--r--src/widgets/widgets/qscrollbar_p.h2
-rw-r--r--src/widgets/widgets/qsizegrip.cpp2
-rw-r--r--src/widgets/widgets/qsizegrip.h6
-rw-r--r--src/widgets/widgets/qslider.cpp2
-rw-r--r--src/widgets/widgets/qslider.h6
-rw-r--r--src/widgets/widgets/qspinbox.cpp3
-rw-r--r--src/widgets/widgets/qspinbox.h6
-rw-r--r--src/widgets/widgets/qsplashscreen.cpp4
-rw-r--r--src/widgets/widgets/qsplashscreen.h6
-rw-r--r--src/widgets/widgets/qsplitter.cpp4
-rw-r--r--src/widgets/widgets/qsplitter.h6
-rw-r--r--src/widgets/widgets/qsplitter_p.h2
-rw-r--r--src/widgets/widgets/qstackedwidget.cpp2
-rw-r--r--src/widgets/widgets/qstackedwidget.h6
-rw-r--r--src/widgets/widgets/qstatusbar.cpp8
-rw-r--r--src/widgets/widgets/qstatusbar.h6
-rw-r--r--src/widgets/widgets/qtabbar.cpp4
-rw-r--r--src/widgets/widgets/qtabbar.h6
-rw-r--r--src/widgets/widgets/qtabbar_p.h2
-rw-r--r--src/widgets/widgets/qtabwidget.cpp2
-rw-r--r--src/widgets/widgets/qtabwidget.h6
-rw-r--r--src/widgets/widgets/qtextbrowser.cpp31
-rw-r--r--src/widgets/widgets/qtextbrowser.h6
-rw-r--r--src/widgets/widgets/qtextedit.cpp4
-rw-r--r--src/widgets/widgets/qtextedit.h6
-rw-r--r--src/widgets/widgets/qtextedit_p.h2
-rw-r--r--src/widgets/widgets/qtoolbar.cpp2
-rw-r--r--src/widgets/widgets/qtoolbar.h6
-rw-r--r--src/widgets/widgets/qtoolbar_p.h2
-rw-r--r--src/widgets/widgets/qtoolbararealayout.cpp6
-rw-r--r--src/widgets/widgets/qtoolbararealayout_p.h6
-rw-r--r--src/widgets/widgets/qtoolbarextension.cpp2
-rw-r--r--src/widgets/widgets/qtoolbarextension_p.h2
-rw-r--r--src/widgets/widgets/qtoolbarlayout.cpp4
-rw-r--r--src/widgets/widgets/qtoolbarlayout_p.h2
-rw-r--r--src/widgets/widgets/qtoolbarseparator.cpp2
-rw-r--r--src/widgets/widgets/qtoolbarseparator_p.h2
-rw-r--r--src/widgets/widgets/qtoolbox.cpp2
-rw-r--r--src/widgets/widgets/qtoolbox.h6
-rw-r--r--src/widgets/widgets/qtoolbutton.cpp2
-rw-r--r--src/widgets/widgets/qtoolbutton.h6
-rw-r--r--src/widgets/widgets/qwidgetanimator.cpp2
-rw-r--r--src/widgets/widgets/qwidgetanimator_p.h2
-rw-r--r--src/widgets/widgets/qwidgetlinecontrol.cpp2
-rw-r--r--src/widgets/widgets/qwidgetlinecontrol_p.h6
-rw-r--r--src/widgets/widgets/qwidgetresizehandler.cpp2
-rw-r--r--src/widgets/widgets/qwidgetresizehandler_p.h2
-rw-r--r--src/widgets/widgets/qwidgettextcontrol.cpp5
-rw-r--r--src/widgets/widgets/qwidgettextcontrol_p.h6
-rw-r--r--src/widgets/widgets/qwidgettextcontrol_p_p.h2
-rw-r--r--src/widgets/widgets/widgets.pri2
473 files changed, 4019 insertions, 1785 deletions
diff --git a/src/widgets/accessible/accessible.pri b/src/widgets/accessible/accessible.pri
index 9fb2f18950..84d366e78a 100644
--- a/src/widgets/accessible/accessible.pri
+++ b/src/widgets/accessible/accessible.pri
@@ -1,6 +1,6 @@
# Qt accessibility module
contains(QT_CONFIG, accessibility) {
- HEADERS += accessible/qaccessiblewidget.h
+ HEADERS += accessible/qaccessiblewidget_p.h
SOURCES += accessible/qaccessiblewidget.cpp
}
diff --git a/src/widgets/accessible/qaccessiblewidget.cpp b/src/widgets/accessible/qaccessiblewidget.cpp
index bed0480059..5c8d3e3a57 100644
--- a/src/widgets/accessible/qaccessiblewidget.cpp
+++ b/src/widgets/accessible/qaccessiblewidget.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -39,7 +39,7 @@
**
****************************************************************************/
-#include "qaccessiblewidget.h"
+#include "qaccessiblewidget_p.h"
#ifndef QT_NO_ACCESSIBILITY
@@ -64,7 +64,7 @@ static QList<QWidget*> childWidgets(const QWidget *widget)
QList<QWidget*> widgets;
for (int i = 0; i < list.size(); ++i) {
QWidget *w = qobject_cast<QWidget *>(list.at(i));
- if (w && !w->isWindow()
+ if (w && !w->isWindow()
&& !qobject_cast<QFocusFrame*>(w)
#if !defined(QT_NO_MENU)
&& !qobject_cast<QMenu*>(w)
@@ -383,6 +383,8 @@ int QAccessibleWidget::childCount() const
/*! \reimp */
int QAccessibleWidget::indexOfChild(const QAccessibleInterface *child) const
{
+ if (!child)
+ return -1;
QWidgetList cl = childWidgets(widget());
return cl.indexOf(qobject_cast<QWidget *>(child->object()));
}
diff --git a/src/widgets/accessible/qaccessiblewidget.h b/src/widgets/accessible/qaccessiblewidget_p.h
index 5e43f201cb..803dc71409 100644
--- a/src/widgets/accessible/qaccessiblewidget.h
+++ b/src/widgets/accessible/qaccessiblewidget_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -43,8 +43,7 @@
#define QACCESSIBLEWIDGET_H
#include <QtGui/qaccessibleobject.h>
-
-QT_BEGIN_HEADER
+#include <QtGui/private/qaccessible2_p.h>
QT_BEGIN_NAMESPACE
@@ -99,6 +98,4 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QACCESSIBLEWIDGET_H
diff --git a/src/widgets/dialogs/qcolordialog.cpp b/src/widgets/dialogs/qcolordialog.cpp
index af43ecc8df..d6254076c5 100644
--- a/src/widgets/dialogs/qcolordialog.cpp
+++ b/src/widgets/dialogs/qcolordialog.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -1857,15 +1857,12 @@ void QColorDialog::setVisible(bool visible)
}
#else
- if (!(options() & DontUseNativeDialog))
+ if (!(options() & DontUseNativeDialog) && d->nativeDialogInUse) {
d->setNativeDialogVisible(visible);
-
- if (d->nativeDialogInUse) {
// Set WA_DontShowOnScreen so that QDialog::setVisible(visible) below
// updates the state correctly, but skips showing the non-native version:
setAttribute(Qt::WA_DontShowOnScreen);
} else {
- d->nativeDialogInUse = false;
setAttribute(Qt::WA_DontShowOnScreen, false);
}
#endif
diff --git a/src/widgets/dialogs/qcolordialog.h b/src/widgets/dialogs/qcolordialog.h
index 2149c9c6d2..80a31c4268 100644
--- a/src/widgets/dialogs/qcolordialog.h
+++ b/src/widgets/dialogs/qcolordialog.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -44,8 +44,6 @@
#include <QtWidgets/qdialog.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -133,6 +131,4 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(QColorDialog::ColorDialogOptions)
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QCOLORDIALOG_H
diff --git a/src/widgets/dialogs/qcolordialog_p.h b/src/widgets/dialogs/qcolordialog_p.h
index 6711ba9287..900b38fc61 100644
--- a/src/widgets/dialogs/qcolordialog_p.h
+++ b/src/widgets/dialogs/qcolordialog_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/dialogs/qdialog.cpp b/src/widgets/dialogs/qdialog.cpp
index e397ed4576..a76c88dc5e 100644
--- a/src/widgets/dialogs/qdialog.cpp
+++ b/src/widgets/dialogs/qdialog.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/dialogs/qdialog.h b/src/widgets/dialogs/qdialog.h
index eeb0ac56b5..efbc475118 100644
--- a/src/widgets/dialogs/qdialog.h
+++ b/src/widgets/dialogs/qdialog.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -44,8 +44,6 @@
#include <QtWidgets/qwidget.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -125,6 +123,4 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QDIALOG_H
diff --git a/src/widgets/dialogs/qdialog_p.h b/src/widgets/dialogs/qdialog_p.h
index 3ef210045e..eb0cb2372b 100644
--- a/src/widgets/dialogs/qdialog_p.h
+++ b/src/widgets/dialogs/qdialog_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/dialogs/qerrormessage.cpp b/src/widgets/dialogs/qerrormessage.cpp
index 6cb5888a75..cc79582cb0 100644
--- a/src/widgets/dialogs/qerrormessage.cpp
+++ b/src/widgets/dialogs/qerrormessage.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/dialogs/qerrormessage.h b/src/widgets/dialogs/qerrormessage.h
index 4bba3131c9..6be063b57b 100644
--- a/src/widgets/dialogs/qerrormessage.h
+++ b/src/widgets/dialogs/qerrormessage.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -44,8 +44,6 @@
#include <QtWidgets/qdialog.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -79,6 +77,4 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QERRORMESSAGE_H
diff --git a/src/widgets/dialogs/qfiledialog.cpp b/src/widgets/dialogs/qfiledialog.cpp
index c60f2476c3..c42752311f 100644
--- a/src/widgets/dialogs/qfiledialog.cpp
+++ b/src/widgets/dialogs/qfiledialog.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -941,7 +941,9 @@ Q_AUTOTEST_EXPORT QString qt_tildeExpansion(const QString &path, bool *expanded
} else {
QString userName = tokens.first();
userName.remove(0, 1);
-#if defined(_POSIX_THREAD_SAFE_FUNCTIONS) && !defined(Q_OS_OPENBSD)
+#if defined(Q_OS_VXWORKS)
+ const QString homePath = QDir::homePath();
+#elif defined(_POSIX_THREAD_SAFE_FUNCTIONS) && !defined(Q_OS_OPENBSD)
passwd pw;
passwd *tmpPw;
char buf[200];
diff --git a/src/widgets/dialogs/qfiledialog.h b/src/widgets/dialogs/qfiledialog.h
index 18aaa781fd..98d1fd5695 100644
--- a/src/widgets/dialogs/qfiledialog.h
+++ b/src/widgets/dialogs/qfiledialog.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -46,8 +46,6 @@
#include <QtCore/qstring.h>
#include <QtWidgets/qdialog.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -265,6 +263,4 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(QFileDialog::Options)
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QFILEDIALOG_H
diff --git a/src/widgets/dialogs/qfiledialog.ui b/src/widgets/dialogs/qfiledialog.ui
index fa4fa4cdf5..29f476e378 100644
--- a/src/widgets/dialogs/qfiledialog.ui
+++ b/src/widgets/dialogs/qfiledialog.ui
@@ -5,7 +5,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/dialogs/qfiledialog_embedded.ui b/src/widgets/dialogs/qfiledialog_embedded.ui
index 5988211aea..16128dc0a0 100644
--- a/src/widgets/dialogs/qfiledialog_embedded.ui
+++ b/src/widgets/dialogs/qfiledialog_embedded.ui
@@ -4,7 +4,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/dialogs/qfiledialog_p.h b/src/widgets/dialogs/qfiledialog_p.h
index ffaa2bc6f8..f8f33eb18d 100644
--- a/src/widgets/dialogs/qfiledialog_p.h
+++ b/src/widgets/dialogs/qfiledialog_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -53,6 +53,8 @@
// We mean it.
//
+#include <QtCore/qglobal.h>
+
#ifndef QT_NO_FILEDIALOG
#include "qfiledialog.h"
diff --git a/src/widgets/dialogs/qfileinfogatherer.cpp b/src/widgets/dialogs/qfileinfogatherer.cpp
index 98cde84450..213aefe5f5 100644
--- a/src/widgets/dialogs/qfileinfogatherer.cpp
+++ b/src/widgets/dialogs/qfileinfogatherer.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/dialogs/qfileinfogatherer_p.h b/src/widgets/dialogs/qfileinfogatherer_p.h
index f9566eb0af..0c4e644e40 100644
--- a/src/widgets/dialogs/qfileinfogatherer_p.h
+++ b/src/widgets/dialogs/qfileinfogatherer_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/dialogs/qfilesystemmodel.cpp b/src/widgets/dialogs/qfilesystemmodel.cpp
index 9a81e0f02f..d91ac424e2 100644
--- a/src/widgets/dialogs/qfilesystemmodel.cpp
+++ b/src/widgets/dialogs/qfilesystemmodel.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -964,6 +964,8 @@ Qt::ItemFlags QFileSystemModel::flags(const QModelIndex &index) const
flags |= Qt::ItemIsEditable;
if (indexNode->isDir())
flags |= Qt::ItemIsDropEnabled;
+ else
+ flags |= Qt::ItemNeverHasChildren;
}
return flags;
}
diff --git a/src/widgets/dialogs/qfilesystemmodel.h b/src/widgets/dialogs/qfilesystemmodel.h
index 18df89d736..0b52b6565b 100644
--- a/src/widgets/dialogs/qfilesystemmodel.h
+++ b/src/widgets/dialogs/qfilesystemmodel.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -48,8 +48,6 @@
#include <QtGui/qicon.h>
#include <QtCore/qdiriterator.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -173,7 +171,5 @@ inline QFileInfo QFileSystemModel::fileInfo(const QModelIndex &aindex) const
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QFILESYSTEMMODEL_H
diff --git a/src/widgets/dialogs/qfilesystemmodel_p.h b/src/widgets/dialogs/qfilesystemmodel_p.h
index 4f5eeb9ff7..d61936d545 100644
--- a/src/widgets/dialogs/qfilesystemmodel_p.h
+++ b/src/widgets/dialogs/qfilesystemmodel_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/dialogs/qfontdialog.cpp b/src/widgets/dialogs/qfontdialog.cpp
index 4036dc80ab..313b475f1f 100644
--- a/src/widgets/dialogs/qfontdialog.cpp
+++ b/src/widgets/dialogs/qfontdialog.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/dialogs/qfontdialog.h b/src/widgets/dialogs/qfontdialog.h
index 51d68d1b88..c2d930bc1e 100644
--- a/src/widgets/dialogs/qfontdialog.h
+++ b/src/widgets/dialogs/qfontdialog.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -46,8 +46,6 @@
#include <QtWidgets/qdialog.h>
#include <QtGui/qfont.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -126,6 +124,4 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(QFontDialog::FontDialogOptions)
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QFONTDIALOG_H
diff --git a/src/widgets/dialogs/qfontdialog_p.h b/src/widgets/dialogs/qfontdialog_p.h
index 90b6a6eff8..18429e8ede 100644
--- a/src/widgets/dialogs/qfontdialog_p.h
+++ b/src/widgets/dialogs/qfontdialog_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/dialogs/qfscompleter_p.h b/src/widgets/dialogs/qfscompleter_p.h
index 9099ea1a5e..e995114ee9 100644
--- a/src/widgets/dialogs/qfscompleter_p.h
+++ b/src/widgets/dialogs/qfscompleter_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/dialogs/qinputdialog.cpp b/src/widgets/dialogs/qinputdialog.cpp
index 99ecf02bdb..a0aefdef9d 100644
--- a/src/widgets/dialogs/qinputdialog.cpp
+++ b/src/widgets/dialogs/qinputdialog.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/dialogs/qinputdialog.h b/src/widgets/dialogs/qinputdialog.h
index 096a81d4bc..41dca1f94f 100644
--- a/src/widgets/dialogs/qinputdialog.h
+++ b/src/widgets/dialogs/qinputdialog.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -46,8 +46,6 @@
#include <QtCore/qstring.h>
#include <QtWidgets/qlineedit.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -215,6 +213,4 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(QInputDialog::InputDialogOptions)
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QINPUTDIALOG_H
diff --git a/src/widgets/dialogs/qmessagebox.cpp b/src/widgets/dialogs/qmessagebox.cpp
index 57ed4da8a6..a485a55609 100644
--- a/src/widgets/dialogs/qmessagebox.cpp
+++ b/src/widgets/dialogs/qmessagebox.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -1225,6 +1225,30 @@ void QMessageBox::setTextFormat(Qt::TextFormat format)
}
/*!
+ \property QMessageBox::textInteractionFlags
+ \since 5.1
+
+ Specifies how the label of the message box should interact with user
+ input.
+
+ The default value depends on the style.
+
+ \sa QStyle::SH_MessageBox_TextInteractionFlags
+*/
+
+Qt::TextInteractionFlags QMessageBox::textInteractionFlags() const
+{
+ Q_D(const QMessageBox);
+ return d->label->textInteractionFlags();
+}
+
+void QMessageBox::setTextInteractionFlags(Qt::TextInteractionFlags flags)
+{
+ Q_D(QMessageBox);
+ d->label->setTextInteractionFlags(flags);
+}
+
+/*!
\reimp
*/
bool QMessageBox::event(QEvent *e)
diff --git a/src/widgets/dialogs/qmessagebox.h b/src/widgets/dialogs/qmessagebox.h
index e0eb47ea2a..32b7027d89 100644
--- a/src/widgets/dialogs/qmessagebox.h
+++ b/src/widgets/dialogs/qmessagebox.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -44,8 +44,6 @@
#include <QtWidgets/qdialog.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -69,6 +67,7 @@ class Q_WIDGETS_EXPORT QMessageBox : public QDialog
Q_PROPERTY(QString detailedText READ detailedText WRITE setDetailedText)
#endif
Q_PROPERTY(QString informativeText READ informativeText WRITE setInformativeText)
+ Q_PROPERTY(Qt::TextInteractionFlags textInteractionFlags READ textInteractionFlags WRITE setTextInteractionFlags)
public:
enum Icon {
@@ -186,6 +185,9 @@ public:
Qt::TextFormat textFormat() const;
void setTextFormat(Qt::TextFormat format);
+ void setTextInteractionFlags(Qt::TextInteractionFlags flags);
+ Qt::TextInteractionFlags textInteractionFlags() const;
+
static StandardButton information(QWidget *parent, const QString &title,
const QString &text, StandardButtons buttons = Ok,
StandardButton defaultButton = NoButton);
@@ -329,6 +331,4 @@ str)).arg(QString::fromLatin1(qVersion())); QMessageBox::critical(0, QApplicatio
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QMESSAGEBOX_H
diff --git a/src/widgets/dialogs/qprogressdialog.cpp b/src/widgets/dialogs/qprogressdialog.cpp
index de86e2ed7c..78612f3181 100644
--- a/src/widgets/dialogs/qprogressdialog.cpp
+++ b/src/widgets/dialogs/qprogressdialog.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -297,7 +297,7 @@ QProgressDialog::QProgressDialog(QWidget *parent, Qt::WindowFlags f)
The \a labelText is the text used to remind the user what is progressing.
- The \a cancelButtonText is the text to display on the cancel button. If
+ The \a cancelButtonText is the text to display on the cancel button. If
QString() is passed then no cancel button is shown.
The \a minimum and \a maximum is the number of steps in the operation for
@@ -438,7 +438,7 @@ void QProgressDialog::setCancelButton(QPushButton *cancelButton)
/*!
Sets the cancel button's text to \a cancelButtonText. If the text
- is set to QString() then it will cause the cancel button to be
+ is set to QString() then it will cause the cancel button to be
hidden and deleted.
\sa setCancelButton()
diff --git a/src/widgets/dialogs/qprogressdialog.h b/src/widgets/dialogs/qprogressdialog.h
index 1f17727900..20b658eb58 100644
--- a/src/widgets/dialogs/qprogressdialog.h
+++ b/src/widgets/dialogs/qprogressdialog.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -44,8 +44,6 @@
#include <QtWidgets/qdialog.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -139,6 +137,4 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QPROGRESSDIALOG_H
diff --git a/src/widgets/dialogs/qsidebar.cpp b/src/widgets/dialogs/qsidebar.cpp
index 37bcc62425..3d22992e3a 100644
--- a/src/widgets/dialogs/qsidebar.cpp
+++ b/src/widgets/dialogs/qsidebar.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/dialogs/qsidebar_p.h b/src/widgets/dialogs/qsidebar_p.h
index 72d632280c..319006f167 100644
--- a/src/widgets/dialogs/qsidebar_p.h
+++ b/src/widgets/dialogs/qsidebar_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/dialogs/qwizard.cpp b/src/widgets/dialogs/qwizard.cpp
index 8bc2eb92c1..f58a10b166 100644
--- a/src/widgets/dialogs/qwizard.cpp
+++ b/src/widgets/dialogs/qwizard.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -54,6 +54,7 @@
#include "qlabel.h"
#include "qlineedit.h"
#include "qpainter.h"
+#include "qwindow.h"
#include "qpushbutton.h"
#include "qset.h"
#include "qstyle.h"
@@ -592,7 +593,7 @@ public:
#if !defined(QT_NO_STYLE_WINDOWSVISTA)
bool vistaDisabled() const;
bool isVistaThemeEnabled(QVistaHelper::VistaState state) const;
- void handleAeroStyleChange();
+ bool handleAeroStyleChange();
#endif
bool isVistaThemeEnabled() const;
void disableUpdates();
@@ -1514,33 +1515,48 @@ bool QWizardPrivate::isVistaThemeEnabled(QVistaHelper::VistaState state) const
&& !vistaDisabled();
}
-void QWizardPrivate::handleAeroStyleChange()
+bool QWizardPrivate::handleAeroStyleChange()
{
Q_Q(QWizard);
if (inHandleAeroStyleChange)
- return; // prevent recursion
+ return false; // prevent recursion
+ // For top-level wizards, we need the platform window handle for the
+ // DWM changes. Delay aero initialization to the show event handling if
+ // it does not exist. If we are a child, skip DWM and just make room by
+ // moving the antiFlickerWidget.
+ const bool isWindow = q->isWindow();
+ if (isWindow && (!q->windowHandle() || !q->windowHandle()->handle()))
+ return false;
inHandleAeroStyleChange = true;
vistaHelper->disconnectBackButton();
q->removeEventFilter(vistaHelper);
+ bool vistaMargins = false;
+
if (isVistaThemeEnabled()) {
if (isVistaThemeEnabled(QVistaHelper::VistaAero)) {
- vistaHelper->setDWMTitleBar(QVistaHelper::ExtendedTitleBar);
- q->installEventFilter(vistaHelper);
+ if (isWindow) {
+ vistaHelper->setDWMTitleBar(QVistaHelper::ExtendedTitleBar);
+ q->installEventFilter(vistaHelper);
+ }
q->setMouseTracking(true);
antiFlickerWidget->move(0, vistaHelper->titleBarSize() + vistaHelper->topOffset());
vistaHelper->backButton()->move(
0, vistaHelper->topOffset() // ### should ideally work without the '+ 1'
- qMin(vistaHelper->topOffset(), vistaHelper->topPadding() + 1));
+ vistaMargins = true;
+ vistaHelper->backButton()->show();
} else {
- vistaHelper->setDWMTitleBar(QVistaHelper::NormalTitleBar);
+ if (isWindow)
+ vistaHelper->setDWMTitleBar(QVistaHelper::NormalTitleBar);
q->setMouseTracking(true);
antiFlickerWidget->move(0, vistaHelper->topOffset());
vistaHelper->backButton()->move(0, -1); // ### should ideally work with (0, 0)
}
- vistaHelper->setTitleBarIconAndCaptionVisible(false);
+ if (isWindow)
+ vistaHelper->setTitleBarIconAndCaptionVisible(false);
QObject::connect(
vistaHelper->backButton(), SIGNAL(clicked()), q, buttonSlots[QWizard::BackButton]);
vistaHelper->backButton()->show();
@@ -1551,15 +1567,16 @@ void QWizardPrivate::handleAeroStyleChange()
#endif
antiFlickerWidget->move(0, 0);
vistaHelper->hideBackButton();
- vistaHelper->setTitleBarIconAndCaptionVisible(true);
+ if (isWindow)
+ vistaHelper->setTitleBarIconAndCaptionVisible(true);
}
_q_updateButtonStates();
- if (q->isVisible())
- vistaHelper->setWindowPosHack();
+ vistaHelper->updateCustomMargins(vistaMargins);
inHandleAeroStyleChange = false;
+ return true;
}
#endif
@@ -2507,8 +2524,9 @@ void QWizard::setWizardStyle(WizardStyle style)
updateGeometry();
d->enableUpdates();
#if !defined(QT_NO_STYLE_WINDOWSVISTA)
- if (aeroStyleChange)
- d->handleAeroStyleChange();
+ // Delay initialization when activating Aero style fails due to missing native window.
+ if (aeroStyleChange && !d->handleAeroStyleChange() && d->wizStyle == AeroStyle)
+ d->vistaInitPending = true;
#endif
}
}
diff --git a/src/widgets/dialogs/qwizard.h b/src/widgets/dialogs/qwizard.h
index 7a95492f94..9dea9a8e6f 100644
--- a/src/widgets/dialogs/qwizard.h
+++ b/src/widgets/dialogs/qwizard.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -44,8 +44,6 @@
#include <QtWidgets/qdialog.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -261,8 +259,6 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QT_NO_WIZARD
#endif // QWIZARD_H
diff --git a/src/widgets/dialogs/qwizard_win.cpp b/src/widgets/dialogs/qwizard_win.cpp
index 2bcb7a2167..001c21da61 100644
--- a/src/widgets/dialogs/qwizard_win.cpp
+++ b/src/widgets/dialogs/qwizard_win.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -49,7 +49,10 @@
#include "qwizard.h"
#include "qpaintengine.h"
#include "qapplication.h"
+#include <QtCore/QVariant>
+#include <QtCore/QDebug>
#include <QtGui/QMouseEvent>
+#include <QtGui/QWindow>
#include <QtWidgets/QDesktopWidget>
// Note, these tests are duplicates in qwindowsxpstyle_p.h.
@@ -66,10 +69,12 @@
#include <uxtheme.h>
+Q_DECLARE_METATYPE(QMargins)
+
QT_BEGIN_NAMESPACE
//DWM related
-typedef struct { //MARGINS
+typedef struct { //MARGINS
int cxLeftWidth; // width of left border that retains its size
int cxRightWidth; // width of right border that retains its size
int cyTopHeight; // height of top border that retains its size
@@ -216,9 +221,11 @@ void QVistaBackButton::paintEvent(QPaintEvent *)
QRect r = rect();
HANDLE theme = pOpenThemeData(0, L"Navigation");
//RECT rect;
+ QPoint origin;
+ const HDC hdc = QVistaHelper::backingStoreDC(parentWidget(), &origin);
RECT clipRect;
- int xoffset = QWidget::mapToParent(r.topLeft()).x() - 1;
- int yoffset = QWidget::mapToParent(r.topLeft()).y() - 1;
+ int xoffset = origin.x() + QWidget::mapToParent(r.topLeft()).x() - 1;
+ int yoffset = origin.y() + QWidget::mapToParent(r.topLeft()).y() - 1;
clipRect.top = r.top() + yoffset;
clipRect.bottom = r.bottom() + yoffset;
@@ -233,8 +240,6 @@ void QVistaBackButton::paintEvent(QPaintEvent *)
else if (underMouse())
state = WIZ_NAV_BB_HOT;
- QPlatformNativeInterface *nativeInterface = QGuiApplication::platformNativeInterface();
- HDC hdc = static_cast<HDC>(nativeInterface->nativeResourceForBackingStore("getDC", backingStore()));
pDrawThemeBackground(theme, hdc, WIZ_NAV_BACKBUTTON, state, &clipRect, &clipRect);
}
@@ -251,8 +256,10 @@ QVistaHelper::QVistaHelper(QWizard *wizard)
is_vista = resolveSymbols();
if (instanceCount++ == 0)
cachedVistaState = Dirty;
- if (is_vista)
+ if (is_vista) {
backButton_ = new QVistaBackButton(wizard);
+ backButton_->hide();
+ }
// Handle diff between Windows 7 and Vista
iconSpacing = QStyleHelper::dpiScaled(7);
@@ -265,6 +272,26 @@ QVistaHelper::~QVistaHelper()
--instanceCount;
}
+void QVistaHelper::updateCustomMargins(bool vistaMargins)
+{
+ if (QSysInfo::WindowsVersion >= QSysInfo::WV_WINDOWS8)
+ return; // Negative margins are not supported on Windows 8.
+ if (QWindow *window = wizard->windowHandle()) {
+ // Reduce top frame to zero since we paint it ourselves.
+ const QMargins customMargins = vistaMargins ?
+ QMargins(0, -titleBarSize(), 0, 0) : QMargins();
+ const QVariant customMarginsV = qVariantFromValue(customMargins);
+ // The dynamic property takes effect when creating the platform window.
+ window->setProperty("_q_windowsCustomMargins", customMarginsV);
+ // If a platform window exists, change via native interface.
+ if (QPlatformWindow *platformWindow = window->handle()) {
+ QGuiApplication::platformNativeInterface()->
+ setWindowProperty(platformWindow, QStringLiteral("WindowsCustomMargins"),
+ customMarginsV);
+ }
+ }
+}
+
bool QVistaHelper::isCompositionEnabled()
{
bool value = is_vista;
@@ -291,6 +318,12 @@ QVistaHelper::VistaState QVistaHelper::vistaState()
return cachedVistaState;
}
+void QVistaHelper::disconnectBackButton()
+{
+ if (backButton_) // Leave QStyleSheetStyle's connections on destroyed() intact.
+ backButton_->disconnect(SIGNAL(clicked()));
+}
+
QColor QVistaHelper::basicWindowFrameColor()
{
DWORD rgb;
@@ -315,9 +348,9 @@ bool QVistaHelper::setDWMTitleBar(TitleBarChangeType type)
mar.cyTopHeight = 0;
else
mar.cyTopHeight = titleBarSize() + topOffset();
- HWND wizardHandle = QApplicationPrivate::getHWNDForWidget(wizard);
- HRESULT hr = pDwmExtendFrameIntoClientArea(wizardHandle, &mar);
- value = SUCCEEDED(hr);
+ if (const HWND wizardHandle = wizardHWND())
+ if (SUCCEEDED(pDwmExtendFrameIntoClientArea(wizardHandle, &mar)))
+ value = true;
}
return value;
}
@@ -327,11 +360,11 @@ Q_GUI_EXPORT HICON qt_pixmapToWinHICON(const QPixmap &);
void QVistaHelper::drawTitleBar(QPainter *painter)
{
Q_ASSERT(backButton_);
- QPlatformNativeInterface *nativeInterface = QGuiApplication::platformNativeInterface();
- QBackingStore *backingStore = backButton_->backingStore();
- HDC hdc = static_cast<HDC>(nativeInterface->nativeResourceForBackingStore("getDC", backingStore));
+ QPoint origin;
+ const bool isWindow = wizard->isWindow();
+ const HDC hdc = QVistaHelper::backingStoreDC(wizard, &origin);
- if (vistaState() == VistaAero)
+ if (vistaState() == VistaAero && isWindow)
drawBlackRect(QRect(0, 0, wizard->width(),
titleBarSize() + topOffset()), hdc);
const int btnTop = backButton_->mapToParent(QPoint()).y();
@@ -352,14 +385,20 @@ void QVistaHelper::drawTitleBar(QPainter *painter)
glowOffset = glowSize();
}
- drawTitleText(
- painter, text,
- QRect(titleOffset() - glowOffset, verticalCenter - textHeight / 2, textWidth, textHeight),
- hdc);
+ const QRect textRectangle(titleOffset() - glowOffset, verticalCenter - textHeight / 2, textWidth, textHeight);
+ if (isWindow) {
+ drawTitleText(painter, text, textRectangle, hdc);
+ } else {
+ painter->save();
+ painter->setFont(font);
+ painter->drawText(textRectangle, Qt::AlignVCenter | Qt::AlignHCenter, text);
+ painter->restore();
+ }
const QIcon windowIcon = wizard->windowIcon();
if (!windowIcon.isNull()) {
- QRect rect(leftMargin(), verticalCenter - iconSize() / 2, iconSize(), iconSize());
+ const QRect rect(origin.x() + leftMargin(),
+ origin.y() + verticalCenter - iconSize() / 2, iconSize(), iconSize());
const HICON hIcon = qt_pixmapToWinHICON(windowIcon.pixmap(iconSize()));
DrawIconEx(hdc, rect.left(), rect.top(), hIcon, 0, 0, 0, NULL, DI_NORMAL | DI_COMPAT);
DestroyIcon(hIcon);
@@ -375,8 +414,8 @@ void QVistaHelper::setTitleBarIconAndCaptionVisible(bool visible)
opt.dwMask = 0;
else
opt.dwMask = WIZ_WTNCA_NODRAWICON | WIZ_WTNCA_NODRAWCAPTION;
- HWND handle = QApplicationPrivate::getHWNDForWidget(wizard);
- pSetWindowThemeAttribute(handle, WIZ_WTA_NONCLIENT, &opt, sizeof(WIZ_WTA_OPTIONS));
+ if (const HWND handle = wizardHWND())
+ pSetWindowThemeAttribute(handle, WIZ_WTA_NONCLIENT, &opt, sizeof(WIZ_WTA_OPTIONS));
}
}
@@ -402,13 +441,6 @@ bool QVistaHelper::winEvent(MSG* msg, long* result)
}
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:
LRESULT lResult;
// Pass to DWM to handle
@@ -449,38 +481,6 @@ void QVistaHelper::mouseEvent(QEvent *event)
}
}
-// The following hack ensures that the titlebar is updated correctly
-// when the wizard style changes to and from AeroStyle. Specifically,
-// this function causes a Windows message of type WM_NCCALCSIZE to
-// be triggered.
-void QVistaHelper::setWindowPosHack()
-{
- const int x = wizard->geometry().x(); // ignored by SWP_NOMOVE
- const int y = wizard->geometry().y(); // ignored by SWP_NOMOVE
- const int w = wizard->width();
- const int h = wizard->height();
- HWND handle = QApplicationPrivate::getHWNDForWidget(wizard);
- SetWindowPos(handle, 0, x, y, w, h, SWP_NOMOVE | SWP_NOZORDER | SWP_FRAMECHANGED);
-}
-
-// The following hack allows any QWidget subclass to access
-// QWidgetPrivate::topData() without being declared as a
-// friend by QWidget.
-class QHackWidget : public QWidget
-{
-public:
- Q_DECLARE_PRIVATE(QWidget)
- QTLWExtra* topData() { return d_func()->topData(); }
-};
-
-void QVistaHelper::collapseTopFrameStrut()
-{
- QTLWExtra *top = ((QHackWidget *)wizard)->d_func()->topData();
- int x1, y1, x2, y2;
- top->frameStrut.getCoords(&x1, &y1, &x2, &y2);
- top->frameStrut.setCoords(x1, 0, x2, y2);
-}
-
bool QVistaHelper::handleWinEvent(MSG *message, long *result)
{
if (message->message == WIZ_WM_THEMECHANGED || message->message == WIZ_WM_DWMCOMPOSITIONCHANGED)
@@ -489,12 +489,8 @@ bool QVistaHelper::handleWinEvent(MSG *message, long *result)
bool status = false;
if (wizard->wizardStyle() == QWizard::AeroStyle && vistaState() == VistaAero) {
status = winEvent(message, result);
- if (message->message == WM_NCCALCSIZE) {
-// if (status) #fixme
-// collapseTopFrameStrut();
- } else if (message->message == WM_NCPAINT) {
+ if (message->message == WM_NCPAINT)
wizard->update();
- }
}
return status;
}
@@ -598,8 +594,7 @@ bool QVistaHelper::eventFilter(QObject *obj, QEvent *event)
msg.message = WM_NCHITTEST;
msg.wParam = 0;
msg.lParam = MAKELPARAM(mouseEvent->globalX(), mouseEvent->globalY());
- HWND handle = QApplicationPrivate::getHWNDForWidget(wizard);
- msg.hwnd = handle;
+ msg.hwnd = wizardHWND();
winEvent(&msg, &result);
msg.wParam = result;
msg.message = WM_NCMOUSEMOVE;
@@ -613,8 +608,7 @@ bool QVistaHelper::eventFilter(QObject *obj, QEvent *event)
msg.message = WM_NCHITTEST;
msg.wParam = 0;
msg.lParam = MAKELPARAM(mouseEvent->globalX(), mouseEvent->globalY());
- HWND handle = QApplicationPrivate::getHWNDForWidget(wizard);
- msg.hwnd = handle;
+ msg.hwnd = wizardHWND();
winEvent(&msg, &result);
msg.wParam = result;
msg.message = WM_NCLBUTTONDOWN;
@@ -629,8 +623,7 @@ bool QVistaHelper::eventFilter(QObject *obj, QEvent *event)
msg.message = WM_NCHITTEST;
msg.wParam = 0;
msg.lParam = MAKELPARAM(mouseEvent->globalX(), mouseEvent->globalY());
- HWND handle = QApplicationPrivate::getHWNDForWidget(wizard);
- msg.hwnd = handle;
+ msg.hwnd = wizardHWND();
winEvent(&msg, &result);
msg.wParam = result;
msg.message = WM_NCLBUTTONUP;
@@ -657,6 +650,31 @@ HFONT QVistaHelper::getCaptionFont(HANDLE hTheme)
return CreateFontIndirect(&lf);
}
+// Return a HDC for the wizard along with the transformation if the
+// wizard is a child window.
+HDC QVistaHelper::backingStoreDC(const QWidget *wizard, QPoint *offset)
+{
+ HDC hdc = static_cast<HDC>(QGuiApplication::platformNativeInterface()->nativeResourceForBackingStore(QByteArrayLiteral("getDC"), wizard->backingStore()));
+ *offset = QPoint(0, 0);
+ if (!wizard->windowHandle())
+ if (QWidget *nativeParent = wizard->nativeParentWidget())
+ *offset = wizard->mapTo(nativeParent, *offset);
+ return hdc;
+}
+
+HWND QVistaHelper::wizardHWND() const
+{
+ // Obtain the HWND if the wizard is a top-level window.
+ // Do not use winId() as this enforces native children of the parent
+ // widget when called before show() as happens when calling setWizardStyle().
+ if (QWindow *window = wizard->windowHandle())
+ if (window->handle())
+ if (void *vHwnd = QGuiApplication::platformNativeInterface()->nativeResourceForWindow(QByteArrayLiteral("handle"), window))
+ return static_cast<HWND>(vHwnd);
+ qWarning().nospace() << "Failed to obtain HWND for wizard.";
+ return 0;
+}
+
bool QVistaHelper::drawTitleText(QPainter *painter, const QString &text, const QRect &rect, HDC hdc)
{
bool value = false;
@@ -677,14 +695,14 @@ bool QVistaHelper::drawTitleText(QPainter *painter, const QString &text, const Q
dib.bmiHeader.biPlanes = 1;
dib.bmiHeader.biBitCount = 32;
dib.bmiHeader.biCompression = BI_RGB;
-
+
bmp = CreateDIBSection(hdc, &dib, DIB_RGB_COLORS, NULL, NULL, 0);
// Set up the DC
HFONT hCaptionFont = getCaptionFont(hTheme);
HBITMAP hOldBmp = (HBITMAP)SelectObject(dcMem, (HGDIOBJ) bmp);
HFONT hOldFont = (HFONT)SelectObject(dcMem, (HGDIOBJ) hCaptionFont);
-
+
// Draw the text!
WIZ_DTTOPTS dto;
dto.dwSize = sizeof(WIZ_DTTOPTS);
@@ -693,7 +711,7 @@ bool QVistaHelper::drawTitleText(QPainter *painter, const QString &text, const Q
dto.dwFlags = WIZ_DTT_COMPOSITED|WIZ_DTT_GLOWSIZE;
dto.iGlowSize = glowSize();
-
+
pDrawThemeTextEx(hTheme, dcMem, 0, 0, (LPCWSTR)text.utf16(), -1, uFormat, &rctext, &dto );
BitBlt(hdc, rect.left(), rect.top(), rect.width(), rect.height(), dcMem, 0, 0, SRCCOPY);
SelectObject(dcMem, (HGDIOBJ) hOldBmp);
@@ -725,7 +743,7 @@ bool QVistaHelper::drawBlackRect(const QRect &rect, HDC hdc)
dib.bmiHeader.biPlanes = 1;
dib.bmiHeader.biBitCount = 32;
dib.bmiHeader.biCompression = BI_RGB;
-
+
bmp = CreateDIBSection(hdc, &dib, DIB_RGB_COLORS, NULL, NULL, 0);
HBITMAP hOldBmp = (HBITMAP)SelectObject(dcMem, (HGDIOBJ) bmp);
@@ -789,6 +807,19 @@ int QVistaHelper::titleOffset()
return leftMargin() + iconOffset;
}
+int QVistaHelper::topOffset()
+{
+ if (vistaState() != VistaAero)
+ return titleBarSize() + 3;
+ static const int aeroOffset =
+ QSysInfo::WindowsVersion == QSysInfo::WV_WINDOWS7 ?
+ QStyleHelper::dpiScaled(4) : QStyleHelper::dpiScaled(13);
+ int result = aeroOffset;
+ if (QSysInfo::WindowsVersion < QSysInfo::WV_WINDOWS8)
+ result += titleBarSize();
+ return result;
+}
+
QT_END_NAMESPACE
#endif // QT_NO_STYLE_WINDOWSVISTA
diff --git a/src/widgets/dialogs/qwizard_win_p.h b/src/widgets/dialogs/qwizard_win_p.h
index cd0b2da38e..a7713d889b 100644
--- a/src/widgets/dialogs/qwizard_win_p.h
+++ b/src/widgets/dialogs/qwizard_win_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -53,6 +53,8 @@
// We mean it.
//
+#include <QtCore/qglobal.h>
+
#ifndef QT_NO_WIZARD
#ifndef QT_NO_STYLE_WINDOWSVISTA
@@ -87,6 +89,7 @@ public:
QVistaHelper(QWizard *wizard);
~QVistaHelper();
enum TitleBarChangeType { NormalTitleBar, ExtendedTitleBar };
+ void updateCustomMargins(bool vistaMargins);
bool setDWMTitleBar(TitleBarChangeType type);
void setTitleBarIconAndCaptionVisible(bool visible);
void mouseEvent(QEvent *event);
@@ -94,9 +97,8 @@ public:
void resizeEvent(QResizeEvent *event);
void paintEvent(QPaintEvent *event);
QVistaBackButton *backButton() const { return backButton_; }
- void disconnectBackButton() { if (backButton_) backButton_->disconnect(); }
+ void disconnectBackButton();
void hideBackButton() { if (backButton_) backButton_->hide(); }
- void setWindowPosHack();
QColor basicWindowFrameColor();
enum VistaState { VistaAero, VistaBasic, Classic, Dirty };
static VistaState vistaState();
@@ -105,12 +107,13 @@ public:
return int(QStyleHelper::dpiScaled(
QSysInfo::WindowsVersion >= QSysInfo::WV_WINDOWS7 ? 4 : 6));
}
- static int topOffset() {
- static int aeroOffset = QSysInfo::WindowsVersion >= QSysInfo::WV_WINDOWS7 ?
- QStyleHelper::dpiScaled(4) : QStyleHelper::dpiScaled(13);
- return (titleBarSize() + (vistaState() == VistaAero ? aeroOffset : 3)); }
+ static int topOffset();
+
+ static HDC backingStoreDC(const QWidget *wizard, QPoint *offset);
+
private:
static HFONT getCaptionFont(HANDLE hTheme);
+ HWND wizardHWND() const;
bool drawTitleText(QPainter *painter, const QString &text, const QRect &rect, HDC hdc);
static bool drawBlackRect(const QRect &rect, HDC hdc);
diff --git a/src/widgets/doc/snippets/code/src_gui_itemviews_qdatawidgetmapper.cpp b/src/widgets/doc/snippets/code/src_gui_itemviews_qdatawidgetmapper.cpp
index b5d9708f99..0b6ae83ffb 100644
--- a/src/widgets/doc/snippets/code/src_gui_itemviews_qdatawidgetmapper.cpp
+++ b/src/widgets/doc/snippets/code/src_gui_itemviews_qdatawidgetmapper.cpp
@@ -57,7 +57,7 @@ mapper->addMapping(ageSpinBox, 1);
//! [2]
-QDataWidgetMapper *mapper = new QDataWidgetMapper();
+QDataWidgetMapper *mapper = new QDataWidgetMapper();
connect(myTableView->selectionModel(), SIGNAL(currentRowChanged(QModelIndex,QModelIndex)),
mapper, SLOT(setCurrentModelIndex(QModelIndex)));
//! [2]
diff --git a/src/widgets/doc/snippets/customviewstyle.cpp b/src/widgets/doc/snippets/customviewstyle.cpp
index 6bb022574d..cdb4ed1d77 100644
--- a/src/widgets/doc/snippets/customviewstyle.cpp
+++ b/src/widgets/doc/snippets/customviewstyle.cpp
@@ -61,7 +61,7 @@ void CustomViewStyle::drawPrimitive(PrimitiveElement element, const QStyleOption
painter->restore();
break;
- }
+ }
default:
QProxyStyle::drawPrimitive(element, option, painter, widget);
}
diff --git a/src/widgets/doc/snippets/javastyle.cpp b/src/widgets/doc/snippets/javastyle.cpp
index 15cc53ce2d..37f02c7f13 100644
--- a/src/widgets/doc/snippets/javastyle.cpp
+++ b/src/widgets/doc/snippets/javastyle.cpp
@@ -103,7 +103,7 @@ QPalette JavaStyle::standardPalette() const
palette.setBrush(QPalette::Inactive, QPalette::Highlight, QColor(184, 207, 229));
palette.setBrush(QPalette::Inactive, QPalette::HighlightedText, Qt::black);
-
+
palette.setBrush(QPalette::Disabled, QPalette::Button,
QColor(238, 238, 238));
palette.setBrush(QPalette::Disabled, QPalette::WindowText,
@@ -968,7 +968,7 @@ void JavaStyle::drawControl(ControlElement control, const QStyleOption *option,
painter->setBrush(QColor(200, 221, 242));
painter->drawPath(outerPath);
painter->setPen(QColor(200, 221, 242));
- painter->drawRect(QRect(bottomLeft + adjustTabPoint(
+ painter->drawRect(QRect(bottomLeft + adjustTabPoint(
QPoint(2, -3), tab->shape),
bottomRight + adjustTabPoint(
QPoint(-2, 0), tab->shape)));
@@ -976,7 +976,7 @@ void JavaStyle::drawControl(ControlElement control, const QStyleOption *option,
painter->setBrush(Qt::NoBrush);
painter->drawPath(whitePath);
- if (option->state & State_HasFocus) {
+ if (option->state & State_HasFocus) {
painter->setPen(option->palette.color(QPalette::Mid));
painter->drawPath(innerPath);
}
@@ -1699,7 +1699,7 @@ void JavaStyle::drawComplexControl(ComplexControl control,
menuOption.rect = menuRect;
QStyleOptionToolButton label = *button;
- int fw = 5;
+ int fw = 5;
drawControl(CE_ToolButtonLabel, &label, painter, widget);
if (button->subControls & SC_ToolButtonMenu) {
@@ -1713,7 +1713,7 @@ void JavaStyle::drawComplexControl(ComplexControl control,
drawPrimitive(PE_FrameFocusRect, &focusOption, painter, widget);
}
-
+
break;
}
case CC_ComboBox: {
@@ -2113,7 +2113,7 @@ void JavaStyle::drawPrimitive(PrimitiveElement element,
painter->drawLine(center, QPoint(center.x(),
option->rect.bottom()));
}
-
+
if (option->state & State_Children)
if (option->state & State_Open)
painter->drawPixmap(pixmapRect.topLeft(), closedPixmap);
@@ -2198,7 +2198,7 @@ void JavaStyle::drawPrimitive(PrimitiveElement element,
painter->drawPoint(center.x() + 1 + add, center.y() + 1 + add);
break;
}
- case PE_FrameDockWidget: {
+ case PE_FrameDockWidget: {
drawPrimitive(PE_FrameWindow, option, painter, widget);
break;
}
@@ -2226,7 +2226,7 @@ void JavaStyle::drawPrimitive(PrimitiveElement element,
painter->drawPoint(offset + xySwitch(QPoint(add + 8, i),
horizontal));
}
-
+
break;
}
case PE_IndicatorToolBarSeparator: {
@@ -2591,7 +2591,7 @@ int JavaStyle::styleHint(StyleHint hint, const QStyleOption *option,
break;
}
case QStyle::SH_Menu_Scrollable:
- ret = 1;
+ ret = 1;
break;
default:
ret = QCommonStyle::styleHint(hint, option, widget, returnData);
@@ -2719,7 +2719,7 @@ QSize JavaStyle::sizeFromContents(ContentsType type,
int height = 0;
if (!menuItem->icon.isNull()) {
- width += 20;
+ width += 20;
height += 20;
}
if (!menuItem->text.isEmpty()) {
diff --git a/src/widgets/doc/snippets/layouts/layouts.cpp b/src/widgets/doc/snippets/layouts/layouts.cpp
index c41f370070..9ec2349615 100644
--- a/src/widgets/doc/snippets/layouts/layouts.cpp
+++ b/src/widgets/doc/snippets/layouts/layouts.cpp
@@ -72,7 +72,7 @@ int main(int argc, char *argv[])
window->show();
//! [5]
}
-
+
{
//! [6]
QWidget *window = new QWidget;
@@ -101,7 +101,7 @@ int main(int argc, char *argv[])
window->show();
//! [11]
}
-
+
{
//! [12]
QWidget *window = new QWidget;
@@ -158,7 +158,7 @@ int main(int argc, char *argv[])
window->setWindowTitle("QFormLayout");
//! [23]
window->show();
-//! [23]
+//! [23]
}
{
diff --git a/src/widgets/doc/snippets/mainwindowsnippet.cpp b/src/widgets/doc/snippets/mainwindowsnippet.cpp
index 1ba58ca0e7..a9a9012d46 100644
--- a/src/widgets/doc/snippets/mainwindowsnippet.cpp
+++ b/src/widgets/doc/snippets/mainwindowsnippet.cpp
@@ -55,10 +55,10 @@ void MainWindow::createMenus()
//setMenuWidget(new QPushButton("Hello"));
QMenu *menu = new QMenu("File");
menu->addAction("Save &As");
-
+
QMenuBar *bar = new QMenuBar;
bar->addMenu(menu);
-
+
setMenuWidget(new QWidget());
}
@@ -84,9 +84,9 @@ void MainWindow::createDockWidgets()
//! [0]
QDockWidget *dockWidget = new QDockWidget(tr("Dock Widget"), this);
- dockWidget->setAllowedAreas(Qt::LeftDockWidgetArea |
+ dockWidget->setAllowedAreas(Qt::LeftDockWidgetArea |
Qt::RightDockWidgetArea);
dockWidget->setWidget(dockWidgetContents);
- addDockWidget(Qt::LeftDockWidgetArea, dockWidget);
+ addDockWidget(Qt::LeftDockWidgetArea, dockWidget);
//! [0]
}
diff --git a/src/widgets/doc/snippets/mdiareasnippets.cpp b/src/widgets/doc/snippets/mdiareasnippets.cpp
index 51555f8984..42902b4cd7 100644
--- a/src/widgets/doc/snippets/mdiareasnippets.cpp
+++ b/src/widgets/doc/snippets/mdiareasnippets.cpp
@@ -57,7 +57,7 @@ void addingSubWindowsExample()
{
QWidget *internalWidget1 = new QWidget;
QWidget *internalWidget2 = new QWidget;
-
+
//! [1]
QMdiArea mdiArea;
QMdiSubWindow *subWindow1 = new QMdiSubWindow;
diff --git a/src/widgets/doc/snippets/myscrollarea.cpp b/src/widgets/doc/snippets/myscrollarea.cpp
index 48434952c3..675acf89ef 100644
--- a/src/widgets/doc/snippets/myscrollarea.cpp
+++ b/src/widgets/doc/snippets/myscrollarea.cpp
@@ -121,7 +121,7 @@ int main(int argv, char **args)
MyScrollArea area(&label);
area.resize(300, 300);
area.show();
-
+
area.setWidget(&label);
return app.exec();
diff --git a/src/widgets/doc/snippets/qtablewidget-using/mainwindow.cpp b/src/widgets/doc/snippets/qtablewidget-using/mainwindow.cpp
index d9f9853d9c..85b5baf56e 100644
--- a/src/widgets/doc/snippets/qtablewidget-using/mainwindow.cpp
+++ b/src/widgets/doc/snippets/qtablewidget-using/mainwindow.cpp
@@ -117,7 +117,7 @@ void MainWindow::averageItems()
foreach (item, selected) {
bool ok;
double value = item->text().toDouble(&ok);
-
+
if (ok && !item->text().isEmpty()) {
total += value;
number++;
diff --git a/src/widgets/doc/snippets/simplemodel-use/main.cpp b/src/widgets/doc/snippets/simplemodel-use/main.cpp
index ed435f9897..d291a02b6b 100644
--- a/src/widgets/doc/snippets/simplemodel-use/main.cpp
+++ b/src/widgets/doc/snippets/simplemodel-use/main.cpp
@@ -66,7 +66,7 @@ int main(int argc, char *argv[])
title->setBackgroundRole(QPalette::Base);
title->setMargin(8);
layout->addWidget(title);
-
+
//! [0]
QFileSystemModel *model = new QFileSystemModel;
QModelIndex parentIndex = model->index(QDir::currentPath());
diff --git a/src/widgets/doc/snippets/stringlistmodel/model.cpp b/src/widgets/doc/snippets/stringlistmodel/model.cpp
index 3bf91ec326..b1fa2abdf0 100644
--- a/src/widgets/doc/snippets/stringlistmodel/model.cpp
+++ b/src/widgets/doc/snippets/stringlistmodel/model.cpp
@@ -60,7 +60,7 @@ int StringListModel::rowCount(const QModelIndex &parent) const
#ifdef 0
-// This represents a read-only version of data(), an early stage in the
+// This represents a read-only version of data(), an early stage in the
// development of the example leading to an editable StringListModel.
/*!
@@ -103,7 +103,7 @@ QVariant StringListModel::data(const QModelIndex &index, int role) const
if (index.row() >= stringList.size())
return QVariant();
-
+
if (role == Qt::DisplayRole || role == Qt::EditRole)
return stringList.at(index.row());
else
diff --git a/src/widgets/doc/snippets/timeline/main.cpp b/src/widgets/doc/snippets/timeline/main.cpp
index eb2e8a2c70..9e4d218a88 100644
--- a/src/widgets/doc/snippets/timeline/main.cpp
+++ b/src/widgets/doc/snippets/timeline/main.cpp
@@ -47,17 +47,17 @@ int main(int argv, char *args[])
//! [0]
QGraphicsItem *ball = new QGraphicsEllipseItem(0, 0, 20, 20);
-
+
QTimeLine *timer = new QTimeLine(5000);
timer->setFrameRange(0, 100);
-
+
QGraphicsItemAnimation *animation = new QGraphicsItemAnimation;
animation->setItem(ball);
animation->setTimeLine(timer);
- for (int i = 0; i < 200; ++i)
+ for (int i = 0; i < 200; ++i)
animation->setPosAt(i / 200.0, QPointF(i, i));
-
+
QGraphicsScene *scene = new QGraphicsScene();
scene->setSceneRect(0, 0, 250, 250);
scene->addItem(ball);
diff --git a/src/widgets/doc/src/model-view-programming.qdoc b/src/widgets/doc/src/model-view-programming.qdoc
index a1c6a29066..6bcd0943a1 100644
--- a/src/widgets/doc/src/model-view-programming.qdoc
+++ b/src/widgets/doc/src/model-view-programming.qdoc
@@ -280,7 +280,7 @@
In the above example, we neglected to mention how to handle selections
of items. This subject is covered in more detail in the section about
- \l{Handling Selections in Item Views}.
+ \l{Handling Selections in Item Views}.
\section1 Model classes
diff --git a/src/widgets/doc/src/widgets-and-layouts/focus.qdoc b/src/widgets/doc/src/widgets-and-layouts/focus.qdoc
index 5cb7775c32..427d5a24d6 100644
--- a/src/widgets/doc/src/widgets-and-layouts/focus.qdoc
+++ b/src/widgets/doc/src/widgets-and-layouts/focus.qdoc
@@ -34,7 +34,7 @@
\keyword keyboard focus
Qt's widgets handle keyboard focus in the ways that have become
- customary in GUIs.
+ customary in GUIs.
The basic issue is that the user's key strokes can be directed at any
of several windows on the screen, and any of several widgets inside
@@ -47,7 +47,7 @@
\section1 Focus Motion
The customs which have evolved for directing keyboard focus to a
- particular widget are these:
+ particular widget are these:
\list 1
@@ -89,7 +89,7 @@
For example, in a data entry dialog, there might be a field that
is only necessary in one per cent of all cases. In such a dialog,
\uicontrol Tab could skip this field, and the dialog could use one of
- these mechanisms:
+ these mechanisms:
\list 1
diff --git a/src/widgets/doc/src/widgets-and-layouts/layout.qdoc b/src/widgets/doc/src/widgets-and-layouts/layout.qdoc
index b658fc809c..f74da2fa0a 100644
--- a/src/widgets/doc/src/widgets-and-layouts/layout.qdoc
+++ b/src/widgets/doc/src/widgets-and-layouts/layout.qdoc
@@ -70,7 +70,7 @@
\endlist
\section1 Qt's Layout Classes
-
+
Qt's layout classes were designed for hand-written C++ code, allowing
measurements to be specified in pixels for simplicity, so they are easy to
understand and use. The code generated for forms created using Qt Designer also
@@ -136,11 +136,11 @@
the fifth argument to QGridLayout::addWidget().
QFormLayout will add two widgets on a row, commonly a QLabel and a QLineEdit
- to create forms. Adding a QLabel and a QLineEdit on the same row will set
- the QLineEdit as the QLabel's buddy. The following code will use the
+ to create forms. Adding a QLabel and a QLineEdit on the same row will set
+ the QLineEdit as the QLabel's buddy. The following code will use the
QFormLayout to place three \l{QPushButton}{QPushButtons} and a corresponding
- QLineEdit on a row.
-
+ QLineEdit on a row.
+
\snippet layouts/layouts.cpp 18
\snippet layouts/layouts.cpp 19
\snippet layouts/layouts.cpp 20
@@ -327,7 +327,7 @@
Then we define two functions that iterate over the layout: \c{itemAt()}
and \c{takeAt()}. These functions are used internally by the layout system
to handle deletion of widgets. They are also available for application
- programmers.
+ programmers.
\c{itemAt()} returns the item at the given index. \c{takeAt()} removes the
item at the given index, and returns it. In this case we use the list index
@@ -348,7 +348,7 @@
\snippet code/doc_src_layout.cpp 4
The layout takes over responsibility of the items added. Since QLayoutItem
- does not inherit QObject, we must delete the items manually. In the
+ does not inherit QObject, we must delete the items manually. In the
destructor, we remove each item from the list using \c{takeAt()}, and
then delete it.
diff --git a/src/widgets/doc/src/windows-and-dialogs/dialogs.qdoc b/src/widgets/doc/src/windows-and-dialogs/dialogs.qdoc
index 5aae7fb02b..1f1d8154da 100644
--- a/src/widgets/doc/src/windows-and-dialogs/dialogs.qdoc
+++ b/src/widgets/doc/src/windows-and-dialogs/dialogs.qdoc
@@ -29,7 +29,7 @@
\group standard-dialogs
\ingroup qt-gui-concepts
\title Standard Dialogs
- \brief A list of Qt classes for implementing standard dialogs.
+ \brief A list of Qt classes for implementing standard dialogs.
*/
/*!
@@ -37,7 +37,7 @@
\title Dialog Windows
\ingroup qt-gui-concepts
\brief An overview over dialog windows.
-
+
\previouspage Application Main Window
\contentspage Application Windows and Dialogs
\nextpage Desktop Integration
diff --git a/src/widgets/doc/src/windows-and-dialogs/mainwindow.qdoc b/src/widgets/doc/src/windows-and-dialogs/mainwindow.qdoc
index 1d7d9d1b4c..9315acb85f 100644
--- a/src/widgets/doc/src/windows-and-dialogs/mainwindow.qdoc
+++ b/src/widgets/doc/src/windows-and-dialogs/mainwindow.qdoc
@@ -49,7 +49,7 @@
be listed in the desktop's task bar. This is usually only wanted for one
window in the application, the \e{primary window}.
- In addition, a QWidget that has a parent can become a window by setting the
+ In addition, a QWidget that has a parent can become a window by setting the
Qt::Window flag. Depending on the window management system
such \e{secondary windows} are usually stacked on top of their respective parent
window, and not have a task bar entry of their own.
diff --git a/src/widgets/effects/qgraphicseffect.cpp b/src/widgets/effects/qgraphicseffect.cpp
index cf8abf0d95..ac873709e1 100644
--- a/src/widgets/effects/qgraphicseffect.cpp
+++ b/src/widgets/effects/qgraphicseffect.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/effects/qgraphicseffect.h b/src/widgets/effects/qgraphicseffect.h
index f08f937799..8acb832eee 100644
--- a/src/widgets/effects/qgraphicseffect.h
+++ b/src/widgets/effects/qgraphicseffect.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -49,8 +49,6 @@
#include <QtGui/qbrush.h>
#ifndef QT_NO_GRAPHICSEFFECT
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -281,7 +279,6 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
#endif //QT_NO_GRAPHICSEFFECT
#endif // QGRAPHICSEFFECT_H
diff --git a/src/widgets/effects/qgraphicseffect_p.h b/src/widgets/effects/qgraphicseffect_p.h
index 2455954a0c..7cdb071196 100644
--- a/src/widgets/effects/qgraphicseffect_p.h
+++ b/src/widgets/effects/qgraphicseffect_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/effects/qpixmapfilter.cpp b/src/widgets/effects/qpixmapfilter.cpp
index 8f4c0b2e76..c7ae4e2996 100644
--- a/src/widgets/effects/qpixmapfilter.cpp
+++ b/src/widgets/effects/qpixmapfilter.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/effects/qpixmapfilter_p.h b/src/widgets/effects/qpixmapfilter_p.h
index e93c1adc3c..624079c3ba 100644
--- a/src/widgets/effects/qpixmapfilter_p.h
+++ b/src/widgets/effects/qpixmapfilter_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -58,8 +58,6 @@
#include <QtWidgets/qgraphicseffect.h>
#ifndef QT_NO_GRAPHICSEFFECT
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -189,7 +187,5 @@ public:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif //QT_NO_GRAPHICSEFFECT
#endif // QPIXMAPFILTER_H
diff --git a/src/widgets/graphicsview/qgraph_p.h b/src/widgets/graphicsview/qgraph_p.h
index a889a03a0b..2368c6fbec 100644
--- a/src/widgets/graphicsview/qgraph_p.h
+++ b/src/widgets/graphicsview/qgraph_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/graphicsview/qgraphicsanchorlayout.cpp b/src/widgets/graphicsview/qgraphicsanchorlayout.cpp
index 8c82b97c92..47cb42195f 100644
--- a/src/widgets/graphicsview/qgraphicsanchorlayout.cpp
+++ b/src/widgets/graphicsview/qgraphicsanchorlayout.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/graphicsview/qgraphicsanchorlayout.h b/src/widgets/graphicsview/qgraphicsanchorlayout.h
index b8aa221630..c924a0386a 100644
--- a/src/widgets/graphicsview/qgraphicsanchorlayout.h
+++ b/src/widgets/graphicsview/qgraphicsanchorlayout.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -46,8 +46,6 @@
#include <QtWidgets/qgraphicslayout.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -122,6 +120,4 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif
diff --git a/src/widgets/graphicsview/qgraphicsanchorlayout_p.cpp b/src/widgets/graphicsview/qgraphicsanchorlayout_p.cpp
index 1cc3f5a1ed..e281e4a7a3 100644
--- a/src/widgets/graphicsview/qgraphicsanchorlayout_p.cpp
+++ b/src/widgets/graphicsview/qgraphicsanchorlayout_p.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/graphicsview/qgraphicsanchorlayout_p.h b/src/widgets/graphicsview/qgraphicsanchorlayout_p.h
index 96553a5344..37defccc96 100644
--- a/src/widgets/graphicsview/qgraphicsanchorlayout_p.h
+++ b/src/widgets/graphicsview/qgraphicsanchorlayout_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/graphicsview/qgraphicsgridlayout.cpp b/src/widgets/graphicsview/qgraphicsgridlayout.cpp
index 01d08f229a..6d9dd98839 100644
--- a/src/widgets/graphicsview/qgraphicsgridlayout.cpp
+++ b/src/widgets/graphicsview/qgraphicsgridlayout.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/graphicsview/qgraphicsgridlayout.h b/src/widgets/graphicsview/qgraphicsgridlayout.h
index d833ea3b33..6d0ef5ea10 100644
--- a/src/widgets/graphicsview/qgraphicsgridlayout.h
+++ b/src/widgets/graphicsview/qgraphicsgridlayout.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -45,8 +45,6 @@
#include <QtWidgets/qgraphicsitem.h>
#include <QtWidgets/qgraphicslayout.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -137,7 +135,5 @@ inline void QGraphicsGridLayout::addItem(QGraphicsLayoutItem *aitem, int arow, i
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif
diff --git a/src/widgets/graphicsview/qgraphicsitem.cpp b/src/widgets/graphicsview/qgraphicsitem.cpp
index 5c9651f1c9..9aeee7c37a 100644
--- a/src/widgets/graphicsview/qgraphicsitem.cpp
+++ b/src/widgets/graphicsview/qgraphicsitem.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -1867,15 +1867,46 @@ void QGraphicsItem::setFlags(GraphicsItemFlags flags)
d_ptr->scene->d_func()->updateInputMethodSensitivityInViews();
}
+ if ((flags & ItemIsPanel) != (oldFlags & ItemIsPanel)) {
+ bool becomesPanel = (flags & ItemIsPanel);
+ if ((d_ptr->panelModality != NonModal) && d_ptr->scene) {
+ // update the panel's modal state
+ if (becomesPanel)
+ d_ptr->scene->d_func()->enterModal(this);
+ else
+ d_ptr->scene->d_func()->leaveModal(this);
+ }
+ if (d_ptr->isWidget && (becomesPanel || parentWidget())) {
+ QGraphicsWidget *w = static_cast<QGraphicsWidget *>(this);
+ QGraphicsWidget *focusFirst = w;
+ QGraphicsWidget *focusLast = w;
+ for (;;) {
+ QGraphicsWidget *test = focusLast->d_func()->focusNext;
+ if (!w->isAncestorOf(test) || test == w)
+ break;
+ focusLast = test;
+ }
- if ((d_ptr->panelModality != NonModal)
- && d_ptr->scene
- && (flags & ItemIsPanel) != (oldFlags & ItemIsPanel)) {
- // update the panel's modal state
- if (flags & ItemIsPanel)
- d_ptr->scene->d_func()->enterModal(this);
- else
- d_ptr->scene->d_func()->leaveModal(this);
+ if (becomesPanel) {
+ // unlink own widgets from focus chain
+ QGraphicsWidget *beforeMe = w->d_func()->focusPrev;
+ QGraphicsWidget *afterMe = focusLast->d_func()->focusNext;
+ beforeMe->d_func()->focusNext = afterMe;
+ afterMe->d_func()->focusPrev = beforeMe;
+ focusFirst->d_func()->focusPrev = focusLast;
+ focusLast->d_func()->focusNext = focusFirst;
+ if (!isAncestorOf(focusFirst->d_func()->focusNext))
+ focusFirst->d_func()->focusNext = w;
+ } else if (QGraphicsWidget *pw = parentWidget()) {
+ // link up own widgets to focus chain
+ QGraphicsWidget *beforeMe = pw;
+ QGraphicsWidget *afterMe = pw->d_func()->focusNext;
+ beforeMe->d_func()->focusNext = w;
+ afterMe->d_func()->focusPrev = focusLast;
+ w->d_func()->focusPrev = beforeMe;
+ focusLast->d_func()->focusNext = afterMe;
+ }
+ }
}
if (d_ptr->scene) {
@@ -2259,7 +2290,7 @@ void QGraphicsItemPrivate::setVisibleHelper(bool newVisible, bool explicitly,
scene->d_func()->leaveModal(q_ptr);
}
if (hasFocus && scene) {
- // Hiding the closest non-panel ancestor of the focus item
+ // Hiding the focus item or the closest non-panel ancestor of the focus item
QGraphicsItem *focusItem = scene->focusItem();
bool clear = true;
if (isWidget && !focusItem->isPanel()) {
@@ -3156,16 +3187,20 @@ void QGraphicsItem::setActive(bool active)
// Activate this item.
d_ptr->scene->setActivePanel(this);
} else {
- // Deactivate this item, and reactivate the parent panel,
- // or the last active panel (if any).
- QGraphicsItem *nextToActivate = 0;
- if (d_ptr->parent)
- nextToActivate = d_ptr->parent->panel();
- if (!nextToActivate)
- nextToActivate = d_ptr->scene->d_func()->lastActivePanel;
- if (nextToActivate == this || isAncestorOf(nextToActivate))
- nextToActivate = 0;
- d_ptr->scene->setActivePanel(nextToActivate);
+ QGraphicsItem *activePanel = d_ptr->scene->activePanel();
+ QGraphicsItem *thisPanel = panel();
+ if (!activePanel || activePanel == thisPanel) {
+ // Deactivate this item, and reactivate the parent panel,
+ // or the last active panel (if any).
+ QGraphicsItem *nextToActivate = 0;
+ if (d_ptr->parent)
+ nextToActivate = d_ptr->parent->panel();
+ if (!nextToActivate)
+ nextToActivate = d_ptr->scene->d_func()->lastActivePanel;
+ if (nextToActivate == this || isAncestorOf(nextToActivate))
+ nextToActivate = 0;
+ d_ptr->scene->setActivePanel(nextToActivate);
+ }
}
}
}
diff --git a/src/widgets/graphicsview/qgraphicsitem.h b/src/widgets/graphicsview/qgraphicsitem.h
index 446aea4754..4283deb5b8 100644
--- a/src/widgets/graphicsview/qgraphicsitem.h
+++ b/src/widgets/graphicsview/qgraphicsitem.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -52,8 +52,6 @@
class tst_QGraphicsItem;
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -1059,6 +1057,4 @@ QT_BEGIN_NAMESPACE
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QGRAPHICSITEM_H
diff --git a/src/widgets/graphicsview/qgraphicsitem_p.h b/src/widgets/graphicsview/qgraphicsitem_p.h
index 5803340075..d80df7c4ad 100644
--- a/src/widgets/graphicsview/qgraphicsitem_p.h
+++ b/src/widgets/graphicsview/qgraphicsitem_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/graphicsview/qgraphicsitemanimation.cpp b/src/widgets/graphicsview/qgraphicsitemanimation.cpp
index 5e035be5f7..45e8b436b1 100644
--- a/src/widgets/graphicsview/qgraphicsitemanimation.cpp
+++ b/src/widgets/graphicsview/qgraphicsitemanimation.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/graphicsview/qgraphicsitemanimation.h b/src/widgets/graphicsview/qgraphicsitemanimation.h
index d87fc8a868..1e8f27ef53 100644
--- a/src/widgets/graphicsview/qgraphicsitemanimation.h
+++ b/src/widgets/graphicsview/qgraphicsitemanimation.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -46,8 +46,6 @@
#if !defined(QT_NO_GRAPHICSVIEW)
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -113,7 +111,5 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QT_NO_GRAPHICSVIEW
#endif
diff --git a/src/widgets/graphicsview/qgraphicslayout.cpp b/src/widgets/graphicsview/qgraphicslayout.cpp
index fdd6f9f508..f7c89cf376 100644
--- a/src/widgets/graphicsview/qgraphicslayout.cpp
+++ b/src/widgets/graphicsview/qgraphicslayout.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/graphicsview/qgraphicslayout.h b/src/widgets/graphicsview/qgraphicslayout.h
index 85668d8deb..719ac0dd4d 100644
--- a/src/widgets/graphicsview/qgraphicslayout.h
+++ b/src/widgets/graphicsview/qgraphicslayout.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -44,8 +44,6 @@
#include <QtWidgets/qgraphicslayoutitem.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -93,7 +91,5 @@ Q_DECLARE_INTERFACE(QGraphicsLayout, "org.qt-project.Qt.QGraphicsLayout")
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif
diff --git a/src/widgets/graphicsview/qgraphicslayout_p.cpp b/src/widgets/graphicsview/qgraphicslayout_p.cpp
index 8e3d4a62f8..d856416564 100644
--- a/src/widgets/graphicsview/qgraphicslayout_p.cpp
+++ b/src/widgets/graphicsview/qgraphicslayout_p.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -187,7 +187,7 @@ void QGraphicsLayoutPrivate::activateRecursive(QGraphicsLayoutItem *item)
layout->invalidate(); // ### LOOKS SUSPICIOUSLY WRONG!!???
}
}
-
+
for (int i = layout->count() - 1; i >= 0; --i) {
QGraphicsLayoutItem *childItem = layout->itemAt(i);
if (childItem)
diff --git a/src/widgets/graphicsview/qgraphicslayout_p.h b/src/widgets/graphicsview/qgraphicslayout_p.h
index b1e93ef602..4257e5bc94 100644
--- a/src/widgets/graphicsview/qgraphicslayout_p.h
+++ b/src/widgets/graphicsview/qgraphicslayout_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/graphicsview/qgraphicslayoutitem.cpp b/src/widgets/graphicsview/qgraphicslayoutitem.cpp
index e633514365..78b75e08d1 100644
--- a/src/widgets/graphicsview/qgraphicslayoutitem.cpp
+++ b/src/widgets/graphicsview/qgraphicslayoutitem.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/graphicsview/qgraphicslayoutitem.h b/src/widgets/graphicsview/qgraphicslayoutitem.h
index b753790121..e1dfadcca0 100644
--- a/src/widgets/graphicsview/qgraphicslayoutitem.h
+++ b/src/widgets/graphicsview/qgraphicslayoutitem.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -46,8 +46,6 @@
#include <QtWidgets/qsizepolicy.h>
#include <QtGui/qevent.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -148,6 +146,4 @@ inline qreal QGraphicsLayoutItem::maximumHeight() const
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif
diff --git a/src/widgets/graphicsview/qgraphicslayoutitem_p.h b/src/widgets/graphicsview/qgraphicslayoutitem_p.h
index 8c153c14e7..62f93f9091 100644
--- a/src/widgets/graphicsview/qgraphicslayoutitem_p.h
+++ b/src/widgets/graphicsview/qgraphicslayoutitem_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/graphicsview/qgraphicslinearlayout.cpp b/src/widgets/graphicsview/qgraphicslinearlayout.cpp
index cd022bbf78..00076502ea 100644
--- a/src/widgets/graphicsview/qgraphicslinearlayout.cpp
+++ b/src/widgets/graphicsview/qgraphicslinearlayout.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/graphicsview/qgraphicslinearlayout.h b/src/widgets/graphicsview/qgraphicslinearlayout.h
index 0aabc808a0..04e27515f1 100644
--- a/src/widgets/graphicsview/qgraphicslinearlayout.h
+++ b/src/widgets/graphicsview/qgraphicslinearlayout.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -45,8 +45,6 @@
#include <QtWidgets/qgraphicsitem.h>
#include <QtWidgets/qgraphicslayout.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -112,7 +110,5 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif
diff --git a/src/widgets/graphicsview/qgraphicsproxywidget.cpp b/src/widgets/graphicsview/qgraphicsproxywidget.cpp
index e9be1e015a..f84201cedf 100644
--- a/src/widgets/graphicsview/qgraphicsproxywidget.cpp
+++ b/src/widgets/graphicsview/qgraphicsproxywidget.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/graphicsview/qgraphicsproxywidget.h b/src/widgets/graphicsview/qgraphicsproxywidget.h
index a88899b900..8180cb9966 100644
--- a/src/widgets/graphicsview/qgraphicsproxywidget.h
+++ b/src/widgets/graphicsview/qgraphicsproxywidget.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -44,8 +44,6 @@
#include <QtWidgets/qgraphicswidget.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -140,7 +138,5 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif
diff --git a/src/widgets/graphicsview/qgraphicsproxywidget_p.h b/src/widgets/graphicsview/qgraphicsproxywidget_p.h
index bbc1c7ebc1..2eb4efaf18 100644
--- a/src/widgets/graphicsview/qgraphicsproxywidget_p.h
+++ b/src/widgets/graphicsview/qgraphicsproxywidget_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/graphicsview/qgraphicsscene.cpp b/src/widgets/graphicsview/qgraphicsscene.cpp
index a9c045ea80..ba59b15a54 100644
--- a/src/widgets/graphicsview/qgraphicsscene.cpp
+++ b/src/widgets/graphicsview/qgraphicsscene.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -607,7 +607,7 @@ void QGraphicsScenePrivate::removeItemHelper(QGraphicsItem *item)
q->removeItem(item->d_ptr->children.at(i));
}
- if (!item->d_ptr->inDestructor && item == tabFocusFirst) {
+ if (!item->d_ptr->inDestructor && !item->parentItem() && item->isWidget()) {
QGraphicsWidget *widget = static_cast<QGraphicsWidget *>(item);
widget->d_func()->fixFocusChainBeforeReparenting(0, oldScene, 0);
}
@@ -742,12 +742,14 @@ void QGraphicsScenePrivate::setActivePanelHelper(QGraphicsItem *item, bool durin
if (panel == activePanel || (!q->isActive() && !duringActivationEvent))
return;
+ QGraphicsItem *oldFocusItem = focusItem;
+
// Deactivate the last active panel.
if (activePanel) {
if (QGraphicsItem *fi = activePanel->focusItem()) {
// Remove focus from the current focus item.
if (fi == q->focusItem())
- q->setFocusItem(0, Qt::ActiveWindowFocusReason);
+ setFocusItemHelper(0, Qt::ActiveWindowFocusReason, /* emitFocusChanged = */ false);
}
QEvent event(QEvent::WindowDeactivate);
@@ -771,9 +773,23 @@ void QGraphicsScenePrivate::setActivePanelHelper(QGraphicsItem *item, bool durin
QEvent event(QEvent::WindowActivate);
q->sendEvent(panel, &event);
- // Set focus on the panel's focus item.
- if (QGraphicsItem *focusItem = panel->focusItem())
- focusItem->setFocus(Qt::ActiveWindowFocusReason);
+ // Set focus on the panel's focus item, or itself if it's
+ // focusable, or on the first focusable item in the panel's
+ // focus chain as a last resort.
+ if (QGraphicsItem *focusItem = panel->focusItem()) {
+ setFocusItemHelper(focusItem, Qt::ActiveWindowFocusReason, /* emitFocusChanged = */ false);
+ } else if (panel->flags() & QGraphicsItem::ItemIsFocusable) {
+ setFocusItemHelper(panel, Qt::ActiveWindowFocusReason, /* emitFocusChanged = */ false);
+ } else if (panel->isWidget()) {
+ QGraphicsWidget *fw = static_cast<QGraphicsWidget *>(panel)->d_func()->focusNext;
+ do {
+ if (fw->focusPolicy() & Qt::TabFocus) {
+ setFocusItemHelper(fw, Qt::ActiveWindowFocusReason, /* emitFocusChanged = */ false);
+ break;
+ }
+ fw = fw->d_func()->focusNext;
+ } while (fw != panel);
+ }
} else if (q->isActive()) {
// Activate the scene
QEvent event(QEvent::WindowActivate);
@@ -782,13 +798,23 @@ void QGraphicsScenePrivate::setActivePanelHelper(QGraphicsItem *item, bool durin
q->sendEvent(item, &event);
}
}
+
+ emit q->focusItemChanged(focusItem, oldFocusItem, Qt::ActiveWindowFocusReason);
}
/*!
\internal
+
+ \a emitFocusChanged needs to be false when focus passes from one
+ item to another through setActivePanel(); i.e. when activation
+ passes from one panel to another, to avoid getting two focusChanged()
+ emissions; one focusChanged(0, lastFocus), then one
+ focusChanged(newFocus, 0). Instead setActivePanel() emits the signal
+ once itself: focusChanged(newFocus, oldFocus).
*/
void QGraphicsScenePrivate::setFocusItemHelper(QGraphicsItem *item,
- Qt::FocusReason focusReason)
+ Qt::FocusReason focusReason,
+ bool emitFocusChanged)
{
Q_Q(QGraphicsScene);
if (item == focusItem)
@@ -804,10 +830,14 @@ void QGraphicsScenePrivate::setFocusItemHelper(QGraphicsItem *item,
// Set focus on the scene if an item requests focus.
if (item) {
q->setFocus(focusReason);
- if (item == focusItem)
+ if (item == focusItem) {
+ if (emitFocusChanged)
+ emit q->focusItemChanged(focusItem, (QGraphicsItem *)0, focusReason);
return;
+ }
}
+ QGraphicsItem *oldFocusItem = focusItem;
if (focusItem) {
lastFocusItem = focusItem;
@@ -848,6 +878,9 @@ void QGraphicsScenePrivate::setFocusItemHelper(QGraphicsItem *item,
QFocusEvent event(QEvent::FocusIn, focusReason);
sendEvent(item, &event);
}
+
+ if (emitFocusChanged)
+ emit q->focusItemChanged(focusItem, oldFocusItem, focusReason);
}
/*!
@@ -2528,14 +2561,13 @@ void QGraphicsScene::addItem(QGraphicsItem *item)
// No first tab focus widget - make this the first tab focus
// widget.
d->tabFocusFirst = widget;
- } else if (!widget->parentWidget()) {
+ } else if (!widget->parentWidget() && !widget->isPanel()) {
// Adding a widget that is not part of a tab focus chain.
- QGraphicsWidget *last = d->tabFocusFirst->d_func()->focusPrev;
- QGraphicsWidget *lastNew = widget->d_func()->focusPrev;
- last->d_func()->focusNext = widget;
- widget->d_func()->focusPrev = last;
- d->tabFocusFirst->d_func()->focusPrev = lastNew;
- lastNew->d_func()->focusNext = d->tabFocusFirst;
+ QGraphicsWidget *myNewPrev = d->tabFocusFirst->d_func()->focusPrev;
+ myNewPrev->d_func()->focusNext = widget;
+ widget->d_func()->focusPrev->d_func()->focusNext = d->tabFocusFirst;
+ d->tabFocusFirst->d_func()->focusPrev = widget->d_func()->focusPrev;
+ widget->d_func()->focusPrev = myNewPrev;
}
}
@@ -5329,8 +5361,23 @@ bool QGraphicsScene::focusNextPrevChild(bool next)
setFocusItem(d->lastFocusItem, next ? Qt::TabFocusReason : Qt::BacktabFocusReason);
return true;
}
+ if (d->activePanel) {
+ if (d->activePanel->flags() & QGraphicsItem::ItemIsFocusable) {
+ setFocusItem(d->activePanel, next ? Qt::TabFocusReason : Qt::BacktabFocusReason);
+ return true;
+ }
+ if (d->activePanel->isWidget()) {
+ QGraphicsWidget *fw = static_cast<QGraphicsWidget *>(d->activePanel)->d_func()->focusNext;
+ do {
+ if (fw->focusPolicy() & Qt::TabFocus) {
+ setFocusItem(fw, next ? Qt::TabFocusReason : Qt::BacktabFocusReason);
+ return true;
+ }
+ } while (fw != d->activePanel);
+ }
+ }
}
- if (!d->tabFocusFirst) {
+ if (!item && !d->tabFocusFirst) {
// No widgets...
return false;
}
@@ -5342,8 +5389,10 @@ bool QGraphicsScene::focusNextPrevChild(bool next)
} else {
QGraphicsWidget *test = static_cast<QGraphicsWidget *>(item);
widget = next ? test->d_func()->focusNext : test->d_func()->focusPrev;
- if ((next && widget == d->tabFocusFirst) || (!next && widget == d->tabFocusFirst->d_func()->focusPrev))
+ if (!widget->panel() && ((next && widget == d->tabFocusFirst) || (!next && widget == d->tabFocusFirst->d_func()->focusPrev))) {
+ // Tab out of the scene.
return false;
+ }
}
QGraphicsWidget *widgetThatHadFocus = widget;
@@ -5407,6 +5456,25 @@ bool QGraphicsScene::focusNextPrevChild(bool next)
*/
/*!
+ \fn QGraphicsScene::focusChanged(QGraphicsItem *newFocusItem, QGraphicsItem *oldFocusItem, Qt::FocusReason reason)
+
+ This signal is emitted by QGraphicsScene whenever focus changes in the
+ scene (i.e., when an item gains or loses input focus, or when focus
+ passes from one item to another). You can connect to this signal if you
+ need to keep track of when other items gain input focus. It is
+ particularily useful for implementing virtual keyboards, input methods,
+ and cursor items.
+
+ \a oldFocusItem is a pointer to the item that previously had focus, or
+ 0 if no item had focus before the signal was emitted. \a newFocusItem
+ is a pointer to the item that gained input focus, or 0 if focus was lost.
+ \a reason is the reason for the focus change (e.g., if the scene was
+ deactivated while an input field had focus, \a oldFocusItem would point
+ to the input field item, \a newFocusItem would be 0, and \a reason would be
+ Qt::ActiveWindowFocusReason.
+*/
+
+/*!
\since 4.4
Returns the scene's style, or the same as QApplication::style() if the
diff --git a/src/widgets/graphicsview/qgraphicsscene.h b/src/widgets/graphicsview/qgraphicsscene.h
index 802d9c4970..cde0eda125 100644
--- a/src/widgets/graphicsview/qgraphicsscene.h
+++ b/src/widgets/graphicsview/qgraphicsscene.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -51,8 +51,6 @@
#include <QtGui/qmatrix.h>
#include <QtGui/qpen.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -292,6 +290,7 @@ Q_SIGNALS:
void changed(const QList<QRectF> &region);
void sceneRectChanged(const QRectF &rect);
void selectionChanged();
+ void focusItemChanged(QGraphicsItem *newFocus, QGraphicsItem *oldFocus, Qt::FocusReason reason);
private:
Q_DECLARE_PRIVATE(QGraphicsScene)
@@ -324,6 +323,4 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(QGraphicsScene::SceneLayers)
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif
diff --git a/src/widgets/graphicsview/qgraphicsscene_bsp.cpp b/src/widgets/graphicsview/qgraphicsscene_bsp.cpp
index fa042bd9c5..55c52d1c6a 100644
--- a/src/widgets/graphicsview/qgraphicsscene_bsp.cpp
+++ b/src/widgets/graphicsview/qgraphicsscene_bsp.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/graphicsview/qgraphicsscene_bsp_p.h b/src/widgets/graphicsview/qgraphicsscene_bsp_p.h
index 17bdc6b390..88e34b7dea 100644
--- a/src/widgets/graphicsview/qgraphicsscene_bsp_p.h
+++ b/src/widgets/graphicsview/qgraphicsscene_bsp_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/graphicsview/qgraphicsscene_p.h b/src/widgets/graphicsview/qgraphicsscene_p.h
index 14cc240fa3..9e5bcec488 100644
--- a/src/widgets/graphicsview/qgraphicsscene_p.h
+++ b/src/widgets/graphicsview/qgraphicsscene_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -157,7 +157,8 @@ public:
int activationRefCount;
int childExplicitActivation;
void setActivePanelHelper(QGraphicsItem *item, bool duringActivationEvent);
- void setFocusItemHelper(QGraphicsItem *item, Qt::FocusReason focusReason);
+ void setFocusItemHelper(QGraphicsItem *item, Qt::FocusReason focusReason,
+ bool emitFocusChanged = true);
QList<QGraphicsWidget *> popupWidgets;
void addPopup(QGraphicsWidget *widget);
diff --git a/src/widgets/graphicsview/qgraphicsscenebsptreeindex.cpp b/src/widgets/graphicsview/qgraphicsscenebsptreeindex.cpp
index 64fc97cadf..f70e66f685 100644
--- a/src/widgets/graphicsview/qgraphicsscenebsptreeindex.cpp
+++ b/src/widgets/graphicsview/qgraphicsscenebsptreeindex.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/graphicsview/qgraphicssceneevent.cpp b/src/widgets/graphicsview/qgraphicssceneevent.cpp
index 1b78228301..8eb1395a45 100644
--- a/src/widgets/graphicsview/qgraphicssceneevent.cpp
+++ b/src/widgets/graphicsview/qgraphicssceneevent.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/graphicsview/qgraphicssceneevent.h b/src/widgets/graphicsview/qgraphicssceneevent.h
index 81a5321e0c..e744d08edf 100644
--- a/src/widgets/graphicsview/qgraphicssceneevent.h
+++ b/src/widgets/graphicsview/qgraphicssceneevent.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -50,8 +50,6 @@
#include <QtCore/qset.h>
#include <QtCore/qhash.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -320,6 +318,4 @@ public:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif
diff --git a/src/widgets/graphicsview/qgraphicssceneindex.cpp b/src/widgets/graphicsview/qgraphicssceneindex.cpp
index e07edd37e9..4b1c990578 100644
--- a/src/widgets/graphicsview/qgraphicssceneindex.cpp
+++ b/src/widgets/graphicsview/qgraphicssceneindex.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/graphicsview/qgraphicssceneindex_p.h b/src/widgets/graphicsview/qgraphicssceneindex_p.h
index c5500e3d6e..29b321fb1d 100644
--- a/src/widgets/graphicsview/qgraphicssceneindex_p.h
+++ b/src/widgets/graphicsview/qgraphicssceneindex_p.h
@@ -61,8 +61,6 @@
#include <QtCore/qobject.h>
#include <QtGui/qtransform.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -176,6 +174,4 @@ public:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QGRAPHICSSCENEINDEX_H
diff --git a/src/widgets/graphicsview/qgraphicsscenelinearindex.cpp b/src/widgets/graphicsview/qgraphicsscenelinearindex.cpp
index 7b5bb7d04c..f4f5f8b30b 100644
--- a/src/widgets/graphicsview/qgraphicsscenelinearindex.cpp
+++ b/src/widgets/graphicsview/qgraphicsscenelinearindex.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/graphicsview/qgraphicsscenelinearindex_p.h b/src/widgets/graphicsview/qgraphicsscenelinearindex_p.h
index 607a15b949..7debcfb501 100644
--- a/src/widgets/graphicsview/qgraphicsscenelinearindex_p.h
+++ b/src/widgets/graphicsview/qgraphicsscenelinearindex_p.h
@@ -62,8 +62,6 @@
#include <QtWidgets/qgraphicsitem.h>
#include <private/qgraphicssceneindex_p.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -103,6 +101,4 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QGRAPHICSSCENELINEARINDEX_H
diff --git a/src/widgets/graphicsview/qgraphicstransform.h b/src/widgets/graphicsview/qgraphicstransform.h
index 6c2c0d67f0..6f274201be 100644
--- a/src/widgets/graphicsview/qgraphicstransform.h
+++ b/src/widgets/graphicsview/qgraphicstransform.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -48,8 +48,6 @@
#include <QtGui/QMatrix4x4>
#ifndef QT_NO_GRAPHICSVIEW
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -152,7 +150,6 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
#endif //QT_NO_GRAPHICSVIEW
#endif // QFXTRANSFORM_H
diff --git a/src/widgets/graphicsview/qgraphicstransform_p.h b/src/widgets/graphicsview/qgraphicstransform_p.h
index 6215f58fe0..211443a77c 100644
--- a/src/widgets/graphicsview/qgraphicstransform_p.h
+++ b/src/widgets/graphicsview/qgraphicstransform_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/graphicsview/qgraphicsview.cpp b/src/widgets/graphicsview/qgraphicsview.cpp
index 22ec829507..0424517346 100644
--- a/src/widgets/graphicsview/qgraphicsview.cpp
+++ b/src/widgets/graphicsview/qgraphicsview.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -256,6 +256,20 @@ static const int QGRAPHICSVIEW_PREALLOC_STYLE_OPTIONS = 503; // largest prime <
\sa dragMode, QGraphicsScene::setSelectionArea()
*/
+/*!
+ \since 5.1
+
+ \fn void QGraphicsView::rubberBandChanged(QRect rubberBandRect, QPointF fromScenePoint, QPointF toScenePoint)
+
+ This signal is emitted when the rubber band rect is changed. The viewport Rect is specified by \a rubberBandRect.
+ The drag start position and drag end position are provided in scene points with \a fromScenePoint and \a toScenePoint.
+
+ When rubberband selection ends this signal will be emitted with null vales.
+
+ \sa rubberBandRect()
+*/
+
+
#include "qgraphicsview.h"
#include "qgraphicsview_p.h"
@@ -706,56 +720,61 @@ QRegion QGraphicsViewPrivate::rubberBandRegion(const QWidget *widget, const QRec
return tmp;
}
-void QGraphicsViewPrivate::updateRubberBand(QMouseEvent *event)
+void QGraphicsViewPrivate::updateRubberBand(const QMouseEvent *event)
{
Q_Q(QGraphicsView);
- if (dragMode == QGraphicsView::RubberBandDrag && sceneInteractionAllowed) {
- storeMouseEvent(event);
- if (rubberBanding) {
- // Check for enough drag distance
- if ((mousePressViewPoint - event->pos()).manhattanLength()
- < QApplication::startDragDistance()) {
- return;
- }
+ if (dragMode != QGraphicsView::RubberBandDrag || !sceneInteractionAllowed || !rubberBanding)
+ return;
+ // Check for enough drag distance
+ if ((mousePressViewPoint - event->pos()).manhattanLength() < QApplication::startDragDistance())
+ return;
- // Update old rubberband
- if (viewportUpdateMode != QGraphicsView::NoViewportUpdate && !rubberBandRect.isEmpty()) {
- if (viewportUpdateMode != QGraphicsView::FullViewportUpdate)
- q->viewport()->update(rubberBandRegion(q->viewport(), rubberBandRect));
- else
- updateAll();
- }
+ // Update old rubberband
+ if (viewportUpdateMode != QGraphicsView::NoViewportUpdate && !rubberBandRect.isEmpty()) {
+ if (viewportUpdateMode != QGraphicsView::FullViewportUpdate)
+ q->viewport()->update(rubberBandRegion(q->viewport(), rubberBandRect));
+ else
+ updateAll();
+ }
- // Stop rubber banding if the user has let go of all buttons (even
- // if we didn't get the release events).
- if (!event->buttons()) {
- rubberBanding = false;
- rubberBandRect = QRect();
- return;
- }
+ // Stop rubber banding if the user has let go of all buttons (even
+ // if we didn't get the release events).
+ if (!event->buttons()) {
+ rubberBanding = false;
+ if (!rubberBandRect.isNull()) {
+ rubberBandRect = QRect();
+ emit q->rubberBandChanged(rubberBandRect, QPointF(), QPointF());
+ }
+ return;
+ }
- // Update rubberband position
- const QPoint mp = q->mapFromScene(mousePressScenePoint);
- const QPoint ep = event->pos();
- rubberBandRect = QRect(qMin(mp.x(), ep.x()), qMin(mp.y(), ep.y()),
- qAbs(mp.x() - ep.x()) + 1, qAbs(mp.y() - ep.y()) + 1);
+ QRect oldRubberband = rubberBandRect;
- // Update new rubberband
- if (viewportUpdateMode != QGraphicsView::NoViewportUpdate){
- if (viewportUpdateMode != QGraphicsView::FullViewportUpdate)
- q->viewport()->update(rubberBandRegion(q->viewport(), rubberBandRect));
- else
- updateAll();
- }
- // Set the new selection area
- QPainterPath selectionArea;
- selectionArea.addPolygon(mapToScene(rubberBandRect));
- selectionArea.closeSubpath();
- if (scene)
- scene->setSelectionArea(selectionArea, rubberBandSelectionMode,
- q->viewportTransform());
- }
+ // Update rubberband position
+ const QPoint mp = q->mapFromScene(mousePressScenePoint);
+ const QPoint ep = event->pos();
+ rubberBandRect = QRect(qMin(mp.x(), ep.x()), qMin(mp.y(), ep.y()),
+ qAbs(mp.x() - ep.x()) + 1, qAbs(mp.y() - ep.y()) + 1);
+
+ if (rubberBandRect != oldRubberband || lastRubberbandScenePoint != lastMouseMoveScenePoint) {
+ lastRubberbandScenePoint = lastMouseMoveScenePoint;
+ oldRubberband = rubberBandRect;
+ emit q->rubberBandChanged(rubberBandRect, mousePressScenePoint, lastRubberbandScenePoint);
}
+
+ // Update new rubberband
+ if (viewportUpdateMode != QGraphicsView::NoViewportUpdate) {
+ if (viewportUpdateMode != QGraphicsView::FullViewportUpdate)
+ q->viewport()->update(rubberBandRegion(q->viewport(), rubberBandRect));
+ else
+ updateAll();
+ }
+ // Set the new selection area
+ QPainterPath selectionArea;
+ selectionArea.addPolygon(mapToScene(rubberBandRect));
+ selectionArea.closeSubpath();
+ if (scene)
+ scene->setSelectionArea(selectionArea, rubberBandSelectionMode, q->viewportTransform());
}
#endif
@@ -1502,7 +1521,7 @@ void QGraphicsView::setDragMode(DragMode mode)
The default value is Qt::IntersectsItemShape; all items whose shape
intersects with or is contained by the rubber band are selected.
- \sa dragMode, items()
+ \sa dragMode, items(), rubberBandRect()
*/
Qt::ItemSelectionMode QGraphicsView::rubberBandSelectionMode() const
{
@@ -1514,6 +1533,27 @@ void QGraphicsView::setRubberBandSelectionMode(Qt::ItemSelectionMode mode)
Q_D(QGraphicsView);
d->rubberBandSelectionMode = mode;
}
+
+/*!
+ \since 5.1
+ This functions returns the current rubber band area (in viewport coordinates) if the user
+ is currently doing an itemselection with rubber band. When the user is not using the
+ rubber band this functions returns (a null) QRectF().
+
+ Notice that part of this QRect can be outise the visual viewport. It can e.g
+ contain negative values.
+
+ \sa rubberBandSelectionMode, rubberBandChanged()
+*/
+
+QRect QGraphicsView::rubberBandRect() const
+{
+ Q_D(const QGraphicsView);
+ if (d->dragMode != QGraphicsView::RubberBandDrag || !d->sceneInteractionAllowed || !d->rubberBanding)
+ return QRect();
+
+ return d->rubberBandRect;
+}
#endif
/*!
@@ -3301,7 +3341,10 @@ void QGraphicsView::mouseReleaseEvent(QMouseEvent *event)
d->updateAll();
}
d->rubberBanding = false;
- d->rubberBandRect = QRect();
+ if (!d->rubberBandRect.isNull()) {
+ d->rubberBandRect = QRect();
+ emit rubberBandChanged(d->rubberBandRect, QPointF(), QPointF());
+ }
}
} else
#endif
diff --git a/src/widgets/graphicsview/qgraphicsview.h b/src/widgets/graphicsview/qgraphicsview.h
index 488e12511c..670c3251b5 100644
--- a/src/widgets/graphicsview/qgraphicsview.h
+++ b/src/widgets/graphicsview/qgraphicsview.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -47,8 +47,6 @@
#include <QtWidgets/qscrollarea.h>
#include <QtWidgets/qgraphicsscene.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -148,6 +146,7 @@ public:
#ifndef QT_NO_RUBBERBAND
Qt::ItemSelectionMode rubberBandSelectionMode() const;
void setRubberBandSelectionMode(Qt::ItemSelectionMode mode);
+ QRect rubberBandRect() const;
#endif
CacheMode cacheMode() const;
@@ -228,6 +227,11 @@ public Q_SLOTS:
void invalidateScene(const QRectF &rect = QRectF(), QGraphicsScene::SceneLayers layers = QGraphicsScene::AllLayers);
void updateSceneRect(const QRectF &rect);
+#ifndef QT_NO_RUBBERBAND
+Q_SIGNALS:
+ void rubberBandChanged(QRect viewportRect, QPointF fromScenePoint, QPointF toScenePoint);
+#endif
+
protected Q_SLOTS:
void setupViewport(QWidget *widget);
@@ -310,6 +314,4 @@ inline QPolygon QGraphicsView::mapFromScene(qreal ax, qreal ay, qreal w, qreal h
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QGRAPHICSVIEW_H
diff --git a/src/widgets/graphicsview/qgraphicsview_p.h b/src/widgets/graphicsview/qgraphicsview_p.h
index 9f0e3e3b24..5725fd9c19 100644
--- a/src/widgets/graphicsview/qgraphicsview_p.h
+++ b/src/widgets/graphicsview/qgraphicsview_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -110,6 +110,7 @@ public:
QPoint mousePressViewPoint;
QPoint mousePressScreenPoint;
QPointF lastMouseMoveScenePoint;
+ QPointF lastRubberbandScenePoint;
QPoint lastMouseMoveScreenPoint;
QPoint dirtyScrollOffset;
Qt::MouseButton mousePressButton;
@@ -138,7 +139,7 @@ public:
#ifndef QT_NO_RUBBERBAND
QRect rubberBandRect;
QRegion rubberBandRegion(const QWidget *widget, const QRect &rect) const;
- void updateRubberBand(QMouseEvent *event);
+ void updateRubberBand(const QMouseEvent *event);
bool rubberBanding;
Qt::ItemSelectionMode rubberBandSelectionMode;
#endif
diff --git a/src/widgets/graphicsview/qgraphicswidget.cpp b/src/widgets/graphicsview/qgraphicswidget.cpp
index 2d7fca8000..ddd3ee2e68 100644
--- a/src/widgets/graphicsview/qgraphicswidget.cpp
+++ b/src/widgets/graphicsview/qgraphicswidget.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/graphicsview/qgraphicswidget.h b/src/widgets/graphicsview/qgraphicswidget.h
index 3f8720f6e9..8881fec1d6 100644
--- a/src/widgets/graphicsview/qgraphicswidget.h
+++ b/src/widgets/graphicsview/qgraphicswidget.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -47,8 +47,6 @@
#include <QtWidgets/qgraphicsitem.h>
#include <QtGui/qpalette.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -245,7 +243,5 @@ inline void QGraphicsWidget::setGeometry(qreal ax, qreal ay, qreal aw, qreal ah)
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif
diff --git a/src/widgets/graphicsview/qgraphicswidget_p.cpp b/src/widgets/graphicsview/qgraphicswidget_p.cpp
index e97ec90cd0..14cd7007ba 100644
--- a/src/widgets/graphicsview/qgraphicswidget_p.cpp
+++ b/src/widgets/graphicsview/qgraphicswidget_p.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -764,73 +764,59 @@ bool QGraphicsWidgetPrivate::hasDecoration() const
void QGraphicsWidgetPrivate::fixFocusChainBeforeReparenting(QGraphicsWidget *newParent, QGraphicsScene *oldScene, QGraphicsScene *newScene)
{
Q_Q(QGraphicsWidget);
-
Q_ASSERT(focusNext && focusPrev);
- QGraphicsWidget *n = q; //last one in 'new' list
- QGraphicsWidget *o = 0; //last one in 'old' list
-
- QGraphicsWidget *w = focusNext;
-
- QGraphicsWidget *firstOld = 0;
- bool wasPreviousNew = true;
-
- while (w != q) {
- bool isCurrentNew = q->isAncestorOf(w);
- if (isCurrentNew) {
- if (!wasPreviousNew) {
- n->d_func()->focusNext = w;
- w->d_func()->focusPrev = n;
- }
- n = w;
- } else /*if (!isCurrentNew)*/ {
- if (wasPreviousNew) {
- if (o) {
- o->d_func()->focusNext = w;
- w->d_func()->focusPrev = o;
- } else {
- firstOld = w;
- }
- }
- o = w;
- }
- w = w->d_func()->focusNext;
- wasPreviousNew = isCurrentNew;
- }
-
- // repair the 'old' chain
- if (firstOld) {
- o->d_func()->focusNext = firstOld;
- firstOld->d_func()->focusPrev = o;
+ if (q_ptr->isPanel()) {
+ // panels are never a part of their parent's or ancestors' focus
+ // chains. so reparenting a panel is easy; there's nothing to
+ // do.
+ return;
}
- // update tabFocusFirst for oldScene if the item is going to be removed from oldScene
- if (newParent)
- newScene = newParent->scene();
-
- if (oldScene && newScene != oldScene)
- oldScene->d_func()->tabFocusFirst = (firstOld && firstOld->scene() == oldScene) ? firstOld : 0;
-
- QGraphicsItem *topLevelItem = newParent ? newParent->topLevelItem() : 0;
- QGraphicsWidget *topLevel = 0;
- if (topLevelItem && topLevelItem->isWidget())
- topLevel = static_cast<QGraphicsWidget *>(topLevelItem);
+ // we're not a panel, so find the first widget in the focus chain
+ // (this), and the last (this, or the last widget that is still
+ // a descendent of this). also find the widgets that currently /
+ // before reparenting point to this widgets' focus chain.
+ QGraphicsWidget *focusFirst = q;
+ QGraphicsWidget *focusBefore = focusPrev;
+ QGraphicsWidget *focusLast = focusFirst;
+ QGraphicsWidget *focusAfter = focusNext;
+ do {
+ if (!q->isAncestorOf(focusAfter))
+ break;
+ focusLast = focusAfter;
+ } while ((focusAfter = focusAfter->d_func()->focusNext));
- if (topLevel && newParent) {
- QGraphicsWidget *last = topLevel->d_func()->focusPrev;
- // link last with new chain
- last->d_func()->focusNext = q;
- focusPrev = last;
+ if (!parent && oldScene && oldScene != newScene && oldScene->d_func()->tabFocusFirst == q) {
+ // detach from old scene's top level focus chain.
+ oldScene->d_func()->tabFocusFirst = (focusAfter != q) ? focusAfter : 0;
+ }
- // link last in chain with
- topLevel->d_func()->focusPrev = n;
- n->d_func()->focusNext = topLevel;
+ // detach from current focus chain; skip this widget subtree.
+ focusBefore->d_func()->focusNext = focusAfter;
+ focusAfter->d_func()->focusPrev = focusBefore;
+
+ if (newParent) {
+ // attach to new parent's focus chain as the last element
+ // in its chain.
+ QGraphicsWidget *newFocusFirst = newParent;
+ QGraphicsWidget *newFocusLast = newFocusFirst;
+ QGraphicsWidget *newFocusAfter = newFocusFirst->d_func()->focusNext;
+ do {
+ if (!newParent->isAncestorOf(newFocusAfter))
+ break;
+ newFocusLast = newFocusAfter;
+ } while ((newFocusAfter = newFocusAfter->d_func()->focusNext));
+
+ newFocusLast->d_func()->focusNext = q;
+ focusLast->d_func()->focusNext = newFocusAfter;
+ newFocusAfter->d_func()->focusPrev = focusLast;
+ focusPrev = newFocusLast;
} else {
- // q is the start of the focus chain
- n->d_func()->focusNext = q;
- focusPrev = n;
+ // no new parent, so just link up our own prev->last widgets.
+ focusPrev = focusLast;
+ focusLast->d_func()->focusNext = q;
}
-
}
void QGraphicsWidgetPrivate::setLayout_helper(QGraphicsLayout *l)
diff --git a/src/widgets/graphicsview/qgraphicswidget_p.h b/src/widgets/graphicsview/qgraphicswidget_p.h
index d0d3fe3b22..759d8561b0 100644
--- a/src/widgets/graphicsview/qgraphicswidget_p.h
+++ b/src/widgets/graphicsview/qgraphicswidget_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/graphicsview/qgridlayoutengine.cpp b/src/widgets/graphicsview/qgridlayoutengine.cpp
index cfb4ae3e3e..b80612bc47 100644
--- a/src/widgets/graphicsview/qgridlayoutengine.cpp
+++ b/src/widgets/graphicsview/qgridlayoutengine.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/graphicsview/qgridlayoutengine_p.h b/src/widgets/graphicsview/qgridlayoutengine_p.h
index 34f6940e23..fbc5bd6ad2 100644
--- a/src/widgets/graphicsview/qgridlayoutengine_p.h
+++ b/src/widgets/graphicsview/qgridlayoutengine_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/graphicsview/qsimplex_p.cpp b/src/widgets/graphicsview/qsimplex_p.cpp
index ec665498a8..a2437d8ab1 100644
--- a/src/widgets/graphicsview/qsimplex_p.cpp
+++ b/src/widgets/graphicsview/qsimplex_p.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/graphicsview/qsimplex_p.h b/src/widgets/graphicsview/qsimplex_p.h
index 692e2e7155..842044fa7f 100644
--- a/src/widgets/graphicsview/qsimplex_p.h
+++ b/src/widgets/graphicsview/qsimplex_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/itemviews/qabstractitemdelegate.cpp b/src/widgets/itemviews/qabstractitemdelegate.cpp
index 4c73cf71a5..7786a74cc6 100644
--- a/src/widgets/itemviews/qabstractitemdelegate.cpp
+++ b/src/widgets/itemviews/qabstractitemdelegate.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/itemviews/qabstractitemdelegate.h b/src/widgets/itemviews/qabstractitemdelegate.h
index 28635b0595..13e4f06687 100644
--- a/src/widgets/itemviews/qabstractitemdelegate.h
+++ b/src/widgets/itemviews/qabstractitemdelegate.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -45,8 +45,6 @@
#include <QtCore/qobject.h>
#include <QtWidgets/qstyleoption.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -131,6 +129,4 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QABSTRACTITEMDELEGATE_H
diff --git a/src/widgets/itemviews/qabstractitemview.cpp b/src/widgets/itemviews/qabstractitemview.cpp
index fa873b63a5..70c8f44a73 100644
--- a/src/widgets/itemviews/qabstractitemview.cpp
+++ b/src/widgets/itemviews/qabstractitemview.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -63,7 +63,7 @@
#include <private/qabstractitemmodel_p.h>
#ifndef QT_NO_ACCESSIBILITY
#include <qaccessible.h>
-#include <qaccessible2.h>
+#include <private/qaccessible2_p.h>
#endif
#ifndef QT_NO_GESTURES
# include <qscroller.h>
@@ -1853,7 +1853,8 @@ void QAbstractItemView::mouseReleaseEvent(QMouseEvent *event)
QStyleOptionViewItem option = d->viewOptions();
if (d->pressedAlreadySelected)
option.state |= QStyle::State_Selected;
- if (style()->styleHint(QStyle::SH_ItemView_ActivateItemOnSingleClick, &option, this))
+ if ((model()->flags(index) & Qt::ItemIsEnabled)
+ && style()->styleHint(QStyle::SH_ItemView_ActivateItemOnSingleClick, &option, this))
emit activated(index);
}
}
@@ -3816,13 +3817,31 @@ QItemSelectionModel::SelectionFlags QAbstractItemView::selectionCommand(const QM
const QEvent *event) const
{
Q_D(const QAbstractItemView);
+ Qt::KeyboardModifiers keyModifiers = Qt::NoModifier;
+ if (event) {
+ switch (event->type()) {
+ case QEvent::MouseButtonDblClick:
+ case QEvent::MouseButtonPress:
+ case QEvent::MouseButtonRelease:
+ case QEvent::MouseMove:
+ case QEvent::KeyPress:
+ case QEvent::KeyRelease:
+ keyModifiers = (static_cast<const QInputEvent*>(event))->modifiers();
+ break;
+ default:
+ keyModifiers = QApplication::keyboardModifiers();
+ }
+ }
switch (d->selectionMode) {
case NoSelection: // Never update selection model
return QItemSelectionModel::NoUpdate;
case SingleSelection: // ClearAndSelect on valid index otherwise NoUpdate
if (event && event->type() == QEvent::MouseButtonRelease)
return QItemSelectionModel::NoUpdate;
- return QItemSelectionModel::ClearAndSelect|d->selectionBehaviorFlags();
+ if ((keyModifiers & Qt::ControlModifier) && d->selectionModel->isSelected(index))
+ return QItemSelectionModel::Deselect | d->selectionBehaviorFlags();
+ else
+ return QItemSelectionModel::ClearAndSelect | d->selectionBehaviorFlags();
case MultiSelection:
return d->multiSelectionCommand(index, event);
case ExtendedSelection:
diff --git a/src/widgets/itemviews/qabstractitemview.h b/src/widgets/itemviews/qabstractitemview.h
index ad5e1de562..96428515ae 100644
--- a/src/widgets/itemviews/qabstractitemview.h
+++ b/src/widgets/itemviews/qabstractitemview.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -47,8 +47,6 @@
#include <QtCore/qitemselectionmodel.h>
#include <QtWidgets/qabstractitemdelegate.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -376,6 +374,4 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(QAbstractItemView::EditTriggers)
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QABSTRACTITEMVIEW_H
diff --git a/src/widgets/itemviews/qabstractitemview_p.h b/src/widgets/itemviews/qabstractitemview_p.h
index c7b807cf5f..86eab174ed 100644
--- a/src/widgets/itemviews/qabstractitemview_p.h
+++ b/src/widgets/itemviews/qabstractitemview_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/itemviews/qbsptree.cpp b/src/widgets/itemviews/qbsptree.cpp
index c0be07e3c1..a4da0b73fd 100644
--- a/src/widgets/itemviews/qbsptree.cpp
+++ b/src/widgets/itemviews/qbsptree.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/itemviews/qbsptree_p.h b/src/widgets/itemviews/qbsptree_p.h
index 4d652193eb..3210efbd3d 100644
--- a/src/widgets/itemviews/qbsptree_p.h
+++ b/src/widgets/itemviews/qbsptree_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/itemviews/qcolumnview.cpp b/src/widgets/itemviews/qcolumnview.cpp
index 0951626a41..5aee78fab4 100644
--- a/src/widgets/itemviews/qcolumnview.cpp
+++ b/src/widgets/itemviews/qcolumnview.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/itemviews/qcolumnview.h b/src/widgets/itemviews/qcolumnview.h
index a340be0823..a13433bb2d 100644
--- a/src/widgets/itemviews/qcolumnview.h
+++ b/src/widgets/itemviews/qcolumnview.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -44,8 +44,6 @@
#include <QtWidgets/qabstractitemview.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -116,7 +114,5 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QCOLUMNVIEW_H
diff --git a/src/widgets/itemviews/qcolumnview_p.h b/src/widgets/itemviews/qcolumnview_p.h
index b25f690165..3d54c9098a 100644
--- a/src/widgets/itemviews/qcolumnview_p.h
+++ b/src/widgets/itemviews/qcolumnview_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/itemviews/qcolumnviewgrip.cpp b/src/widgets/itemviews/qcolumnviewgrip.cpp
index f93965f49f..614916dc61 100644
--- a/src/widgets/itemviews/qcolumnviewgrip.cpp
+++ b/src/widgets/itemviews/qcolumnviewgrip.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/itemviews/qcolumnviewgrip_p.h b/src/widgets/itemviews/qcolumnviewgrip_p.h
index 9d57231c30..c508c58c5b 100644
--- a/src/widgets/itemviews/qcolumnviewgrip_p.h
+++ b/src/widgets/itemviews/qcolumnviewgrip_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/itemviews/qdatawidgetmapper.cpp b/src/widgets/itemviews/qdatawidgetmapper.cpp
index 9ba0e2a102..e5b7e810fb 100644
--- a/src/widgets/itemviews/qdatawidgetmapper.cpp
+++ b/src/widgets/itemviews/qdatawidgetmapper.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/itemviews/qdatawidgetmapper.h b/src/widgets/itemviews/qdatawidgetmapper.h
index d65d06a4ab..b8742196b2 100644
--- a/src/widgets/itemviews/qdatawidgetmapper.h
+++ b/src/widgets/itemviews/qdatawidgetmapper.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -46,8 +46,6 @@
#ifndef QT_NO_DATAWIDGETMAPPER
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -120,8 +118,6 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QT_NO_DATAWIDGETMAPPER
#endif
diff --git a/src/widgets/itemviews/qdirmodel.cpp b/src/widgets/itemviews/qdirmodel.cpp
index fcf8c92a7b..e1ba0ede57 100644
--- a/src/widgets/itemviews/qdirmodel.cpp
+++ b/src/widgets/itemviews/qdirmodel.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/itemviews/qdirmodel.h b/src/widgets/itemviews/qdirmodel.h
index 6ecd9a3990..c0214395ef 100644
--- a/src/widgets/itemviews/qdirmodel.h
+++ b/src/widgets/itemviews/qdirmodel.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -46,8 +46,6 @@
#include <QtCore/qdir.h>
#include <QtWidgets/qfileiconprovider.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -154,6 +152,4 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QDIRMODEL_H
diff --git a/src/widgets/itemviews/qfileiconprovider.cpp b/src/widgets/itemviews/qfileiconprovider.cpp
index b016fcdffe..8a0736ec70 100644
--- a/src/widgets/itemviews/qfileiconprovider.cpp
+++ b/src/widgets/itemviews/qfileiconprovider.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/itemviews/qfileiconprovider.h b/src/widgets/itemviews/qfileiconprovider.h
index a7a7d508ce..cac135fe71 100644
--- a/src/widgets/itemviews/qfileiconprovider.h
+++ b/src/widgets/itemviews/qfileiconprovider.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -46,8 +46,6 @@
#include <QtCore/qscopedpointer.h>
#include <QtGui/qicon.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -75,7 +73,5 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QFILEICONPROVIDER_H
diff --git a/src/widgets/itemviews/qheaderview.cpp b/src/widgets/itemviews/qheaderview.cpp
index 5599d251a1..edfbc5c8f1 100644
--- a/src/widgets/itemviews/qheaderview.cpp
+++ b/src/widgets/itemviews/qheaderview.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/itemviews/qheaderview.h b/src/widgets/itemviews/qheaderview.h
index 4e2b7d24c6..8fcd8d7a36 100644
--- a/src/widgets/itemviews/qheaderview.h
+++ b/src/widgets/itemviews/qheaderview.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -44,8 +44,6 @@
#include <QtWidgets/qabstractitemview.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -263,6 +261,4 @@ inline void QHeaderView::showSection(int alogicalIndex)
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QHEADERVIEW_H
diff --git a/src/widgets/itemviews/qheaderview_p.h b/src/widgets/itemviews/qheaderview_p.h
index 4abca63519..7fda0c8873 100644
--- a/src/widgets/itemviews/qheaderview_p.h
+++ b/src/widgets/itemviews/qheaderview_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/itemviews/qitemdelegate.cpp b/src/widgets/itemviews/qitemdelegate.cpp
index 98687313ed..f2c3c4702f 100644
--- a/src/widgets/itemviews/qitemdelegate.cpp
+++ b/src/widgets/itemviews/qitemdelegate.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/itemviews/qitemdelegate.h b/src/widgets/itemviews/qitemdelegate.h
index 17b0e94625..2866a4bb8b 100644
--- a/src/widgets/itemviews/qitemdelegate.h
+++ b/src/widgets/itemviews/qitemdelegate.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -47,8 +47,6 @@
#include <QtGui/qpixmap.h>
#include <QtCore/qvariant.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -135,6 +133,4 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QITEMDELEGATE_H
diff --git a/src/widgets/itemviews/qitemeditorfactory.cpp b/src/widgets/itemviews/qitemeditorfactory.cpp
index 99e8c2e36e..b3ef21e3e5 100644
--- a/src/widgets/itemviews/qitemeditorfactory.cpp
+++ b/src/widgets/itemviews/qitemeditorfactory.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/itemviews/qitemeditorfactory.h b/src/widgets/itemviews/qitemeditorfactory.h
index f52f4c5b64..9affe14925 100644
--- a/src/widgets/itemviews/qitemeditorfactory.h
+++ b/src/widgets/itemviews/qitemeditorfactory.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -47,8 +47,6 @@
#include <QtCore/qhash.h>
#include <QtCore/qvariant.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -118,6 +116,4 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QITEMEDITORFACTORY_H
diff --git a/src/widgets/itemviews/qitemeditorfactory_p.h b/src/widgets/itemviews/qitemeditorfactory_p.h
index ca4334e015..c652da764c 100644
--- a/src/widgets/itemviews/qitemeditorfactory_p.h
+++ b/src/widgets/itemviews/qitemeditorfactory_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/itemviews/qlistview.cpp b/src/widgets/itemviews/qlistview.cpp
index 6198953857..8ccb0557cb 100644
--- a/src/widgets/itemviews/qlistview.cpp
+++ b/src/widgets/itemviews/qlistview.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/itemviews/qlistview.h b/src/widgets/itemviews/qlistview.h
index a7164142dd..e4ae2d03fd 100644
--- a/src/widgets/itemviews/qlistview.h
+++ b/src/widgets/itemviews/qlistview.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -44,8 +44,6 @@
#include <QtWidgets/qabstractitemview.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -193,6 +191,4 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QLISTVIEW_H
diff --git a/src/widgets/itemviews/qlistview_p.h b/src/widgets/itemviews/qlistview_p.h
index 8d6f7f864a..35d11140ef 100644
--- a/src/widgets/itemviews/qlistview_p.h
+++ b/src/widgets/itemviews/qlistview_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/itemviews/qlistwidget.cpp b/src/widgets/itemviews/qlistwidget.cpp
index 7de571f59b..39d03124ce 100644
--- a/src/widgets/itemviews/qlistwidget.cpp
+++ b/src/widgets/itemviews/qlistwidget.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/itemviews/qlistwidget.h b/src/widgets/itemviews/qlistwidget.h
index 1a8c56c907..a7f993d25c 100644
--- a/src/widgets/itemviews/qlistwidget.h
+++ b/src/widgets/itemviews/qlistwidget.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -47,8 +47,6 @@
#include <QtCore/qvector.h>
#include <QtCore/qitemselectionmodel.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -329,6 +327,4 @@ inline bool QListWidgetItem::isHidden() const
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QLISTWIDGET_H
diff --git a/src/widgets/itemviews/qlistwidget_p.h b/src/widgets/itemviews/qlistwidget_p.h
index 22a3d8ea88..2181a77fcb 100644
--- a/src/widgets/itemviews/qlistwidget_p.h
+++ b/src/widgets/itemviews/qlistwidget_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/itemviews/qstyleditemdelegate.cpp b/src/widgets/itemviews/qstyleditemdelegate.cpp
index 540ea27b88..e92ccc2455 100644
--- a/src/widgets/itemviews/qstyleditemdelegate.cpp
+++ b/src/widgets/itemviews/qstyleditemdelegate.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/itemviews/qstyleditemdelegate.h b/src/widgets/itemviews/qstyleditemdelegate.h
index 8aa056d769..aeb25a55b7 100644
--- a/src/widgets/itemviews/qstyleditemdelegate.h
+++ b/src/widgets/itemviews/qstyleditemdelegate.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -47,8 +47,6 @@
#include <QtGui/qpixmap.h>
#include <QtCore/qvariant.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -110,6 +108,4 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QSTYLEDITEMDELEGATE_H
diff --git a/src/widgets/itemviews/qtableview.cpp b/src/widgets/itemviews/qtableview.cpp
index 3f19a0fb1f..38e4a0bf9b 100644
--- a/src/widgets/itemviews/qtableview.cpp
+++ b/src/widgets/itemviews/qtableview.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/itemviews/qtableview.h b/src/widgets/itemviews/qtableview.h
index 8f4c73d9f1..824348dbe8 100644
--- a/src/widgets/itemviews/qtableview.h
+++ b/src/widgets/itemviews/qtableview.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -44,8 +44,6 @@
#include <QtWidgets/qabstractitemview.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -192,6 +190,4 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QTABLEVIEW_H
diff --git a/src/widgets/itemviews/qtableview_p.h b/src/widgets/itemviews/qtableview_p.h
index 5cd970b684..923beec253 100644
--- a/src/widgets/itemviews/qtableview_p.h
+++ b/src/widgets/itemviews/qtableview_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/itemviews/qtablewidget.cpp b/src/widgets/itemviews/qtablewidget.cpp
index ca92c3687a..d56314b23d 100644
--- a/src/widgets/itemviews/qtablewidget.cpp
+++ b/src/widgets/itemviews/qtablewidget.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/itemviews/qtablewidget.h b/src/widgets/itemviews/qtablewidget.h
index 6d9da27fdf..fba76129a7 100644
--- a/src/widgets/itemviews/qtablewidget.h
+++ b/src/widgets/itemviews/qtablewidget.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -47,8 +47,6 @@
#include <QtCore/qvector.h>
//#include <QtWidgets/qitemselectionmodel.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -371,6 +369,4 @@ inline bool QTableWidgetItem::isSelected() const
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QTABLEWIDGET_H
diff --git a/src/widgets/itemviews/qtablewidget_p.h b/src/widgets/itemviews/qtablewidget_p.h
index a6b33bd5bb..43eb56a4a5 100644
--- a/src/widgets/itemviews/qtablewidget_p.h
+++ b/src/widgets/itemviews/qtablewidget_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/itemviews/qtreeview.cpp b/src/widgets/itemviews/qtreeview.cpp
index 6046ef50a5..a15e050939 100644
--- a/src/widgets/itemviews/qtreeview.cpp
+++ b/src/widgets/itemviews/qtreeview.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -52,9 +52,10 @@
#include <qevent.h>
#include <qpen.h>
#include <qdebug.h>
+#include <QMetaMethod>
#ifndef QT_NO_ACCESSIBILITY
#include <qaccessible.h>
-#include <qaccessible2.h>
+#include <private/qaccessible2_p.h>
#endif
#include <private/qtreeview_p.h>
@@ -749,6 +750,8 @@ void QTreeView::expand(const QModelIndex &index)
Q_D(QTreeView);
if (!d->isIndexValid(index))
return;
+ if (index.flags() & Qt::ItemNeverHasChildren)
+ return;
if (d->delayedPendingLayout) {
//A complete relayout is going to be performed, just store the expanded index, no need to layout.
if (d->storeExpanded(index))
@@ -2644,7 +2647,17 @@ void QTreeView::expandAll()
void QTreeView::collapseAll()
{
Q_D(QTreeView);
+ QSet<QPersistentModelIndex> old_expandedIndexes;
+ old_expandedIndexes = d->expandedIndexes;
d->expandedIndexes.clear();
+ if (!signalsBlocked() && isSignalConnected(QMetaMethod::fromSignal(&QTreeView::collapsed))) {
+ QSet<QPersistentModelIndex>::const_iterator i = old_expandedIndexes.constBegin();
+ for (; i != old_expandedIndexes.constEnd(); ++i) {
+ const QPersistentModelIndex &mi = (*i);
+ if (mi.isValid() && !(mi.flags() & Qt::ItemNeverHasChildren))
+ emit collapsed(mi);
+ }
+ }
doItemsLayout();
}
@@ -2658,6 +2671,8 @@ void QTreeView::expandToDepth(int depth)
{
Q_D(QTreeView);
d->viewItems.clear();
+ QSet<QPersistentModelIndex> old_expandedIndexes;
+ old_expandedIndexes = d->expandedIndexes;
d->expandedIndexes.clear();
d->interruptDelayedItemsLayout();
d->layout(-1);
@@ -2668,6 +2683,29 @@ void QTreeView::expandToDepth(int depth)
d->storeExpanded(d->viewItems.at(i).index);
}
}
+
+ bool someSignalEnabled = isSignalConnected(QMetaMethod::fromSignal(&QTreeView::collapsed));
+ someSignalEnabled |= isSignalConnected(QMetaMethod::fromSignal(&QTreeView::expanded));
+
+ if (!signalsBlocked() && someSignalEnabled) {
+ // emit signals
+ QSet<QPersistentModelIndex> collapsedIndexes = old_expandedIndexes - d->expandedIndexes;
+ QSet<QPersistentModelIndex>::const_iterator i = collapsedIndexes.constBegin();
+ for (; i != collapsedIndexes.constEnd(); ++i) {
+ const QPersistentModelIndex &mi = (*i);
+ if (mi.isValid() && !(mi.flags() & Qt::ItemNeverHasChildren))
+ emit collapsed(mi);
+ }
+
+ QSet<QPersistentModelIndex> expandedIndexs = d->expandedIndexes - old_expandedIndexes;
+ i = expandedIndexs.constBegin();
+ for (; i != expandedIndexs.constEnd(); ++i) {
+ const QPersistentModelIndex &mi = (*i);
+ if (mi.isValid() && !(mi.flags() & Qt::ItemNeverHasChildren))
+ emit expanded(mi);
+ }
+ }
+
updateGeometries();
d->viewport->update();
}
@@ -2887,6 +2925,9 @@ void QTreeViewPrivate::expand(int item, bool emitSignal)
if (item == -1 || viewItems.at(item).expanded)
return;
+ const QModelIndex index = viewItems.at(item).index;
+ if (index.flags() & Qt::ItemNeverHasChildren)
+ return;
#ifndef QT_NO_ANIMATION
if (emitSignal && animationsEnabled)
@@ -2896,7 +2937,6 @@ void QTreeViewPrivate::expand(int item, bool emitSignal)
if (state != QAbstractItemView::AnimatingState)
stateBeforeAnimation = state;
q->setState(QAbstractItemView::ExpandingState);
- const QModelIndex index = viewItems.at(item).index;
storeExpanded(index);
viewItems[item].expanded = true;
layout(item);
@@ -3189,9 +3229,9 @@ void QTreeViewPrivate::layout(int i, bool recursiveExpanding, bool afterIsUninit
item->expanded = false;
item->total = 0;
item->hasMoreSiblings = false;
- if (recursiveExpanding || isIndexExpanded(current)) {
- if (recursiveExpanding)
- expandedIndexes.insert(current);
+ if ((recursiveExpanding && !(current.flags() & Qt::ItemNeverHasChildren)) || isIndexExpanded(current)) {
+ if (recursiveExpanding && storeExpanded(current) && !q->signalsBlocked())
+ emit q->expanded(current);
item->expanded = true;
layout(last, recursiveExpanding, afterIsUninitialized);
item = &viewItems[last];
diff --git a/src/widgets/itemviews/qtreeview.h b/src/widgets/itemviews/qtreeview.h
index 54e580985c..73f11f1a48 100644
--- a/src/widgets/itemviews/qtreeview.h
+++ b/src/widgets/itemviews/qtreeview.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -44,8 +44,6 @@
#include <QtWidgets/qabstractitemview.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -235,6 +233,4 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QTREEVIEW_H
diff --git a/src/widgets/itemviews/qtreeview_p.h b/src/widgets/itemviews/qtreeview_p.h
index 5a0821c9cf..a687d4665d 100644
--- a/src/widgets/itemviews/qtreeview_p.h
+++ b/src/widgets/itemviews/qtreeview_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -203,7 +203,7 @@ public:
inline bool isIndexExpanded(const QModelIndex &idx) const {
//We first check if the idx is a QPersistentModelIndex, because creating QPersistentModelIndex is slow
- return isPersistent(idx) && expandedIndexes.contains(idx);
+ return !(idx.flags() & Qt::ItemNeverHasChildren) && isPersistent(idx) && expandedIndexes.contains(idx);
}
// used when hiding and showing items
diff --git a/src/widgets/itemviews/qtreewidget.cpp b/src/widgets/itemviews/qtreewidget.cpp
index 8e86775a2d..653a9170b2 100644
--- a/src/widgets/itemviews/qtreewidget.cpp
+++ b/src/widgets/itemviews/qtreewidget.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/itemviews/qtreewidget.h b/src/widgets/itemviews/qtreewidget.h
index a16a1cd9c2..7aa927a443 100644
--- a/src/widgets/itemviews/qtreewidget.h
+++ b/src/widgets/itemviews/qtreewidget.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -47,8 +47,6 @@
#include <QtCore/qvariant.h>
#include <QtCore/qvector.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -423,6 +421,4 @@ inline bool QTreeWidgetItem::isDisabled() const
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QTREEWIDGET_H
diff --git a/src/widgets/itemviews/qtreewidget_p.h b/src/widgets/itemviews/qtreewidget_p.h
index be19025ab3..620520bd79 100644
--- a/src/widgets/itemviews/qtreewidget_p.h
+++ b/src/widgets/itemviews/qtreewidget_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/itemviews/qtreewidgetitemiterator.cpp b/src/widgets/itemviews/qtreewidgetitemiterator.cpp
index e8854d8197..f99b3899df 100644
--- a/src/widgets/itemviews/qtreewidgetitemiterator.cpp
+++ b/src/widgets/itemviews/qtreewidgetitemiterator.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -101,7 +101,7 @@ QTreeWidgetItemIterator::QTreeWidgetItemIterator(QTreeWidget *widget, IteratorFl
Q_ASSERT(model);
d_ptr.reset(new QTreeWidgetItemIteratorPrivate(this, model));
model->iterators.append(this);
- if (!model->rootItem->children.isEmpty()) current = model->rootItem->children.first();
+ if (!model->rootItem->children.isEmpty()) current = model->rootItem->child(0);
if (current && !matchesFlags(current))
++(*this);
}
@@ -130,14 +130,13 @@ QTreeWidgetItemIterator::QTreeWidgetItemIterator(QTreeWidgetItem *item, Iterator
// the beginning.
QTreeWidgetItem *parent = item;
parent = parent->parent();
- QList<QTreeWidgetItem *> children = parent ? parent->children : d->m_model->rootItem->children;
- d->m_currentIndex = children.indexOf(item);
+ QTreeWidgetItem *root = d->m_model->rootItem;
+ d->m_currentIndex = (parent ? parent : root)->indexOfChild(item);
while (parent) {
QTreeWidgetItem *itm = parent;
parent = parent->parent();
- QList<QTreeWidgetItem *> children = parent ? parent->children : d->m_model->rootItem->children;
- int index = children.indexOf(itm);
+ const int index = (parent ? parent : root)->indexOfChild(itm);
d->m_parentIndex.prepend(index);
}
diff --git a/src/widgets/itemviews/qtreewidgetitemiterator.h b/src/widgets/itemviews/qtreewidgetitemiterator.h
index ec604e8b1a..01efbc88f2 100644
--- a/src/widgets/itemviews/qtreewidgetitemiterator.h
+++ b/src/widgets/itemviews/qtreewidgetitemiterator.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -45,8 +45,6 @@
#include <QtCore/qglobal.h>
#include <QtCore/qscopedpointer.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -153,6 +151,4 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(QTreeWidgetItemIterator::IteratorFlags)
QT_END_NAMESPACE
#endif // QT_NO_TREEWIDGET
-QT_END_HEADER
-
#endif // QTREEWIDGETITEMITERATOR_H
diff --git a/src/widgets/itemviews/qtreewidgetitemiterator_p.h b/src/widgets/itemviews/qtreewidgetitemiterator_p.h
index d0aff063a5..cf2d32cb62 100644
--- a/src/widgets/itemviews/qtreewidgetitemiterator_p.h
+++ b/src/widgets/itemviews/qtreewidgetitemiterator_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/itemviews/qwidgetitemdata_p.h b/src/widgets/itemviews/qwidgetitemdata_p.h
index 9cdf74048b..a8ab58174f 100644
--- a/src/widgets/itemviews/qwidgetitemdata_p.h
+++ b/src/widgets/itemviews/qwidgetitemdata_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/kernel/kernel.pri b/src/widgets/kernel/kernel.pri
index 4d3d7c4e0a..533b696faa 100644
--- a/src/widgets/kernel/kernel.pri
+++ b/src/widgets/kernel/kernel.pri
@@ -34,7 +34,8 @@ HEADERS += \
kernel/qgesturerecognizer.h \
kernel/qgesturemanager_p.h \
kernel/qdesktopwidget_qpa_p.h \
- kernel/qwidgetwindow_qpa_p.h
+ kernel/qwidgetwindow_qpa_p.h \
+ kernel/qwindowcontainer_p.h
SOURCES += \
kernel/qaction.cpp \
@@ -62,7 +63,8 @@ SOURCES += \
kernel/qapplication_qpa.cpp \
kernel/qdesktopwidget_qpa.cpp \
kernel/qwidget_qpa.cpp \
- kernel/qwidgetwindow.cpp
+ kernel/qwidgetwindow.cpp \
+ kernel/qwindowcontainer.cpp
# TODO
diff --git a/src/widgets/kernel/mac.pri b/src/widgets/kernel/mac.pri
index 5474a41f15..4c507ae80e 100644
--- a/src/widgets/kernel/mac.pri
+++ b/src/widgets/kernel/mac.pri
@@ -1,4 +1,4 @@
-!x11::mac {
+!x11:mac:!ios {
LIBS_PRIVATE += -framework Carbon -framework Cocoa -lz
*-mwerks:INCLUDEPATH += compat
}
diff --git a/src/widgets/kernel/qaction.cpp b/src/widgets/kernel/qaction.cpp
index f01576d92c..267d787116 100644
--- a/src/widgets/kernel/qaction.cpp
+++ b/src/widgets/kernel/qaction.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/kernel/qaction.h b/src/widgets/kernel/qaction.h
index 5fb4c655eb..f2346acfcd 100644
--- a/src/widgets/kernel/qaction.h
+++ b/src/widgets/kernel/qaction.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -48,8 +48,6 @@
#include <QtCore/qvariant.h>
#include <QtGui/qicon.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -221,6 +219,4 @@ QT_END_INCLUDE_NAMESPACE
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QACTION_H
diff --git a/src/widgets/kernel/qaction_p.h b/src/widgets/kernel/qaction_p.h
index d08c42688d..70c9b4ad2b 100644
--- a/src/widgets/kernel/qaction_p.h
+++ b/src/widgets/kernel/qaction_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/kernel/qactiongroup.cpp b/src/widgets/kernel/qactiongroup.cpp
index 4e19f116bb..8f1b01eca5 100644
--- a/src/widgets/kernel/qactiongroup.cpp
+++ b/src/widgets/kernel/qactiongroup.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/kernel/qactiongroup.h b/src/widgets/kernel/qactiongroup.h
index 13c5ea8ef1..eab1d8bd43 100644
--- a/src/widgets/kernel/qactiongroup.h
+++ b/src/widgets/kernel/qactiongroup.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -44,8 +44,6 @@
#include <QtWidgets/qaction.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -99,6 +97,4 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QACTIONGROUP_H
diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp
index 7f41e5c576..6dc8c0b6ba 100644
--- a/src/widgets/kernel/qapplication.cpp
+++ b/src/widgets/kernel/qapplication.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -588,8 +588,6 @@ extern void qRegisterWidgetsVariant();
*/
void QApplicationPrivate::initialize()
{
- is_app_running = false; // Starting up.
-
QWidgetPrivate::mapper = new QWidgetMapper;
QWidgetPrivate::allWidgets = new QWidgetSet;
@@ -603,10 +601,10 @@ void QApplicationPrivate::initialize()
qRegisterGuiStateMachine();
#endif
- Q_Q(QApplication);
+ is_app_running = true; // no longer starting up
if (qgetenv("QT_USE_NATIVE_WINDOWS").toInt() > 0)
- q->setAttribute(Qt::AA_NativeWindows);
+ QCoreApplication::setAttribute(Qt::AA_NativeWindows);
#ifdef Q_OS_WINCE
#ifdef QT_AUTO_MAXIMIZE_THRESHOLD
@@ -629,8 +627,6 @@ void QApplicationPrivate::initialize()
if (QApplication::desktopSettingsAware())
if (const QPlatformTheme *theme = QGuiApplicationPrivate::platformTheme())
QApplicationPrivate::enabledAnimations = theme->themeHint(QPlatformTheme::UiEffects).toInt();
-
- is_app_running = true; // no longer starting up
}
/*****************************************************************************
@@ -969,11 +965,7 @@ QStyle *QApplication::style()
// Compile-time search for default style
//
QString style;
-#ifdef QT_BUILD_INTERNAL
QString envStyle = QString::fromLocal8Bit(qgetenv("QT_STYLE_OVERRIDE"));
-#else
- QString envStyle;
-#endif
if (!QApplicationPrivate::styleOverride.isEmpty()) {
style = QApplicationPrivate::styleOverride;
} else if (!envStyle.isEmpty()) {
@@ -2012,7 +2004,8 @@ void QApplication::setActiveWindow(QWidget* act)
* Returns 0 if a new focus widget could not be found.
* Shared with QGraphicsProxyWidgetPrivate::findFocusChild()
*/
-QWidget *QApplicationPrivate::focusNextPrevChild_helper(QWidget *toplevel, bool next)
+QWidget *QApplicationPrivate::focusNextPrevChild_helper(QWidget *toplevel, bool next,
+ bool *wrappingOccurred)
{
uint focus_flag = qt_tab_all_widgets() ? Qt::TabFocus : Qt::StrongFocus;
@@ -2022,18 +2015,29 @@ QWidget *QApplicationPrivate::focusNextPrevChild_helper(QWidget *toplevel, bool
QWidget *w = f;
QWidget *test = f->d_func()->focus_next;
+ bool seenWindow = false;
+ bool focusWidgetAfterWindow = false;
while (test && test != f) {
+ if (test->isWindow())
+ seenWindow = true;
+
if ((test->focusPolicy() & focus_flag) == focus_flag
&& !(test->d_func()->extra && test->d_func()->extra->focus_proxy)
&& test->isVisibleTo(toplevel) && test->isEnabled()
&& !(w->windowType() == Qt::SubWindow && !w->isAncestorOf(test))
&& (toplevel->windowType() != Qt::SubWindow || toplevel->isAncestorOf(test))) {
w = test;
+ if (seenWindow)
+ focusWidgetAfterWindow = true;
if (next)
break;
}
test = test->d_func()->focus_next;
}
+
+ if (wrappingOccurred != 0)
+ *wrappingOccurred = next ? focusWidgetAfterWindow : !focusWidgetAfterWindow;
+
if (w == f) {
if (qt_in_tab_key_event) {
w->window()->setAttribute(Qt::WA_KeyboardFocusChange);
@@ -3562,8 +3566,8 @@ int QApplication::doubleClickInterval()
\since 4.2
\deprecated
- Returns the current keyboard input direction. Replaced with QInputPanel::inputDirection()
- \sa QInputPanel::inputDirection()
+ Returns the current keyboard input direction. Replaced with QInputMethod::inputDirection()
+ \sa QInputMethod::inputDirection()
*/
/*!
@@ -3767,8 +3771,6 @@ private:
bool QApplicationPrivate::translateTouchToMouse(QWidget *widget, QTouchEvent *event)
{
- Q_Q(QApplication);
-
// Check if the platform wants synthesized mouse events.
if (!QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::SynthesizeMouseFromTouchEvents).toBool())
return false;
@@ -3799,7 +3801,7 @@ bool QApplicationPrivate::translateTouchToMouse(QWidget *widget, QTouchEvent *ev
// Note it has to be a spontaneous event if we want the focus management
// and input method support to behave properly. Quite some of the code
// related to those aspect check for the spontaneous flag.
- const bool res = q->sendSpontaneousEvent(widget, &mouseEvent);
+ const bool res = QCoreApplication::sendSpontaneousEvent(widget, &mouseEvent);
event->setAccepted(mouseEvent.isAccepted());
if (mouseEvent.isAccepted())
diff --git a/src/widgets/kernel/qapplication.h b/src/widgets/kernel/qapplication.h
index 29f5ddf455..83673eef4e 100644
--- a/src/widgets/kernel/qapplication.h
+++ b/src/widgets/kernel/qapplication.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -55,8 +55,6 @@
#endif
#include <QtGui/qguiapplication.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -247,6 +245,4 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QAPPLICATION_H
diff --git a/src/widgets/kernel/qapplication_p.h b/src/widgets/kernel/qapplication_p.h
index fbd96366fb..ca1bccb727 100644
--- a/src/widgets/kernel/qapplication_p.h
+++ b/src/widgets/kernel/qapplication_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -165,7 +165,8 @@ public:
void closePopup(QWidget *popup);
void openPopup(QWidget *popup);
static void setFocusWidget(QWidget *focus, Qt::FocusReason reason);
- static QWidget *focusNextPrevChild_helper(QWidget *toplevel, bool next);
+ static QWidget *focusNextPrevChild_helper(QWidget *toplevel, bool next,
+ bool *wrappingOccurred = 0);
#ifndef QT_NO_GRAPHICSVIEW
// Maintain a list of all scenes to ensure font and palette propagation to
diff --git a/src/widgets/kernel/qapplication_qpa.cpp b/src/widgets/kernel/qapplication_qpa.cpp
index 6c3c5de55f..54eb443c43 100644
--- a/src/widgets/kernel/qapplication_qpa.cpp
+++ b/src/widgets/kernel/qapplication_qpa.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/kernel/qboxlayout.cpp b/src/widgets/kernel/qboxlayout.cpp
index c3661f5c50..e1a7903628 100644
--- a/src/widgets/kernel/qboxlayout.cpp
+++ b/src/widgets/kernel/qboxlayout.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -248,7 +248,7 @@ void QBoxLayoutPrivate::effectiveMargins(int *left, int *top, int *right, int *b
if (right)
r = qMax(r, wr.right() - lir.right());
}
- }
+ }
}
#endif
if (left)
@@ -509,7 +509,7 @@ void QBoxLayoutPrivate::calcHfw(int w)
\list
\li setContentsMargins() sets the width of the outer border on
- each side of the widget. This is the width of the reserved space
+ each side of the widget. This is the width of the reserved space
along each of the QBoxLayout's four sides.
\li setSpacing() sets the width between neighboring boxes. (You
can use addSpacing() to get more space at a particular spot.)
@@ -595,7 +595,7 @@ int QBoxLayout::spacing() const
/*!
Reimplements QLayout::setSpacing(). Sets the spacing
- property to \a spacing.
+ property to \a spacing.
\sa QLayout::setSpacing(), spacing()
*/
diff --git a/src/widgets/kernel/qboxlayout.h b/src/widgets/kernel/qboxlayout.h
index 3ced397c1d..4c7b27a4ec 100644
--- a/src/widgets/kernel/qboxlayout.h
+++ b/src/widgets/kernel/qboxlayout.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -49,8 +49,6 @@
#include <limits.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -141,6 +139,4 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QBOXLAYOUT_H
diff --git a/src/widgets/kernel/qdesktopwidget.cpp b/src/widgets/kernel/qdesktopwidget.cpp
index 63b0a3c873..649978a912 100644
--- a/src/widgets/kernel/qdesktopwidget.cpp
+++ b/src/widgets/kernel/qdesktopwidget.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/kernel/qdesktopwidget.h b/src/widgets/kernel/qdesktopwidget.h
index c27e96a2d9..da44242b86 100644
--- a/src/widgets/kernel/qdesktopwidget.h
+++ b/src/widgets/kernel/qdesktopwidget.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -44,8 +44,6 @@
#include <QtWidgets/qwidget.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -104,6 +102,4 @@ inline int QDesktopWidget::screenCount() const
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QDESKTOPWIDGET_H
diff --git a/src/widgets/kernel/qdesktopwidget.qdoc b/src/widgets/kernel/qdesktopwidget.qdoc
index 15ddd3b32f..789a812afb 100644
--- a/src/widgets/kernel/qdesktopwidget.qdoc
+++ b/src/widgets/kernel/qdesktopwidget.qdoc
@@ -120,9 +120,9 @@
/*!
\fn int QDesktopWidget::numScreens() const
-
+
Returns the number of available screens.
-
+
\obsolete
This function is deprecated. Use screenCount instead.
@@ -239,7 +239,7 @@
\brief the number of screens currently available on the system.
\since 4.6
-
+
\sa screenCountChanged()
*/
@@ -265,6 +265,6 @@
\since 4.6
This signal is emitted when the number of screens changes to \a newCount.
-
+
\sa screenCount
*/
diff --git a/src/widgets/kernel/qdesktopwidget_qpa.cpp b/src/widgets/kernel/qdesktopwidget_qpa.cpp
index b71734bebb..64236321a4 100644
--- a/src/widgets/kernel/qdesktopwidget_qpa.cpp
+++ b/src/widgets/kernel/qdesktopwidget_qpa.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/kernel/qdesktopwidget_qpa_p.h b/src/widgets/kernel/qdesktopwidget_qpa_p.h
index 9f0089616b..017934fbf1 100644
--- a/src/widgets/kernel/qdesktopwidget_qpa_p.h
+++ b/src/widgets/kernel/qdesktopwidget_qpa_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -61,9 +61,8 @@ QT_BEGIN_NAMESPACE
class QDesktopScreenWidget : public QWidget {
Q_OBJECT
public:
- QDesktopScreenWidget(int screenNumber = -1)
+ QDesktopScreenWidget(int screenNumber = -1) : QWidget(0, Qt::Desktop)
{
- setWindowFlags(Qt::Desktop);
setVisible(false);
QTLWExtra *topData = d_func()->topData();
topData->screenIndex = screenNumber;
diff --git a/src/widgets/kernel/qformlayout.cpp b/src/widgets/kernel/qformlayout.cpp
index 9388532406..e2d25de537 100644
--- a/src/widgets/kernel/qformlayout.cpp
+++ b/src/widgets/kernel/qformlayout.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/kernel/qformlayout.h b/src/widgets/kernel/qformlayout.h
index a206e90009..d59f71eb32 100644
--- a/src/widgets/kernel/qformlayout.h
+++ b/src/widgets/kernel/qformlayout.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -44,8 +44,6 @@
#include <QtWidgets/QLayout>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -157,6 +155,4 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif
diff --git a/src/widgets/kernel/qgesture.cpp b/src/widgets/kernel/qgesture.cpp
index 24ae437b48..4baeae9021 100644
--- a/src/widgets/kernel/qgesture.cpp
+++ b/src/widgets/kernel/qgesture.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -367,7 +367,7 @@ void QPanGesture::setAcceleration(qreal value)
/*!
\enum QPinchGesture::ChangeFlag
-
+
This enum describes the changes that can occur to the properties of
the gesture object.
diff --git a/src/widgets/kernel/qgesture.h b/src/widgets/kernel/qgesture.h
index 4384600f80..056fc35402 100644
--- a/src/widgets/kernel/qgesture.h
+++ b/src/widgets/kernel/qgesture.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -52,8 +52,6 @@
#ifndef QT_NO_GESTURES
-QT_BEGIN_HEADER
-
Q_DECLARE_METATYPE(Qt::GestureState)
Q_DECLARE_METATYPE(Qt::GestureType)
@@ -328,8 +326,6 @@ private:
QT_END_NAMESPACE
Q_DECLARE_METATYPE(QGesture::GestureCancelPolicy)
-QT_END_HEADER
-
#endif // QT_NO_GESTURES
#endif // QGESTURE_H
diff --git a/src/widgets/kernel/qgesture_p.h b/src/widgets/kernel/qgesture_p.h
index c842e279b5..c041af7317 100644
--- a/src/widgets/kernel/qgesture_p.h
+++ b/src/widgets/kernel/qgesture_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/kernel/qgesturemanager.cpp b/src/widgets/kernel/qgesturemanager.cpp
index 528d6120cf..d90b187bf0 100644
--- a/src/widgets/kernel/qgesturemanager.cpp
+++ b/src/widgets/kernel/qgesturemanager.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/kernel/qgesturemanager_p.h b/src/widgets/kernel/qgesturemanager_p.h
index 5c78932f1d..4ab631a921 100644
--- a/src/widgets/kernel/qgesturemanager_p.h
+++ b/src/widgets/kernel/qgesturemanager_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/kernel/qgesturerecognizer.cpp b/src/widgets/kernel/qgesturerecognizer.cpp
index b6b0e3c1cb..88983e255b 100644
--- a/src/widgets/kernel/qgesturerecognizer.cpp
+++ b/src/widgets/kernel/qgesturerecognizer.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/kernel/qgesturerecognizer.h b/src/widgets/kernel/qgesturerecognizer.h
index b85aa54a6b..a1ce86b50d 100644
--- a/src/widgets/kernel/qgesturerecognizer.h
+++ b/src/widgets/kernel/qgesturerecognizer.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -47,8 +47,6 @@
#ifndef QT_NO_GESTURES
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -94,8 +92,6 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(QGestureRecognizer::Result)
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QT_NO_GESTURES
#endif // QGESTURERECOGNIZER_H
diff --git a/src/widgets/kernel/qgridlayout.cpp b/src/widgets/kernel/qgridlayout.cpp
index fb343264d2..12049f3303 100644
--- a/src/widgets/kernel/qgridlayout.cpp
+++ b/src/widgets/kernel/qgridlayout.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/kernel/qgridlayout.h b/src/widgets/kernel/qgridlayout.h
index 9349c7807d..6a788d9cc8 100644
--- a/src/widgets/kernel/qgridlayout.h
+++ b/src/widgets/kernel/qgridlayout.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -49,8 +49,6 @@
#include <limits.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -132,6 +130,4 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QGRIDLAYOUT_H
diff --git a/src/widgets/kernel/qlayout.cpp b/src/widgets/kernel/qlayout.cpp
index 493a04d2ba..d59a9db75d 100644
--- a/src/widgets/kernel/qlayout.cpp
+++ b/src/widgets/kernel/qlayout.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -1270,7 +1270,7 @@ QRect QLayout::alignmentRect(const QRect &r) const
Removes the widget \a widget from the layout. After this call, it
is the caller's responsibility to give the widget a reasonable
geometry or to put the widget back into a layout.
-
+
\b{Note:} The ownership of \a widget remains the same as
when it was added.
diff --git a/src/widgets/kernel/qlayout.h b/src/widgets/kernel/qlayout.h
index 09ddebeb2a..c293939bd3 100644
--- a/src/widgets/kernel/qlayout.h
+++ b/src/widgets/kernel/qlayout.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -50,8 +50,6 @@
#include <limits.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -171,6 +169,4 @@ QT_END_NAMESPACE
#include <QtWidgets/qboxlayout.h>
#include <QtWidgets/qgridlayout.h>
-QT_END_HEADER
-
#endif // QLAYOUT_H
diff --git a/src/widgets/kernel/qlayout_p.h b/src/widgets/kernel/qlayout_p.h
index e6d96a8253..9321bfc0dc 100644
--- a/src/widgets/kernel/qlayout_p.h
+++ b/src/widgets/kernel/qlayout_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/kernel/qlayoutengine.cpp b/src/widgets/kernel/qlayoutengine.cpp
index 8fb625581b..8800da33b4 100644
--- a/src/widgets/kernel/qlayoutengine.cpp
+++ b/src/widgets/kernel/qlayoutengine.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/kernel/qlayoutengine_p.h b/src/widgets/kernel/qlayoutengine_p.h
index beecf529fb..8a26b389df 100644
--- a/src/widgets/kernel/qlayoutengine_p.h
+++ b/src/widgets/kernel/qlayoutengine_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/kernel/qlayoutitem.cpp b/src/widgets/kernel/qlayoutitem.cpp
index 31276d015d..223bcf1d9b 100644
--- a/src/widgets/kernel/qlayoutitem.cpp
+++ b/src/widgets/kernel/qlayoutitem.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -150,7 +150,7 @@ QSizePolicy::operator QVariant() const
\brief The QWidgetItem class is a layout item that represents a widget.
\inmodule QtWidgets
-
+
Normally, you don't need to use this class directly. Qt's
built-in layout managers provide the following functions for
manipulating widgets in layouts:
@@ -446,20 +446,20 @@ void QWidgetItem::setGeometry(const QRect &rect)
QRect r = !wid->testAttribute(Qt::WA_LayoutUsesWidgetRect)
? fromLayoutItemRect(wid->d_func(), rect)
: rect;
- const QSize widgetRectSurplus = r.size() - rect.size();
-
- /*
- For historical reasons, this code is done using widget rect
- coordinates, not layout item rect coordinates. However,
- QWidgetItem's sizeHint(), maximumSize(), and heightForWidth()
- all work in terms of layout item rect coordinates, so we have to
- add or subtract widgetRectSurplus here and there. The code could
- be much simpler if we did everything using layout item rect
- coordinates and did the conversion right before the call to
- QWidget::setGeometry().
- */
-
- QSize s = r.size().boundedTo(maximumSize() + widgetRectSurplus);
+ const QSize widgetRectSurplus = r.size() - rect.size();
+
+ /*
+ For historical reasons, this code is done using widget rect
+ coordinates, not layout item rect coordinates. However,
+ QWidgetItem's sizeHint(), maximumSize(), and heightForWidth()
+ all work in terms of layout item rect coordinates, so we have to
+ add or subtract widgetRectSurplus here and there. The code could
+ be much simpler if we did everything using layout item rect
+ coordinates and did the conversion right before the call to
+ QWidget::setGeometry().
+ */
+
+ QSize s = r.size().boundedTo(maximumSize() + widgetRectSurplus);
int x = r.x();
int y = r.y();
if (align & (Qt::AlignHorizontal_Mask | Qt::AlignVertical_Mask)) {
@@ -474,8 +474,8 @@ void QWidgetItem::setGeometry(const QRect &rect)
s.setWidth(qMin(s.width(), pref.width()));
if (align & Qt::AlignVertical_Mask) {
if (hasHeightForWidth())
- s.setHeight(qMin(s.height(),
- heightForWidth(s.width() - widgetRectSurplus.width())
+ s.setHeight(qMin(s.height(),
+ heightForWidth(s.width() - widgetRectSurplus.width())
+ widgetRectSurplus.height()));
else
s.setHeight(qMin(s.height(), pref.height()));
diff --git a/src/widgets/kernel/qlayoutitem.h b/src/widgets/kernel/qlayoutitem.h
index b19a7c789f..4af57f1458 100644
--- a/src/widgets/kernel/qlayoutitem.h
+++ b/src/widgets/kernel/qlayoutitem.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -47,12 +47,10 @@
#include <limits.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
-static const int QLAYOUTSIZE_MAX = INT_MAX/256/16;
+static const Q_DECL_UNUSED int QLAYOUTSIZE_MAX = INT_MAX/256/16;
class QLayout;
class QLayoutItem;
@@ -180,6 +178,4 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QLAYOUTITEM_H
diff --git a/src/widgets/kernel/qshortcut.cpp b/src/widgets/kernel/qshortcut.cpp
index 07e22e27e2..f323c682d1 100644
--- a/src/widgets/kernel/qshortcut.cpp
+++ b/src/widgets/kernel/qshortcut.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/kernel/qshortcut.h b/src/widgets/kernel/qshortcut.h
index f5daa381f7..372cd9ff66 100644
--- a/src/widgets/kernel/qshortcut.h
+++ b/src/widgets/kernel/qshortcut.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -45,8 +45,6 @@
#include <QtWidgets/qwidget.h>
#include <QtGui/qkeysequence.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -101,6 +99,4 @@ protected:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QSHORTCUT_H
diff --git a/src/widgets/kernel/qsizepolicy.h b/src/widgets/kernel/qsizepolicy.h
index 0a878674cc..2fe85cbe0c 100644
--- a/src/widgets/kernel/qsizepolicy.h
+++ b/src/widgets/kernel/qsizepolicy.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -44,8 +44,6 @@
#include <QtCore/qobject.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -183,6 +181,4 @@ inline void QSizePolicy::transpose() {
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QSIZEPOLICY_H
diff --git a/src/widgets/kernel/qstackedlayout.cpp b/src/widgets/kernel/qstackedlayout.cpp
index f38f0a6f08..9514877e50 100644
--- a/src/widgets/kernel/qstackedlayout.cpp
+++ b/src/widgets/kernel/qstackedlayout.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/kernel/qstackedlayout.h b/src/widgets/kernel/qstackedlayout.h
index a8067b5bab..87715d10d8 100644
--- a/src/widgets/kernel/qstackedlayout.h
+++ b/src/widgets/kernel/qstackedlayout.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -44,8 +44,6 @@
#include <QtWidgets/qlayout.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -111,6 +109,4 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QSTACKEDLAYOUT_H
diff --git a/src/widgets/kernel/qstandardgestures.cpp b/src/widgets/kernel/qstandardgestures.cpp
index 98fdfb4b75..e3131e7e56 100644
--- a/src/widgets/kernel/qstandardgestures.cpp
+++ b/src/widgets/kernel/qstandardgestures.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/kernel/qstandardgestures_p.h b/src/widgets/kernel/qstandardgestures_p.h
index 61645f364a..70cd241ab4 100644
--- a/src/widgets/kernel/qstandardgestures_p.h
+++ b/src/widgets/kernel/qstandardgestures_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/kernel/qt_widgets_pch.h b/src/widgets/kernel/qt_widgets_pch.h
index 144a5913cf..9e16d8f19e 100644
--- a/src/widgets/kernel/qt_widgets_pch.h
+++ b/src/widgets/kernel/qt_widgets_pch.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/kernel/qtooltip.cpp b/src/widgets/kernel/qtooltip.cpp
index 69dd1f9e63..864ed6a555 100644
--- a/src/widgets/kernel/qtooltip.cpp
+++ b/src/widgets/kernel/qtooltip.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/kernel/qtooltip.h b/src/widgets/kernel/qtooltip.h
index 3a09803598..25b138b855 100644
--- a/src/widgets/kernel/qtooltip.h
+++ b/src/widgets/kernel/qtooltip.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -44,8 +44,6 @@
#include <QtWidgets/qwidget.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -72,6 +70,4 @@ public:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QTOOLTIP_H
diff --git a/src/widgets/kernel/qwhatsthis.cpp b/src/widgets/kernel/qwhatsthis.cpp
index 1152ef4f8d..b96bd024cb 100644
--- a/src/widgets/kernel/qwhatsthis.cpp
+++ b/src/widgets/kernel/qwhatsthis.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/kernel/qwhatsthis.h b/src/widgets/kernel/qwhatsthis.h
index 7e41e5ab58..37887b8cd5 100644
--- a/src/widgets/kernel/qwhatsthis.h
+++ b/src/widgets/kernel/qwhatsthis.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -45,8 +45,6 @@
#include <QtCore/qobject.h>
#include <QtGui/qcursor.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -74,6 +72,4 @@ public:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QWHATSTHIS_H
diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp
index f82d33f283..3e1e0f592c 100644
--- a/src/widgets/kernel/qwidget.cpp
+++ b/src/widgets/kernel/qwidget.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -354,6 +354,7 @@ void QWidgetPrivate::updateWidgetTransform()
QPoint p = q->mapTo(q->topLevelWidget(), QPoint(0,0));
t.translate(p.x(), p.y());
qApp->inputMethod()->setInputItemTransform(t);
+ qApp->inputMethod()->setInputItemRectangle(q->rect());
}
}
@@ -677,7 +678,7 @@ void QWidget::setAutoFillBackground(bool enabled)
(to move the keyboard focus), and passes on most of the other events to
one of the more specialized handlers above.
- Events and the mechanism used to deliver them are covered in
+ Events and the mechanism used to deliver them are covered in
\l{The Event System}.
\section1 Groups of Functions and Properties
@@ -6137,10 +6138,34 @@ bool QWidget::focusNextPrevChild(bool next)
if (d->extra && d->extra->proxyWidget)
return d->extra->proxyWidget->focusNextPrevChild(next);
#endif
- QWidget *w = QApplicationPrivate::focusNextPrevChild_helper(this, next);
+
+ bool wrappingOccurred = false;
+ QWidget *w = QApplicationPrivate::focusNextPrevChild_helper(this, next,
+ &wrappingOccurred);
if (!w) return false;
- w->setFocus(next ? Qt::TabFocusReason : Qt::BacktabFocusReason);
+ Qt::FocusReason reason = next ? Qt::TabFocusReason : Qt::BacktabFocusReason;
+
+ /* If we are about to wrap the focus chain, give the platform
+ * implementation a chance to alter the wrapping behavior. This is
+ * especially needed when the window is embedded in a window created by
+ * another process.
+ */
+ if (wrappingOccurred) {
+ QWindow *window = windowHandle();
+ if (window != 0) {
+ QWindowPrivate *winp = qt_window_private(window);
+
+ if (winp->platformWindow != 0) {
+ QFocusEvent event(QEvent::FocusIn, reason);
+ event.ignore();
+ winp->platformWindow->windowEvent(&event);
+ if (event.isAccepted()) return true;
+ }
+ }
+ }
+
+ w->setFocus(reason);
return true;
}
@@ -8575,6 +8600,10 @@ void QWidget::focusOutEvent(QFocusEvent *)
{
if (focusPolicy() != Qt::NoFocus || !isWindow())
update();
+
+ // automatically hide the SIP
+ if (qApp->autoSipEnabled() && testAttribute(Qt::WA_InputMethodEnabled))
+ qApp->inputMethod()->hide();
}
/*!
@@ -8797,7 +8826,7 @@ void QWidget::inputMethodEvent(QInputMethodEvent *event)
\a query specifies which property is queried.
- \sa inputMethodEvent(), QInputMethodEven, inputMethodHints
+ \sa inputMethodEvent(), QInputMethodEvent, QInputMethodQueryEvent, inputMethodHints
*/
QVariant QWidget::inputMethodQuery(Qt::InputMethodQuery query) const
{
@@ -9097,7 +9126,7 @@ QLayout *QWidget::layout() const
existing layout manager (returned by layout()) before you can
call setLayout() with the new layout.
- If \a layout is the layout manger on a different widget, setLayout()
+ If \a layout is the layout manager on a different widget, setLayout()
will reparent the layout and make it the layout manager for this widget.
Example:
@@ -9255,7 +9284,7 @@ int QWidget::heightForWidth(int w) const
\since 5.0
Returns true if the widget's preferred height depends on its width; otherwise returns false.
-*/
+*/
bool QWidget::hasHeightForWidth() const
{
Q_D(const QWidget);
diff --git a/src/widgets/kernel/qwidget.h b/src/widgets/kernel/qwidget.h
index 25dac1ed5e..5c844d1566 100644
--- a/src/widgets/kernel/qwidget.h
+++ b/src/widgets/kernel/qwidget.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -60,8 +60,6 @@
#include <QtGui/qevent.h>
#endif
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -593,6 +591,8 @@ public:
QWindow *windowHandle() const;
+ static QWidget *createWindowContainer(QWindow *window, QWidget *parent=0, Qt::WindowFlags flags=0);
+
friend class QDesktopScreenWidget;
Q_SIGNALS:
@@ -855,6 +855,4 @@ inline bool QWidget::testAttribute(Qt::WidgetAttribute attribute) const
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QWIDGET_H
diff --git a/src/widgets/kernel/qwidget_p.h b/src/widgets/kernel/qwidget_p.h
index 37f295bc9f..50f32af8b0 100644
--- a/src/widgets/kernel/qwidget_p.h
+++ b/src/widgets/kernel/qwidget_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/kernel/qwidget_qpa.cpp b/src/widgets/kernel/qwidget_qpa.cpp
index 2ffe9c5de5..1374d25cef 100644
--- a/src/widgets/kernel/qwidget_qpa.cpp
+++ b/src/widgets/kernel/qwidget_qpa.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -877,7 +877,12 @@ void QWidgetPrivate::createTLSysExtra()
extra->topextra->window->setMinimumSize(QSize(extra->minw, extra->minh));
if (extra->maxw != QWIDGETSIZE_MAX || extra->maxh != QWIDGETSIZE_MAX)
extra->topextra->window->setMaximumSize(QSize(extra->maxw, extra->maxh));
+#ifdef Q_OS_WIN
+ if (q->inherits("QTipLabel") || q->inherits("QAlphaWidget"))
+ extra->topextra->window->setProperty("_q_windowsDropShadow", QVariant(true));
+#endif
}
+
}
void QWidgetPrivate::deleteTLSysExtra()
@@ -989,6 +994,12 @@ static inline void applyCursor(QWidget *w, QCursor c)
window->setCursor(c);
}
+static inline void unsetCursor(QWidget *w)
+{
+ if (QWindow *window = w->windowHandle())
+ window->unsetCursor();
+}
+
void qt_qpa_set_cursor(QWidget *w, bool force)
{
if (!w->testAttribute(Qt::WA_WState_Created))
@@ -1022,11 +1033,11 @@ void qt_qpa_set_cursor(QWidget *w, bool force)
else
// Enforce the windows behavior of clearing the cursor on
// disabled widgets.
- applyCursor(nativeParent, Qt::ArrowCursor);
+ unsetCursor(nativeParent);
} else {
- applyCursor(nativeParent, Qt::ArrowCursor);
+ unsetCursor(nativeParent);
}
}
-#endif //QT_NO_CURSOR
+#endif //QT_NO_CURSOR
QT_END_NAMESPACE
diff --git a/src/widgets/kernel/qwidgetaction.cpp b/src/widgets/kernel/qwidgetaction.cpp
index fc82fd09f2..7ccb4e2a5c 100644
--- a/src/widgets/kernel/qwidgetaction.cpp
+++ b/src/widgets/kernel/qwidgetaction.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/kernel/qwidgetaction.h b/src/widgets/kernel/qwidgetaction.h
index 14f1bfaf7f..7fc24bab9b 100644
--- a/src/widgets/kernel/qwidgetaction.h
+++ b/src/widgets/kernel/qwidgetaction.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -44,8 +44,6 @@
#include <QtWidgets/qaction.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -61,13 +59,13 @@ class Q_WIDGETS_EXPORT QWidgetAction : public QAction
public:
explicit QWidgetAction(QObject *parent);
virtual ~QWidgetAction();
-
+
void setDefaultWidget(QWidget *w);
QWidget *defaultWidget() const;
QWidget *requestWidget(QWidget *parent);
void releaseWidget(QWidget *widget);
-
+
protected:
virtual bool event(QEvent *);
virtual bool eventFilter(QObject *, QEvent *);
@@ -85,6 +83,4 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QWIDGETACTION_H
diff --git a/src/widgets/kernel/qwidgetaction_p.h b/src/widgets/kernel/qwidgetaction_p.h
index a95fe07534..8f591bf320 100644
--- a/src/widgets/kernel/qwidgetaction_p.h
+++ b/src/widgets/kernel/qwidgetaction_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -66,7 +66,7 @@ public:
QList<QWidget *> createdWidgets;
uint defaultWidgetInUse : 1;
uint autoCreated : 1; // created by QToolBar::addWidget and the like
-
+
inline void _q_widgetDestroyed(QObject *o) {
createdWidgets.removeAll(static_cast<QWidget *>(o));
}
diff --git a/src/widgets/kernel/qwidgetbackingstore.cpp b/src/widgets/kernel/qwidgetbackingstore.cpp
index 294ef9f28c..02fa80bef6 100644
--- a/src/widgets/kernel/qwidgetbackingstore.cpp
+++ b/src/widgets/kernel/qwidgetbackingstore.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/kernel/qwidgetbackingstore_p.h b/src/widgets/kernel/qwidgetbackingstore_p.h
index 00016a8e7d..39583c8caa 100644
--- a/src/widgets/kernel/qwidgetbackingstore_p.h
+++ b/src/widgets/kernel/qwidgetbackingstore_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/kernel/qwidgetsfunctions_wince.h b/src/widgets/kernel/qwidgetsfunctions_wince.h
index 5d3640ae75..ca742e296a 100644
--- a/src/widgets/kernel/qwidgetsfunctions_wince.h
+++ b/src/widgets/kernel/qwidgetsfunctions_wince.h
@@ -40,14 +40,15 @@
****************************************************************************/
#ifndef QWIDGETSFUNCTIONS_WCE_H
#define QWIDGETSFUNCTIONS_WCE_H
+
+#include <QtCore/qglobal.h>
+
#ifdef Q_OS_WINCE
#include <QtCore/qfunctions_wince.h>
#ifdef QT_BUILD_GUI_LIB
-QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
QT_END_NAMESPACE
-QT_END_HEADER
#endif
diff --git a/src/widgets/kernel/qwidgetsvariant.cpp b/src/widgets/kernel/qwidgetsvariant.cpp
index b5b5999c2b..5ac46c1f59 100644
--- a/src/widgets/kernel/qwidgetsvariant.cpp
+++ b/src/widgets/kernel/qwidgetsvariant.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/kernel/qwidgetwindow.cpp b/src/widgets/kernel/qwidgetwindow.cpp
index 50b61beb05..ddb570d6c7 100644
--- a/src/widgets/kernel/qwidgetwindow.cpp
+++ b/src/widgets/kernel/qwidgetwindow.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -52,6 +52,8 @@
QT_BEGIN_NAMESPACE
+Q_WIDGETS_EXPORT extern bool qt_tab_all_widgets();
+
QWidget *qt_button_down = 0; // widget got last button-down
static QWidget *qt_tablet_target = 0;
@@ -123,6 +125,8 @@ bool QWidgetWindow::event(QEvent *event)
// these should not be sent to QWidget, the corresponding events
// are sent by QApplicationPrivate::notifyActiveWindowChange()
case QEvent::FocusIn:
+ handleFocusInEvent(static_cast<QFocusEvent *>(event));
+ // Fallthrough
case QEvent::FocusOut: {
#ifndef QT_NO_ACCESSIBILITY
QAccessible::State state;
@@ -284,6 +288,42 @@ void QWidgetWindow::handleEnterLeaveEvent(QEvent *event)
}
}
+QWidget *QWidgetWindow::getFocusWidget(FocusWidgets fw)
+{
+ QWidget *tlw = m_widget;
+ QWidget *w = tlw->nextInFocusChain();
+
+ QWidget *last = tlw;
+
+ uint focus_flag = qt_tab_all_widgets() ? Qt::TabFocus : Qt::StrongFocus;
+
+ while (w != tlw)
+ {
+ if (((w->focusPolicy() & focus_flag) == focus_flag)
+ && w->isVisibleTo(m_widget) && w->isEnabled())
+ {
+ last = w;
+ if (fw == FirstFocusWidget)
+ break;
+ }
+ w = w->nextInFocusChain();
+ }
+
+ return last;
+}
+
+void QWidgetWindow::handleFocusInEvent(QFocusEvent *e)
+{
+ QWidget *focusWidget = 0;
+ if (e->reason() == Qt::BacktabFocusReason)
+ focusWidget = getFocusWidget(LastFocusWidget);
+ else if (e->reason() == Qt::TabFocusReason)
+ focusWidget = getFocusWidget(FirstFocusWidget);
+
+ if (focusWidget != 0)
+ focusWidget->setFocus();
+}
+
void QWidgetWindow::handleNonClientAreaMouseEvent(QMouseEvent *e)
{
QApplication::sendSpontaneousEvent(m_widget, e);
@@ -352,6 +392,27 @@ void QWidgetWindow::handleMouseEvent(QMouseEvent *event)
&& qt_replay_popup_mouse_event) {
if (m_widget->windowType() != Qt::Popup)
qt_button_down = 0;
+ if (event->type() == QEvent::MouseButtonPress) {
+ // the popup disappeared, replay the mouse press event
+ QWidget *w = QApplication::widgetAt(event->globalPos());
+ if (w && !QApplicationPrivate::isBlockedByModal(w)) {
+ // activate window of the widget under mouse pointer
+ if (!w->isActiveWindow()) {
+ w->activateWindow();
+ w->raise();
+ }
+
+ QWindow *win = w->windowHandle();
+ if (!win)
+ win = w->nativeParentWidget()->windowHandle();
+ if (win && win->geometry().contains(event->globalPos())) {
+ const QPoint localPos = win->mapFromGlobal(event->globalPos());
+ QMouseEvent e(QEvent::MouseButtonPress, localPos, localPos, event->globalPos(), event->button(), event->buttons(), event->modifiers());
+ e.setTimestamp(event->timestamp());
+ QApplication::sendSpontaneousEvent(win, &e);
+ }
+ }
+ }
qt_replay_popup_mouse_event = false;
#ifndef QT_NO_CONTEXTMENU
} else if (event->type() == QEvent::MouseButtonPress
diff --git a/src/widgets/kernel/qwidgetwindow_qpa_p.h b/src/widgets/kernel/qwidgetwindow_qpa_p.h
index 7e40ded8c8..cb7bef8f3e 100644
--- a/src/widgets/kernel/qwidgetwindow_qpa_p.h
+++ b/src/widgets/kernel/qwidgetwindow_qpa_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -47,8 +47,6 @@
#include <QtCore/private/qobject_p.h>
#include <QtGui/private/qevent_p.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -72,6 +70,7 @@ protected:
void handleCloseEvent(QCloseEvent *);
void handleEnterLeaveEvent(QEvent *);
+ void handleFocusInEvent(QFocusEvent *);
void handleKeyEvent(QKeyEvent *);
void handleMouseEvent(QMouseEvent *);
void handleNonClientAreaMouseEvent(QMouseEvent *);
@@ -102,6 +101,12 @@ private slots:
private:
void updateGeometry();
+ enum FocusWidgets {
+ FirstFocusWidget,
+ LastFocusWidget
+ };
+ QWidget *getFocusWidget(FocusWidgets fw);
+
QWidget *m_widget;
QPointer<QWidget> m_implicit_mouse_grabber;
#ifndef QT_NO_DRAGANDDROP
@@ -111,6 +116,4 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QWIDGETWINDOW_QPA_P_H
diff --git a/src/widgets/kernel/qwindowcontainer.cpp b/src/widgets/kernel/qwindowcontainer.cpp
new file mode 100644
index 0000000000..b02b05552f
--- /dev/null
+++ b/src/widgets/kernel/qwindowcontainer.cpp
@@ -0,0 +1,218 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtWidgets module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 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, Digia gives you certain additional
+** rights. These rights are described in the Digia 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qwindowcontainer_p.h"
+#include "qwidget_p.h"
+#include <QtGui/qwindow.h>
+
+QT_BEGIN_NAMESPACE
+
+class QWindowContainerPrivate : public QWidgetPrivate
+{
+public:
+ Q_DECLARE_PUBLIC(QWindowContainer)
+
+ QWindowContainerPrivate() : window(0), oldFocusWindow(0) { }
+ ~QWindowContainerPrivate() { }
+
+ QPointer<QWindow> window;
+ QWindow *oldFocusWindow;
+};
+
+
+
+/*!
+ \fn QWidget *QWidget::createWindowContainer(QWindow *window, QWidget *parent, Qt::WindowFlags flags);
+
+ Creates a QWidget that makes it possible to embed \a window into
+ a QWidget-based application.
+
+ The window container is created as a child of \a parent and with
+ window flags \a flags.
+
+ Once the window has been embedded into the container, the
+ container will control the window's geometry and
+ visibility. Explicit calls to QWindow::setGeometry(),
+ QWindow::show() or QWindow::hide() on an embedded window is not
+ recommended.
+
+ The container takes over ownership of \a window. The window can
+ be removed from the window container with a call to
+ QWindow::setParent().
+
+ The window container has a number of known limitations:
+
+ \list
+
+ \li Stacking order; The embedded window will stack on top of the
+ widget hierarchy as an opaque box. The stacking order of multiple
+ overlapping window container instances is undefined.
+
+ \li Window Handles; The window container will explicitly invoke
+ winId() which will force the use of native window handles
+ inside the application. See \l {Native Widgets vs Alien Widgets}
+ {QWidget documentation} for more details.
+
+ \li Rendering Integration; The window container does not interoperate
+ with QGraphicsProxyWidget, QWidget::render() or similar functionality.
+
+ \li Focus Handling; It is possible to let the window container
+ instance have any focus policy and it will delegate focus to the
+ window via a call to QWindow::requestActivate(). However,
+ returning to the normal focus chain from the QWindow instance will
+ be up to the QWindow instance implementation itself. For instance,
+ when entering a Qt Quick based window with tab focus, it is quite
+ likely that further tab presses will only cycle inside the QML
+ application. Also, whether QWindow::requestActivate() actually
+ gives the window focus, is platform dependent.
+
+ \li Using many window container instances in a QWidget-based
+ application can greatly hurt the overall performance of the
+ application.
+
+ \endlist
+ */
+
+QWidget *QWidget::createWindowContainer(QWindow *window, QWidget *parent, Qt::WindowFlags flags)
+{
+ return new QWindowContainer(window, parent, flags);
+}
+
+
+
+/*!
+ \internal
+ */
+
+QWindowContainer::QWindowContainer(QWindow *embeddedWindow, QWidget *parent, Qt::WindowFlags flags)
+ : QWidget(*new QWindowContainerPrivate, parent, flags)
+{
+ Q_D(QWindowContainer);
+ if (!embeddedWindow) {
+ qWarning("QWindowContainer: embedded window cannot be null");
+ return;
+ }
+
+ d->window = embeddedWindow;
+
+ // We force this window to become a native window and reparent the
+ // window directly to it. This is done so that the order in which
+ // the QWindowContainer is added to a QWidget tree and when it
+ // gets a window does not matter.
+ winId();
+ d->window->setParent(windowHandle());
+
+ connect(QGuiApplication::instance(), SIGNAL(focusWindowChanged(QWindow *)), this, SLOT(focusWindowChanged(QWindow *)));
+}
+
+
+
+/*!
+ \internal
+ */
+
+QWindowContainer::~QWindowContainer()
+{
+ Q_D(QWindowContainer);
+ delete d->window;
+}
+
+
+
+/*!
+ \internal
+ */
+
+void QWindowContainer::focusWindowChanged(QWindow *focusWindow)
+{
+ Q_D(QWindowContainer);
+ d->oldFocusWindow = focusWindow;
+}
+
+
+
+/*!
+ \internal
+ */
+
+bool QWindowContainer::event(QEvent *e)
+{
+ Q_D(QWindowContainer);
+ if (!d->window)
+ return QWidget::event(e);
+
+ QEvent::Type type = e->type();
+ switch (type) {
+ case QEvent::ChildRemoved: {
+ QChildEvent *ce = static_cast<QChildEvent *>(e);
+ if (ce->child() == d->window)
+ d->window = 0;
+ break;
+ }
+ // The only thing we are interested in is making sure our sizes stay
+ // in sync, so do a catch-all case.
+ case QEvent::Resize:
+ case QEvent::Move:
+ case QEvent::PolishRequest:
+ d->window->setGeometry(0, 0, width(), height());
+ break;
+ case QEvent::Show:
+ d->window->show();
+ break;
+ case QEvent::Hide:
+ d->window->hide();
+ break;
+ case QEvent::FocusIn:
+ if (d->oldFocusWindow != d->window) {
+ d->window->requestActivate();
+ } else {
+ QWidget *next = nextInFocusChain();
+ next->setFocus();
+ }
+ break;
+ default:
+ break;
+ }
+
+ return QWidget::event(e);
+}
+
+QT_END_NAMESPACE
diff --git a/src/widgets/styles/qmacstylepixmaps_mac_p.h b/src/widgets/kernel/qwindowcontainer_p.h
index f76383a2d4..37c023fc1d 100644
--- a/src/widgets/styles/qmacstylepixmaps_mac_p.h
+++ b/src/widgets/kernel/qwindowcontainer_p.h
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -39,34 +39,31 @@
**
****************************************************************************/
-#ifndef QMACSTYLEPIXMAPS_MAC_P_H
-#define QMACSTYLEPIXMAPS_MAC_P_H
+#ifndef QWINDOWCONTAINER_H
+#define QWINDOWCONTAINER_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/qwidget.h>
-static const char * const qt_mac_toolbar_ext[]={
- "14 9 4 1",
- "# c #858585",
- "b c #d9d9d9",
- ". c #dbdbdb",
- "a c None",
- ".###..###.aaaa",
- "a.###..###.aaa",
- "aab###bb###baa",
- "aaab###bb###ba",
- "aaaa.###..###.",
- "aaa.###..###.a",
- "aab###bb###baa",
- "ab###bb###baaa",
- ".###..###.aaaa"};
+QT_BEGIN_NAMESPACE
-#endif // QMACSTYLEPIXMAPS_MAC_P_H
+class QWindowContainerPrivate;
+
+class QWindowContainer : public QWidget
+{
+ Q_OBJECT
+ Q_DECLARE_PRIVATE(QWindowContainer)
+
+public:
+ explicit QWindowContainer(QWindow *embeddedWindow, QWidget *parent = 0, Qt::WindowFlags f = 0);
+ ~QWindowContainer();
+
+protected:
+ bool event(QEvent *ev);
+
+private slots:
+ void focusWindowChanged(QWindow *focusWindow);
+};
+
+QT_END_NAMESPACE
+
+#endif // QWINDOWCONTAINER_H
diff --git a/src/widgets/statemachine/qbasickeyeventtransition.cpp b/src/widgets/statemachine/qbasickeyeventtransition.cpp
index edc656119e..5a1b98690e 100644
--- a/src/widgets/statemachine/qbasickeyeventtransition.cpp
+++ b/src/widgets/statemachine/qbasickeyeventtransition.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/statemachine/qbasickeyeventtransition_p.h b/src/widgets/statemachine/qbasickeyeventtransition_p.h
index 45a32ca0d0..0d1e815dec 100644
--- a/src/widgets/statemachine/qbasickeyeventtransition_p.h
+++ b/src/widgets/statemachine/qbasickeyeventtransition_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/statemachine/qbasicmouseeventtransition.cpp b/src/widgets/statemachine/qbasicmouseeventtransition.cpp
index 99ad1cb1fa..67d45c86db 100644
--- a/src/widgets/statemachine/qbasicmouseeventtransition.cpp
+++ b/src/widgets/statemachine/qbasicmouseeventtransition.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/statemachine/qbasicmouseeventtransition_p.h b/src/widgets/statemachine/qbasicmouseeventtransition_p.h
index 7a779d3e1b..47c9f967c0 100644
--- a/src/widgets/statemachine/qbasicmouseeventtransition_p.h
+++ b/src/widgets/statemachine/qbasicmouseeventtransition_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/statemachine/qguistatemachine.cpp b/src/widgets/statemachine/qguistatemachine.cpp
index e574dd7406..d737a1e323 100644
--- a/src/widgets/statemachine/qguistatemachine.cpp
+++ b/src/widgets/statemachine/qguistatemachine.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -138,7 +138,7 @@ static QEvent *cloneEvent(QEvent *e)
return new QEvent(*e);
case QEvent::DeferredDelete:
return new QEvent(*e);
-#ifndef QT_NO_DRAGANDDROP
+#ifndef QT_NO_DRAGANDDROP
case QEvent::DragEnter:
return new QDragEnterEvent(*static_cast<QDragEnterEvent*>(e));
case QEvent::DragMove:
diff --git a/src/widgets/statemachine/qkeyeventtransition.cpp b/src/widgets/statemachine/qkeyeventtransition.cpp
index 9f54742ad9..f9a67642e0 100644
--- a/src/widgets/statemachine/qkeyeventtransition.cpp
+++ b/src/widgets/statemachine/qkeyeventtransition.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/statemachine/qkeyeventtransition.h b/src/widgets/statemachine/qkeyeventtransition.h
index 9be5a67c0f..dc310167a3 100644
--- a/src/widgets/statemachine/qkeyeventtransition.h
+++ b/src/widgets/statemachine/qkeyeventtransition.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -44,8 +44,6 @@
#include <QtCore/qeventtransition.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -82,6 +80,4 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif
diff --git a/src/widgets/statemachine/qmouseeventtransition.cpp b/src/widgets/statemachine/qmouseeventtransition.cpp
index 3ea3dc74d4..427e60b75e 100644
--- a/src/widgets/statemachine/qmouseeventtransition.cpp
+++ b/src/widgets/statemachine/qmouseeventtransition.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/statemachine/qmouseeventtransition.h b/src/widgets/statemachine/qmouseeventtransition.h
index b215df8bc1..a3606e81bc 100644
--- a/src/widgets/statemachine/qmouseeventtransition.h
+++ b/src/widgets/statemachine/qmouseeventtransition.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -44,8 +44,6 @@
#include <QtCore/qeventtransition.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -86,6 +84,4 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif
diff --git a/src/widgets/styles/images/toolbar-ext.png b/src/widgets/styles/images/toolbar-ext.png
new file mode 100644
index 0000000000..37bd403ff8
--- /dev/null
+++ b/src/widgets/styles/images/toolbar-ext.png
Binary files differ
diff --git a/src/widgets/styles/images/toolbar-ext@2x.png b/src/widgets/styles/images/toolbar-ext@2x.png
new file mode 100644
index 0000000000..6fc729efb0
--- /dev/null
+++ b/src/widgets/styles/images/toolbar-ext@2x.png
Binary files differ
diff --git a/src/widgets/styles/qandroidstyle.cpp b/src/widgets/styles/qandroidstyle.cpp
new file mode 100644
index 0000000000..d82a06987a
--- /dev/null
+++ b/src/widgets/styles/qandroidstyle.cpp
@@ -0,0 +1,1601 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 BogDan Vatra <bogdan@kde.org>
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtWidgets module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 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, Digia gives you certain additional
+** rights. These rights are described in the Digia 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qandroidstyle_p.h"
+
+#if !defined(QT_NO_STYLE_ANDROID) || defined(QT_PLUGIN)
+
+#include <QFile>
+#include <QFont>
+#include <QApplication>
+#include <QTime>
+#include <qdrawutil.h>
+#include <QPixmapCache>
+#include <QFileInfo>
+#include <QStyleOption>
+#include <QPainter>
+#include <QJsonDocument>
+#include <QJsonObject>
+
+#include <QDebug>
+
+QT_BEGIN_NAMESPACE
+
+namespace {
+ const int textStyle_bold = 1;
+ const int textStyle_italic = 2;
+
+ const int typeface_sans = 1;
+ const int typeface_serif = 2;
+ const int typeface_monospace = 3;
+
+ const quint32 NO_COLOR = 1;
+ const quint32 TRANSPARENT_COLOR = 0;
+}
+
+
+QAndroidStyle::QAndroidStyle()
+ : QCommonStyle()
+{
+ QString stylePath(QLatin1String(qgetenv("MINISTRO_ANDROID_STYLE_PATH")));
+
+ if (stylePath.isEmpty())
+ stylePath = QLatin1String("/data/data/org.kde.necessitas.ministro/files/qt/style/");
+ Q_ASSERT(!stylePath.isEmpty());
+
+ QFile f(stylePath + QLatin1String("style.json"));
+ if (!f.open(QIODevice::ReadOnly))
+ return;
+
+ QJsonParseError error;
+ QJsonDocument document = QJsonDocument::fromJson(f.readAll(), &error);
+ if (document.isNull()) {
+ qCritical() << error.errorString();
+ return;
+ }
+
+ if (!document.isObject()) {
+ qCritical() << "Style.json does not contain a valid style.";
+ return;
+ }
+
+ QJsonObject object = document.object();
+ for (QJsonObject::const_iterator objectIterator = object.constBegin();
+ objectIterator != object.constEnd();
+ ++objectIterator) {
+ QString key = objectIterator.key();
+ QJsonValue value = objectIterator.value();
+ if (!value.isObject()) {
+ qWarning("Style.json structure is unrecognized.");
+ continue;
+ }
+
+ QJsonObject item = value.toObject();
+ QJsonObject::const_iterator attributeIterator = item.find(QLatin1String("qtClass"));
+ if (attributeIterator != item.constEnd()) {
+ // The item has palette and font information for a specific Qt Class (e.g. QWidget, QPushButton, etc.)
+ const QString qtClassName = attributeIterator.value().toString();
+
+ // Extract font information
+ QFont font;
+
+ // Font size (in pixels)
+ attributeIterator = item.find(QLatin1String("TextAppearance_textSize"));
+ if (attributeIterator != item.constEnd())
+ font.setPixelSize(int(attributeIterator.value().toDouble()));
+
+ // Font style
+ attributeIterator = item.find(QLatin1String("TextAppearance_textStyle"));
+ if (attributeIterator != item.constEnd()) {
+ const int style = int(attributeIterator.value().toDouble());
+ font.setBold(style & textStyle_bold);
+ font.setItalic(style & textStyle_italic);
+ }
+
+ // Font typeface
+ attributeIterator = item.find(QLatin1String("TextAppearance_typeface"));
+ if (attributeIterator != item.constEnd()) {
+ QFont::StyleHint styleHint = QFont::AnyStyle;
+ switch (int(attributeIterator.value().toDouble())) {
+ case typeface_sans:
+ styleHint = QFont::SansSerif;
+ break;
+ case typeface_serif:
+ styleHint = QFont::Serif;
+ break;
+ case typeface_monospace:
+ styleHint = QFont::Monospace;
+ break;
+ }
+ font.setStyleHint(styleHint, QFont::PreferMatch);
+ }
+ QApplication::setFont(font, qtClassName.toUtf8());
+ // Extract font information
+
+ // Extract palette information
+ QPalette palette;
+ attributeIterator = item.find(QLatin1String("TextAppearance_textColor"));
+ if (attributeIterator != item.constEnd())
+ setPaletteColor(attributeIterator.value().toObject().toVariantMap(), palette, QPalette::WindowText);
+
+ attributeIterator = item.find(QLatin1String("TextAppearance_textColorLink"));
+ if (attributeIterator != item.constEnd())
+ setPaletteColor(attributeIterator.value().toObject().toVariantMap(), palette, QPalette::Link);
+
+ attributeIterator = item.find(QLatin1String("TextAppearance_textColorHighlight"));
+ if (attributeIterator != item.constEnd())
+ palette.setColor(QPalette::Highlight, QRgb(int(attributeIterator.value().toDouble())));
+ palette.setColor(QPalette::Window, Qt::black);
+ QApplication::setPalette(palette, qtClassName.toUtf8());
+ if (QLatin1String("QWidget") == qtClassName)
+ m_standardPalette = palette;
+ // Extract palette information
+ }
+ QAndroidStyle::ItemType itemType = qtControl(key);
+ if (QC_UnknownType == itemType)
+ continue;
+
+ switch (itemType) {
+ case QC_Checkbox:
+ case QC_RadioButton:
+ m_androidControlsHash[int(itemType)] = new AndroidCompoundButtonControl(item.toVariantMap(),
+ itemType);
+ break;
+
+ case QC_ProgressBar:
+ m_androidControlsHash[int(itemType)] = new AndroidProgressBarControl(item.toVariantMap(),
+ itemType);
+ break;
+
+ case QC_Slider:
+ m_androidControlsHash[int(itemType)] = new AndroidSeekBarControl(item.toVariantMap(),
+ itemType);
+ break;
+
+ case QC_Combobox:
+ m_androidControlsHash[int(itemType)] = new AndroidSpinnerControl(item.toVariantMap(),
+ itemType);
+ break;
+
+ default:
+ m_androidControlsHash[int(itemType)] = new AndroidControl(item.toVariantMap(),
+ itemType);
+ break;
+ }
+ }
+ QApplication::setPalette(QApplication::palette("simple_list_item"), "QListView");
+ QApplication::setFont(QApplication::font("simple_list_item"), "QListView");
+ QApplication::setPalette(QApplication::palette("simple_list_item"), "QAbstractItemView");
+ QApplication::setFont(QApplication::font("simple_list_item"), "QAbstractItemView");
+}
+
+QAndroidStyle::~QAndroidStyle()
+{
+ qDeleteAll(m_androidControlsHash);
+}
+
+
+void QAndroidStyle::setPaletteColor(const QVariantMap &object,
+ QPalette &palette,
+ QPalette::ColorRole role)
+{
+ // QPalette::Active -> ENABLED_FOCUSED_WINDOW_FOCUSED_STATE_SET
+ palette.setColor(QPalette::Active,
+ role,
+ QRgb(object.value(QLatin1String("ENABLED_FOCUSED_WINDOW_FOCUSED_STATE_SET")).toInt()));
+
+ // QPalette::Inactive -> ENABLED_STATE_SET
+ palette.setColor(QPalette::Inactive,
+ role,
+ QRgb(object.value(QLatin1String("ENABLED_STATE_SET")).toInt()));
+
+ // QPalette::Disabled -> EMPTY_STATE_SET
+ palette.setColor(QPalette::Disabled,
+ role,
+ QRgb(object.value(QLatin1String("EMPTY_STATE_SET")).toInt()));
+
+ palette.setColor(QPalette::Current, role, palette.color(QPalette::Active, role));
+
+ if (role == QPalette::WindowText) {
+ // QPalette::BrightText -> PRESSED
+ // QPalette::Active -> PRESSED_ENABLED_FOCUSED_WINDOW_FOCUSED_STATE_SET
+ palette.setColor(QPalette::Active,
+ QPalette::BrightText,
+ QRgb(object.value(QLatin1String("PRESSED_ENABLED_FOCUSED_WINDOW_FOCUSED_STATE_SET")).toInt()));
+
+ // QPalette::Inactive -> PRESSED_ENABLED_STATE_SET
+ palette.setColor(QPalette::Inactive,
+ QPalette::BrightText,
+ QRgb(object.value(QLatin1String("PRESSED_ENABLED_STATE_SET")).toInt()));
+
+ // QPalette::Disabled -> PRESSED_STATE_SET
+ palette.setColor(QPalette::Disabled,
+ QPalette::BrightText,
+ QRgb(object.value(QLatin1String("PRESSED_STATE_SET")).toInt()));
+
+ palette.setColor(QPalette::Current, QPalette::BrightText, palette.color(QPalette::Active, QPalette::BrightText));
+
+ // QPalette::HighlightedText -> SELECTED
+ // QPalette::Active -> ENABLED_SELECTED_WINDOW_FOCUSED_STATE_SET
+ palette.setColor(QPalette::Active,
+ QPalette::HighlightedText,
+ QRgb(object.value(QLatin1String("ENABLED_SELECTED_WINDOW_FOCUSED_STATE_SET")).toInt()));
+
+ // QPalette::Inactive -> ENABLED_SELECTED_STATE_SET
+ palette.setColor(QPalette::Inactive,
+ QPalette::HighlightedText,
+ QRgb(object.value(QLatin1String("ENABLED_SELECTED_STATE_SET")).toInt()));
+
+ // QPalette::Disabled -> SELECTED_STATE_SET
+ palette.setColor(QPalette::Disabled,
+ QPalette::HighlightedText,
+ QRgb(object.value(QLatin1String("SELECTED_STATE_SET")).toInt()));
+
+ palette.setColor(QPalette::Current,
+ QPalette::HighlightedText,
+ palette.color(QPalette::Active, QPalette::HighlightedText));
+
+ // Same colors for Text
+ palette.setColor(QPalette::Active, QPalette::Text, palette.color(QPalette::Active, role));
+ palette.setColor(QPalette::Inactive, QPalette::Text, palette.color(QPalette::Inactive, role));
+ palette.setColor(QPalette::Disabled, QPalette::Text, palette.color(QPalette::Disabled, role));
+ palette.setColor(QPalette::Current, QPalette::Text, palette.color(QPalette::Current, role));
+
+ // And for ButtonText
+ palette.setColor(QPalette::Active, QPalette::ButtonText, palette.color(QPalette::Active, role));
+ palette.setColor(QPalette::Inactive, QPalette::ButtonText, palette.color(QPalette::Inactive, role));
+ palette.setColor(QPalette::Disabled, QPalette::ButtonText, palette.color(QPalette::Disabled, role));
+ palette.setColor(QPalette::Current, QPalette::ButtonText, palette.color(QPalette::Current, role));
+ }
+}
+
+QAndroidStyle::ItemType QAndroidStyle::qtControl(const QString &android)
+{
+ if (android == QLatin1String("buttonStyle"))
+ return QC_Button;
+ if (android == QLatin1String("editTextStyle"))
+ return QC_EditText;
+ if (android == QLatin1String("radioButtonStyle"))
+ return QC_RadioButton;
+ if (android == QLatin1String("checkboxStyle"))
+ return QC_Checkbox;
+ if (android == QLatin1String("textViewStyle"))
+ return QC_View;
+ if (android == QLatin1String("buttonStyleToggle"))
+ return QC_Switch;
+ if (android == QLatin1String("spinnerStyle"))
+ return QC_Combobox;
+ if (android == QLatin1String("progressBarStyleHorizontal"))
+ return QC_ProgressBar;
+ if (android == QLatin1String("seekBarStyle"))
+ return QC_Slider;
+
+ return QC_UnknownType;
+}
+
+QAndroidStyle::ItemType QAndroidStyle::qtControl(QStyle::ComplexControl control)
+{
+ switch (control) {
+ case CC_ComboBox:
+ return QC_Combobox;
+ case CC_Slider:
+ return QC_Slider;
+ case CC_GroupBox:
+ return QC_View;
+ default:
+ return QC_UnknownType;
+ }
+}
+
+QAndroidStyle::ItemType QAndroidStyle::qtControl(QStyle::ContentsType contentsType)
+{
+ switch (contentsType) {
+ case CT_PushButton:
+ return QC_Button;
+ case CT_CheckBox:
+ return QC_Checkbox;
+ case CT_RadioButton:
+ return QC_RadioButton;
+ case CT_ComboBox:
+ return QC_Combobox;
+ case CT_ProgressBar:
+ return QC_ProgressBar;
+ case CT_Slider:
+ return QC_Slider;
+ case CT_TabWidget:
+ return QC_Tab;
+ case CT_TabBarTab:
+ return QC_TabButton;
+ case CT_LineEdit:
+ return QC_EditText;
+ case CT_GroupBox:
+ return QC_GroupBox;
+ default:
+ return QC_UnknownType;
+ }
+}
+
+QAndroidStyle::ItemType QAndroidStyle::qtControl(QStyle::ControlElement controlElement)
+{
+ switch (controlElement) {
+ case CE_PushButton:
+ case CE_PushButtonBevel:
+ case CE_PushButtonLabel:
+ return QC_Button;
+
+ case CE_CheckBox:
+ case CE_CheckBoxLabel:
+ return QC_Checkbox;
+
+ case CE_RadioButton:
+ case CE_RadioButtonLabel:
+ return QC_RadioButton;
+
+ case CE_TabBarTab:
+ case CE_TabBarTabShape:
+ case CE_TabBarTabLabel:
+ return QC_Tab;
+
+ case CE_ProgressBar:
+ case CE_ProgressBarGroove:
+ case CE_ProgressBarContents:
+ case CE_ProgressBarLabel:
+ return QC_ProgressBar;
+
+ case CE_ComboBoxLabel:
+ return QC_Combobox;
+
+ default:
+ return QC_UnknownType;
+ }
+}
+
+QAndroidStyle::ItemType QAndroidStyle::qtControl(QStyle::PrimitiveElement primitiveElement)
+{
+ switch (primitiveElement) {
+ case QStyle::PE_PanelLineEdit:
+ case QStyle::PE_FrameLineEdit:
+ return QC_EditText;
+
+ case QStyle::PE_FrameWindow:
+ case QStyle::PE_Widget:
+ case QStyle::PE_Frame:
+ case QStyle::PE_FrameFocusRect:
+ return QC_View;
+ default:
+ return QC_UnknownType;
+ }
+}
+
+QAndroidStyle::ItemType QAndroidStyle::qtControl(QStyle::SubElement subElement)
+{
+ switch (subElement) {
+ case QStyle::SE_LineEditContents:
+ return QC_EditText;
+
+ case QStyle::SE_PushButtonContents:
+ case QStyle::SE_PushButtonFocusRect:
+ return QC_Button;
+
+ case SE_RadioButtonContents:
+ return QC_RadioButton;
+
+ case SE_CheckBoxContents:
+ return QC_Checkbox;
+
+ default:
+ return QC_UnknownType;
+ }
+}
+
+void QAndroidStyle::drawPrimitive(PrimitiveElement pe,
+ const QStyleOption *opt,
+ QPainter *p,
+ const QWidget *w) const
+{
+ const ItemType itemType = qtControl(pe);
+ AndroidControlsHash::const_iterator it = itemType != QC_UnknownType
+ ? m_androidControlsHash.find(itemType)
+ : m_androidControlsHash.end();
+ if (it != m_androidControlsHash.end())
+ it.value()->drawControl(opt, p, w);
+ else
+ QCommonStyle::drawPrimitive(pe, opt, p, w);
+}
+
+
+void QAndroidStyle::drawControl(QStyle::ControlElement element,
+ const QStyleOption *opt,
+ QPainter *p,
+ const QWidget *w) const
+{
+ const ItemType itemType = qtControl(element);
+ AndroidControlsHash::const_iterator it = itemType != QC_UnknownType
+ ? m_androidControlsHash.find(itemType)
+ : m_androidControlsHash.end();
+ if (it != m_androidControlsHash.end()) {
+ it.value()->drawControl(opt, p, w);
+
+ switch (itemType) {
+ case QC_Button:
+ if (const QStyleOptionButton *buttonOption =
+ qstyleoption_cast<const QStyleOptionButton *>(opt)) {
+ QMargins padding = it.value()->padding();
+ QStyleOptionButton copy (*buttonOption);
+ copy.rect.adjust(padding.left(), padding.top(), -padding.right(), -padding.bottom());
+ QCommonStyle::drawControl(CE_PushButtonLabel, &copy, p, w);
+ }
+ break;
+ case QC_Checkbox:
+ case QC_RadioButton:
+ if (const QStyleOptionButton *btn =
+ qstyleoption_cast<const QStyleOptionButton *>(opt)) {
+ const bool isRadio = (element == CE_RadioButton);
+ QStyleOptionButton subopt(*btn);
+ subopt.rect = subElementRect(isRadio ? SE_RadioButtonContents
+ : SE_CheckBoxContents, btn, w);
+ QCommonStyle::drawControl(isRadio ? CE_RadioButtonLabel : CE_CheckBoxLabel, &subopt, p, w);
+ }
+ break;
+ case QC_Combobox:
+ if (const QStyleOptionComboBox *comboboxOption =
+ qstyleoption_cast<const QStyleOptionComboBox *>(opt)) {
+ QMargins padding = it.value()->padding();
+ QStyleOptionComboBox copy (*comboboxOption);
+ copy.rect.adjust(padding.left(), padding.top(), -padding.right(), -padding.bottom());
+ p->setFont(QApplication::font("simple_spinner_item"));
+ p->setPen(QApplication::palette("QPushButton").color(QPalette::Active, QPalette::Text));
+ QCommonStyle::drawControl(CE_ComboBoxLabel, comboboxOption, p, w);
+ }
+ break;
+ default:
+ break;
+ }
+ }
+ else
+ QCommonStyle::drawControl(element, opt, p, w);
+}
+
+QRect QAndroidStyle::subElementRect(SubElement subElement,
+ const QStyleOption *option,
+ const QWidget *widget) const
+{
+ const ItemType itemType = qtControl(subElement);
+ AndroidControlsHash::const_iterator it = itemType != QC_UnknownType
+ ? m_androidControlsHash.find(itemType)
+ : m_androidControlsHash.end();
+ if (it != m_androidControlsHash.end())
+ return it.value()->subElementRect(subElement, option, widget);
+ return QCommonStyle::subElementRect(subElement, option, widget);
+}
+
+void QAndroidStyle::drawComplexControl(ComplexControl cc,
+ const QStyleOptionComplex *opt,
+ QPainter *p,
+ const QWidget *widget) const
+{
+ const ItemType itemType = qtControl(cc);
+ AndroidControlsHash::const_iterator it = itemType != QC_UnknownType
+ ? m_androidControlsHash.find(itemType)
+ : m_androidControlsHash.end();
+ if (it != m_androidControlsHash.end())
+ it.value()->drawControl(opt, p, widget);
+ else
+ QCommonStyle::drawComplexControl(cc, opt, p, widget);
+}
+
+QStyle::SubControl QAndroidStyle::hitTestComplexControl(ComplexControl cc,
+ const QStyleOptionComplex *opt,
+ const QPoint &pt,
+ const QWidget *widget) const
+{
+ const ItemType itemType = qtControl(cc);
+ AndroidControlsHash::const_iterator it = itemType != QC_UnknownType
+ ? m_androidControlsHash.find(itemType)
+ : m_androidControlsHash.end();
+ if (it != m_androidControlsHash.end()) {
+ switch (cc) {
+ case CC_Slider:
+ if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(opt)) {
+ QRect r = it.value()->subControlRect(slider, SC_SliderHandle, widget);
+ if (r.isValid() && r.contains(pt)) {
+ return SC_SliderHandle;
+ } else {
+ r = it.value()->subControlRect(slider, SC_SliderGroove, widget);
+ if (r.isValid() && r.contains(pt))
+ return SC_SliderGroove;
+ }
+ }
+ break;
+ default:
+ break;
+ }
+ }
+ return QCommonStyle::hitTestComplexControl(cc, opt, pt, widget);
+}
+
+QRect QAndroidStyle::subControlRect(ComplexControl cc,
+ const QStyleOptionComplex *opt,
+ SubControl sc,
+ const QWidget *widget) const
+{
+ const ItemType itemType = qtControl(cc);
+ AndroidControlsHash::const_iterator it = itemType != QC_UnknownType
+ ? m_androidControlsHash.find(itemType)
+ : m_androidControlsHash.end();
+ if (it != m_androidControlsHash.end())
+ return it.value()->subControlRect(opt, sc, widget);
+ return QCommonStyle::subControlRect(cc, opt, sc, widget);
+}
+
+int QAndroidStyle::pixelMetric(PixelMetric metric, const QStyleOption *option,
+ const QWidget *widget) const
+{
+ switch (metric) {
+ case PM_ButtonMargin:
+ case PM_FocusFrameVMargin:
+ case PM_FocusFrameHMargin:
+ case PM_ComboBoxFrameWidth:
+ case PM_SpinBoxFrameWidth:
+ return 0;
+ default:
+ return QCommonStyle::pixelMetric(metric, option, widget);
+ }
+
+}
+
+QSize QAndroidStyle::sizeFromContents(ContentsType ct,
+ const QStyleOption *opt,
+ const QSize &contentsSize,
+ const QWidget *w) const
+{
+ QSize sz=QCommonStyle::sizeFromContents(ct, opt, contentsSize, w);
+ const ItemType itemType = qtControl(ct);
+ AndroidControlsHash::const_iterator it = itemType != QC_UnknownType
+ ? m_androidControlsHash.find(itemType)
+ : m_androidControlsHash.end();
+ if (it != m_androidControlsHash.end())
+ return it.value()->sizeFromContents(opt, sz, w);
+ return sz;
+}
+
+QPixmap QAndroidStyle::standardPixmap(StandardPixmap standardPixmap,
+ const QStyleOption *opt,
+ const QWidget *widget) const
+{
+ return QCommonStyle::standardPixmap(standardPixmap, opt, widget);
+}
+
+QPixmap QAndroidStyle::generatedIconPixmap(QIcon::Mode iconMode,
+ const QPixmap &pixmap,
+ const QStyleOption *opt) const
+{
+ return QCommonStyle::generatedIconPixmap(iconMode, pixmap, opt);
+}
+
+QPalette QAndroidStyle::standardPalette() const
+{
+ return m_standardPalette;
+}
+
+QAndroidStyle::AndroidDrawable::AndroidDrawable(const QVariantMap &drawable,
+ QAndroidStyle::ItemType itemType)
+{
+ initPadding(drawable);
+ m_itemType = itemType;
+}
+
+QAndroidStyle::AndroidDrawable::~AndroidDrawable()
+{
+}
+
+void QAndroidStyle::AndroidDrawable::initPadding(const QVariantMap &drawable)
+{
+ QVariantMap::const_iterator it = drawable.find(QLatin1String("padding"));
+ if (it != drawable.end())
+ m_padding = extractMargins(it.value().toMap());
+}
+
+const QMargins &QAndroidStyle::AndroidDrawable::padding() const
+{
+ return m_padding;
+}
+
+QSize QAndroidStyle::AndroidDrawable::size() const
+{
+ if (type() == Image || type() == NinePatch)
+ return static_cast<const QAndroidStyle::AndroidImageDrawable *>(this)->size();
+
+ return QSize();
+}
+
+QAndroidStyle::AndroidDrawable * QAndroidStyle::AndroidDrawable::fromMap(const QVariantMap &drawable,
+ ItemType itemType)
+{
+ const QString type = drawable.value(QLatin1String("type")).toString();
+ if (type == QLatin1String("image"))
+ return new QAndroidStyle::AndroidImageDrawable(drawable, itemType);
+ if (type == QLatin1String("9patch"))
+ return new QAndroidStyle::Android9PatchDrawable(drawable, itemType);
+ if (type == QLatin1String("stateslist"))
+ return new QAndroidStyle::AndroidStateDrawable(drawable, itemType);
+ if (type == QLatin1String("layer"))
+ return new QAndroidStyle::AndroidLayerDrawable(drawable, itemType);
+ if (type == QLatin1String("gradient"))
+ return new QAndroidStyle::AndroidGradientDrawable(drawable, itemType);
+ if (type == QLatin1String("clipDrawable"))
+ return new QAndroidStyle::AndroidClipDrawable(drawable, itemType);
+ if (type == QLatin1String("color"))
+ return new QAndroidStyle::AndroidColorDrawable(drawable, itemType);
+ return 0;
+}
+
+QMargins QAndroidStyle::AndroidDrawable::extractMargins(const QVariantMap &value)
+{
+ QMargins m;
+ m.setLeft(value.value(QLatin1String("left")).toInt());
+ m.setRight(value.value(QLatin1String("right")).toInt());
+ m.setTop(value.value(QLatin1String("top")).toInt());
+ m.setBottom(value.value(QLatin1String("bottom")).toInt());
+ return m;
+}
+
+
+QAndroidStyle::AndroidImageDrawable::AndroidImageDrawable(const QVariantMap &drawable,
+ QAndroidStyle::ItemType itemType)
+ : AndroidDrawable(drawable, itemType)
+{
+ m_filePath = drawable.value(QLatin1String("path")).toString();
+ m_size.setHeight(drawable.value(QLatin1String("height")).toInt());
+ m_size.setWidth(drawable.value(QLatin1String("width")).toInt());
+}
+
+QAndroidStyle::AndroidDrawableType QAndroidStyle::AndroidImageDrawable::type() const
+{
+ return QAndroidStyle::Image;
+}
+
+void QAndroidStyle::AndroidImageDrawable::draw(QPainter *painter, const QStyleOption *opt) const
+{
+ if (m_hashKey.isEmpty())
+ m_hashKey = QFileInfo(m_filePath).fileName();
+
+ QPixmap pm;
+ if (!QPixmapCache::find(m_hashKey, &pm)) {
+ pm.load(m_filePath);
+ QPixmapCache::insert(m_hashKey, pm);
+ }
+
+ painter->drawPixmap(opt->rect.x(), (opt->rect.height() - pm.height()) / 2, pm);
+}
+
+QSize QAndroidStyle::AndroidImageDrawable::size() const
+{
+ return m_size;
+}
+
+QAndroidStyle::AndroidColorDrawable::AndroidColorDrawable(const QVariantMap &drawable,
+ ItemType itemType)
+ : AndroidDrawable(drawable, itemType)
+{
+ m_color.setRgba(QRgb(drawable.value(QLatin1String("color")).toInt()));
+}
+
+QAndroidStyle::AndroidDrawableType QAndroidStyle::AndroidColorDrawable::type() const
+{
+ return QAndroidStyle::Color;
+}
+
+void QAndroidStyle::AndroidColorDrawable::draw(QPainter *painter, const QStyleOption *opt) const
+{
+ painter->fillRect(opt->rect, m_color);
+}
+
+QAndroidStyle::Android9PatchDrawable::Android9PatchDrawable(const QVariantMap &drawable,
+ QAndroidStyle::ItemType itemType)
+ : AndroidImageDrawable(drawable.value(QLatin1String("drawable")).toMap(), itemType)
+{
+ initPadding(drawable);
+ QVariantMap chunk = drawable.value(QLatin1String("chunkInfo")).toMap();
+ extractIntArray(chunk.value(QLatin1String("xdivs")).toList(), m_chunkData.xDivs);
+ extractIntArray(chunk.value(QLatin1String("ydivs")).toList(), m_chunkData.yDivs);
+ extractIntArray(chunk.value(QLatin1String("colors")).toList(), m_chunkData.colors);
+}
+
+QAndroidStyle::AndroidDrawableType QAndroidStyle::Android9PatchDrawable::type() const
+{
+ return QAndroidStyle::NinePatch;
+}
+
+int QAndroidStyle::Android9PatchDrawable::calculateStretch(int boundsLimit,
+ int startingPoint,
+ int srcSpace,
+ int numStrechyPixelsRemaining,
+ int numFixedPixelsRemaining)
+{
+ int spaceRemaining = boundsLimit - startingPoint;
+ int stretchySpaceRemaining = spaceRemaining - numFixedPixelsRemaining;
+ return (float(srcSpace) * stretchySpaceRemaining / numStrechyPixelsRemaining + .5);
+}
+
+void QAndroidStyle::Android9PatchDrawable::extractIntArray(const QVariantList &values,
+ QVector<int> & array)
+{
+ foreach (QVariant value, values)
+ array << value.toInt();
+}
+
+
+void QAndroidStyle::Android9PatchDrawable::draw(QPainter * painter, const QStyleOption *opt) const
+{
+ if (m_hashKey.isEmpty())
+ m_hashKey = QFileInfo(m_filePath).fileName();
+
+ QPixmap pixmap;
+ if (!QPixmapCache::find(m_hashKey, &pixmap)) {
+ pixmap.load(m_filePath);
+ QPixmapCache::insert(m_hashKey, pixmap);
+ }
+
+ const QRect &bounds=opt->rect;
+
+ // shamelessly stolen from Android's sources (NinepatchImpl.cpp) and adapted for Qt
+ const int pixmapWidth = pixmap.width();
+ const int pixmapHeight = pixmap.height();
+
+ if (bounds.isNull() || !pixmapWidth || !pixmapHeight)
+ return;
+
+ QPainter::RenderHints savedHints = painter->renderHints();
+
+ // The patchs doesn't need smooth transform !
+ painter->setRenderHints(QPainter::SmoothPixmapTransform, false);
+
+ QRectF dst;
+ QRectF src;
+
+ const qint32 x0 = m_chunkData.xDivs[0];
+ const qint32 y0 = m_chunkData.yDivs[0];
+ const quint8 numXDivs = m_chunkData.xDivs.size();
+ const quint8 numYDivs = m_chunkData.yDivs.size();
+ int i;
+ int j;
+ int colorIndex = 0;
+ quint32 color;
+ bool xIsStretchable;
+ const bool initialXIsStretchable = (x0 == 0);
+ bool yIsStretchable = (y0 == 0);
+ const int bitmapWidth = pixmap.width();
+ const int bitmapHeight = pixmap.height();
+
+ int *dstRights = static_cast<int *>(alloca((numXDivs + 1) * sizeof(int)));
+ bool dstRightsHaveBeenCached = false;
+
+ int numStretchyXPixelsRemaining = 0;
+ for (i = 0; i < numXDivs; i += 2)
+ numStretchyXPixelsRemaining += m_chunkData.xDivs[i + 1] - m_chunkData.xDivs[i];
+
+ int numFixedXPixelsRemaining = bitmapWidth - numStretchyXPixelsRemaining;
+ int numStretchyYPixelsRemaining = 0;
+ for (i = 0; i < numYDivs; i += 2)
+ numStretchyYPixelsRemaining += m_chunkData.yDivs[i + 1] - m_chunkData.yDivs[i];
+
+ int numFixedYPixelsRemaining = bitmapHeight - numStretchyYPixelsRemaining;
+ src.setTop(0);
+ dst.setTop(bounds.top());
+ // The first row always starts with the top being at y=0 and the bottom
+ // being either yDivs[1] (if yDivs[0]=0) of yDivs[0]. In the former case
+ // the first row is stretchable along the Y axis, otherwise it is fixed.
+ // The last row always ends with the bottom being bitmap.height and the top
+ // being either yDivs[numYDivs-2] (if yDivs[numYDivs-1]=bitmap.height) or
+ // yDivs[numYDivs-1]. In the former case the last row is stretchable along
+ // the Y axis, otherwise it is fixed.
+ //
+ // The first and last columns are similarly treated with respect to the X
+ // axis.
+ //
+ // The above is to help explain some of the special casing that goes on the
+ // code below.
+
+ // The initial yDiv and whether the first row is considered stretchable or
+ // not depends on whether yDiv[0] was zero or not.
+ for (j = yIsStretchable ? 1 : 0;
+ j <= numYDivs && src.top() < bitmapHeight;
+ j++, yIsStretchable = !yIsStretchable) {
+ src.setLeft(0);
+ dst.setLeft(bounds.left());
+ if (j == numYDivs) {
+ src.setBottom(bitmapHeight);
+ dst.setBottom(bounds.bottom());
+ } else {
+ src.setBottom(m_chunkData.yDivs[j]);
+ const int srcYSize = src.bottom() - src.top();
+ if (yIsStretchable) {
+ dst.setBottom(dst.top() + calculateStretch(bounds.bottom(), dst.top(),
+ srcYSize,
+ numStretchyYPixelsRemaining,
+ numFixedYPixelsRemaining));
+ numStretchyYPixelsRemaining -= srcYSize;
+ } else {
+ dst.setBottom(dst.top() + srcYSize);
+ numFixedYPixelsRemaining -= srcYSize;
+ }
+ }
+
+ xIsStretchable = initialXIsStretchable;
+ // The initial xDiv and whether the first column is considered
+ // stretchable or not depends on whether xDiv[0] was zero or not.
+ for (i = xIsStretchable ? 1 : 0;
+ i <= numXDivs && src.left() < bitmapWidth;
+ i++, xIsStretchable = !xIsStretchable) {
+ color = m_chunkData.colors[colorIndex++];
+ if (i == numXDivs) {
+ src.setRight(bitmapWidth);
+ dst.setRight(bounds.right());
+ } else {
+ src.setRight(m_chunkData.xDivs[i]);
+ if (dstRightsHaveBeenCached) {
+ dst.setRight(dstRights[i]);
+ } else {
+ const int srcXSize = src.right() - src.left();
+ if (xIsStretchable) {
+ dst.setRight(dst.left() + calculateStretch(bounds.right(), dst.left(),
+ srcXSize,
+ numStretchyXPixelsRemaining,
+ numFixedXPixelsRemaining));
+ numStretchyXPixelsRemaining -= srcXSize;
+ } else {
+ dst.setRight(dst.left() + srcXSize);
+ numFixedXPixelsRemaining -= srcXSize;
+ }
+ dstRights[i] = dst.right();
+ }
+ }
+ // If this horizontal patch is too small to be displayed, leave
+ // the destination left edge where it is and go on to the next patch
+ // in the source.
+ if (src.left() >= src.right()) {
+ src.setLeft(src.right());
+ continue;
+ }
+ // Make sure that we actually have room to draw any bits
+ if (dst.right() <= dst.left() || dst.bottom() <= dst.top()) {
+ goto nextDiv;
+ }
+ // If this patch is transparent, skip and don't draw.
+ if (color == TRANSPARENT_COLOR)
+ goto nextDiv;
+ if (color != NO_COLOR)
+ painter->fillRect(dst, (QRgb)color);
+ else
+ painter->drawPixmap(dst, pixmap, src);
+nextDiv:
+ src.setLeft(src.right());
+ dst.setLeft(dst.right());
+ }
+ src.setTop(src.bottom());
+ dst.setTop(dst.bottom());
+ dstRightsHaveBeenCached = true;
+ }
+ painter->setRenderHints(savedHints);
+}
+
+QAndroidStyle::AndroidGradientDrawable::AndroidGradientDrawable(const QVariantMap &drawable,
+ QAndroidStyle::ItemType itemType)
+ : AndroidDrawable(drawable, itemType), m_orientation(TOP_BOTTOM)
+{
+ m_radius = drawable.value(QLatin1String("radius")).toInt();
+ if (m_radius < 0)
+ m_radius = 0;
+
+ QVariantList colors = drawable.value(QLatin1String("colors")).toList();
+ QVariantList positions = drawable.value(QLatin1String("positions")).toList();
+ int min=colors.size() < positions.size() ? colors.size() : positions.size();
+ for (int i = 0; i < min; i++)
+ m_gradient.setColorAt(positions.at(i).toDouble(), (QRgb)colors.at(i).toInt());
+
+ QByteArray orientation=drawable.value(QLatin1String("orientation")).toByteArray();
+ if (orientation == "TOP_BOTTOM") // draw the gradient from the top to the bottom
+ m_orientation = TOP_BOTTOM;
+ else if (orientation == "TR_BL") // draw the gradient from the top-right to the bottom-left
+ m_orientation = TR_BL;
+ else if (orientation == "RIGHT_LEFT") // draw the gradient from the right to the left
+ m_orientation = RIGHT_LEFT;
+ else if (orientation == "BR_TL") // draw the gradient from the bottom-right to the top-left
+ m_orientation = BR_TL;
+ else if (orientation == "BOTTOM_TOP") // draw the gradient from the bottom to the top
+ m_orientation = BOTTOM_TOP;
+ else if (orientation == "BL_TR") // draw the gradient from the bottom-left to the top-right
+ m_orientation = BL_TR;
+ else if (orientation == "LEFT_RIGHT") // draw the gradient from the left to the right
+ m_orientation = LEFT_RIGHT;
+ else if (orientation == "TL_BR") // draw the gradient from the top-left to the bottom-right
+ m_orientation = TL_BR;
+ else
+ qWarning("AndroidGradientDrawable: unknown orientation");
+}
+
+QAndroidStyle::AndroidDrawableType QAndroidStyle::AndroidGradientDrawable::type() const
+{
+ return QAndroidStyle::Gradient;
+}
+
+void QAndroidStyle::AndroidGradientDrawable::draw(QPainter *painter, const QStyleOption *opt) const
+{
+ const int width = opt->rect.width();
+ const int height = opt->rect.height();
+ switch (m_orientation) {
+ case TOP_BOTTOM:
+ // draw the gradient from the top to the bottom
+ m_gradient.setStart(width/2,0);
+ m_gradient.setFinalStop(width/2,height);
+ break;
+ case TR_BL:
+ // draw the gradient from the top-right to the bottom-left
+ m_gradient.setStart(width,0);
+ m_gradient.setFinalStop(0,height);
+ break;
+ case RIGHT_LEFT:
+ // draw the gradient from the right to the left
+ m_gradient.setStart(width,height/2);
+ m_gradient.setFinalStop(0,height/2);
+ break;
+ case BR_TL:
+ // draw the gradient from the bottom-right to the top-left
+ m_gradient.setStart(width,height);
+ m_gradient.setFinalStop(0,0);
+ break;
+ case BOTTOM_TOP:
+ // draw the gradient from the bottom to the top
+ m_gradient.setStart(width/2,height);
+ m_gradient.setFinalStop(width/2,0);
+ break;
+ case BL_TR:
+ // draw the gradient from the bottom-left to the top-right
+ m_gradient.setStart(0,height);
+ m_gradient.setFinalStop(width,0);
+ break;
+ case LEFT_RIGHT:
+ // draw the gradient from the left to the right
+ m_gradient.setStart(0,height/2);
+ m_gradient.setFinalStop(width,height/2);
+ break;
+ case TL_BR:
+ // draw the gradient from the top-left to the bottom-right
+ m_gradient.setStart(0,0);
+ m_gradient.setFinalStop(width,height);
+ break;
+ }
+
+ const QBrush &oldBrush = painter->brush();
+ const QPen oldPen = painter->pen();
+ painter->setPen(Qt::NoPen);
+ painter->setBrush(m_gradient);
+ painter->drawRoundedRect(opt->rect, m_radius, m_radius);
+ painter->setBrush(oldBrush);
+ painter->setPen(oldPen);
+}
+
+QSize QAndroidStyle::AndroidGradientDrawable::size() const
+{
+ return QSize(m_radius*2, m_radius*2);
+}
+
+QAndroidStyle::AndroidClipDrawable::AndroidClipDrawable(const QVariantMap &drawable,
+ QAndroidStyle::ItemType itemType)
+ : AndroidDrawable(drawable, itemType)
+{
+ m_drawable = fromMap(drawable.value(QLatin1String("drawable")).toMap(), itemType);
+ m_factor = 0;
+ m_orientation = Qt::Horizontal;
+}
+
+QAndroidStyle::AndroidClipDrawable::~AndroidClipDrawable()
+{
+ delete m_drawable;
+}
+
+QAndroidStyle::AndroidDrawableType QAndroidStyle::AndroidClipDrawable::type() const
+{
+ return QAndroidStyle::Clip;
+}
+
+void QAndroidStyle::AndroidClipDrawable::setFactor(double factor, Qt::Orientation orientation)
+{
+ m_factor = factor;
+ m_orientation = orientation;
+}
+
+void QAndroidStyle::AndroidClipDrawable::draw(QPainter *painter, const QStyleOption *opt) const
+{
+ QStyleOption copy(*opt);
+ if (m_orientation == Qt::Horizontal)
+ copy.rect.setWidth(copy.rect.width()*m_factor);
+ else
+ copy.rect.setHeight(copy.rect.height()*m_factor);
+
+ m_drawable->draw(painter, &copy);
+}
+
+QAndroidStyle::AndroidStateDrawable::AndroidStateDrawable(const QVariantMap &drawable,
+ QAndroidStyle::ItemType itemType)
+ : AndroidDrawable(drawable, itemType)
+{
+ QVariantList states = drawable.value(QLatin1String("stateslist")).toList();
+ foreach (QVariant stateVariant, states) {
+ QVariantMap state = stateVariant.toMap();
+ const int s = extractState(state.value(QLatin1String("states")).toMap());
+ if (-1 == s)
+ continue;
+ const AndroidDrawable *ad = fromMap(state.value(QLatin1String("drawable")).toMap(), itemType);
+ if (!ad)
+ continue;
+ StateType item;
+ item.first = s;
+ item.second = ad;
+ m_states<<item;
+ }
+}
+
+QAndroidStyle::AndroidStateDrawable::~AndroidStateDrawable()
+{
+ foreach (const StateType type, m_states)
+ delete type.second;
+}
+
+QAndroidStyle::AndroidDrawableType QAndroidStyle::AndroidStateDrawable::type() const
+{
+ return QAndroidStyle::State;
+}
+
+void QAndroidStyle::AndroidStateDrawable::draw(QPainter *painter, const QStyleOption *opt) const
+{
+ const AndroidDrawable *drawable=bestAndroidStateMatch(opt);
+ if (drawable)
+ drawable->draw(painter, opt);
+}
+
+const QAndroidStyle::AndroidDrawable* QAndroidStyle::AndroidStateDrawable::bestAndroidStateMatch(const QStyleOption *opt) const
+{
+ const AndroidDrawable *bestMatch = 0;
+ if (!opt) {
+ if (m_states.size())
+ return m_states[0].second;
+ return bestMatch;
+ }
+
+ uint bestCost=0xffff;
+ foreach (const StateType & state, m_states) {
+ if (int(opt->state) == state.first)
+ return state.second;
+ uint cost = 0;
+
+ int difference = int(opt->state^state.first);
+
+ if (difference & QStyle::State_Active)
+ cost += 1000;
+
+ if (difference & QStyle::State_Enabled)
+ cost += 1000;
+
+ if ((m_itemType == QC_Button || m_itemType == QC_EditText) && (difference & QStyle::State_Raised))
+ cost += 1000;
+
+ if ((m_itemType == QC_Button || m_itemType == QC_EditText) && (difference & QStyle::State_Sunken))
+ cost += 1000;
+
+ if (difference & QStyle::State_Off)
+ cost += 1000;
+
+ if (difference & QStyle::State_On)
+ cost += 1000;
+
+ if (difference & QStyle::State_HasFocus)
+ cost += 1000;
+
+ if (difference & QStyle::State_Selected)
+ cost += 1000;
+
+ if (cost < bestCost) {
+ bestCost = cost;
+ bestMatch = state.second;
+ }
+ }
+ return bestMatch;
+}
+
+int QAndroidStyle::AndroidStateDrawable::extractState(const QVariantMap &value)
+{
+ int state = QStyle::State_None;
+ foreach (const QString key, value.keys()) {
+ bool val = value.value(key).toString() == QLatin1String("true");
+ if (key == QLatin1String("enabled") && val) {
+ state |= QStyle::State_Enabled;
+ continue;
+ }
+
+ if (key == QLatin1String("window_focused") && val) {
+ state |= QStyle::State_Active;
+ continue;
+ }
+
+ if (key == QLatin1String("focused") && val) {
+ state |= QStyle::State_HasFocus;
+ continue;
+ }
+
+ if (key == QLatin1String("checked")) {
+ state |= val ? QStyle::State_On : QStyle::State_Off;
+ continue;
+ }
+
+ if (key == QLatin1String("pressed")) {
+ state |= val ? QStyle::State_Raised : QStyle::State_Sunken;
+ state |= QStyle::State_Enabled | QStyle::State_HasFocus;
+ continue;
+ }
+
+ if (key == QLatin1String("selected") && val) {
+ state |= QStyle::State_Selected;
+ state |= QStyle::State_Enabled | QStyle::State_HasFocus;
+ continue;
+ }
+
+ if (key == QLatin1String("active") && val) {
+ state |= QStyle::State_Active;
+ continue;
+ }
+
+ // Keep misspelling for compatibility
+ if (key == QLatin1String("backgroud") && val)
+ return -1;
+ }
+ return state;
+}
+
+QAndroidStyle::AndroidLayerDrawable::AndroidLayerDrawable(const QVariantMap &drawable,
+ QAndroidStyle::ItemType itemType)
+ : AndroidDrawable(drawable, itemType)
+{
+ QVariantList layers = drawable.value(QLatin1String("layers")).toList();
+ foreach (QVariant layer, layers) {
+ QVariantMap layerMap = layer.toMap();
+ AndroidDrawable *ad = fromMap(layerMap, itemType);
+ if (ad) {
+ LayerType l;
+ l.second = ad;
+ l.first = layerMap.value(QLatin1String("id")).toInt();
+ m_layers << l;
+ }
+ }
+}
+
+QAndroidStyle::AndroidLayerDrawable::~AndroidLayerDrawable()
+{
+ foreach (const LayerType &layer, m_layers)
+ delete layer.second;
+}
+
+QAndroidStyle::AndroidDrawableType QAndroidStyle::AndroidLayerDrawable::type() const
+{
+ return QAndroidStyle::Layer;
+}
+
+void QAndroidStyle::AndroidLayerDrawable::draw(QPainter *painter, const QStyleOption *opt) const
+{
+ foreach (const LayerType &layer, m_layers)
+ layer.second->draw(painter, opt);
+}
+
+QAndroidStyle::AndroidDrawable *QAndroidStyle::AndroidLayerDrawable::layer(int id) const
+{
+ foreach (const LayerType &layer, m_layers)
+ if (layer.first == id)
+ return layer.second;
+ return 0;
+}
+
+QSize QAndroidStyle::AndroidLayerDrawable::size() const
+{
+ QSize sz;
+ foreach (const LayerType &layer, m_layers)
+ sz = sz.expandedTo(layer.second->size());
+ return sz;
+}
+
+QAndroidStyle::AndroidControl::AndroidControl(const QVariantMap &control,
+ QAndroidStyle::ItemType itemType)
+{
+ QVariantMap::const_iterator it = control.find(QLatin1String("View_background"));
+ if (it != control.end())
+ m_background = AndroidDrawable::fromMap(it.value().toMap(), itemType);
+ else
+ m_background = 0;
+
+ it = control.find(QLatin1String("View_minWidth"));
+ if (it!=control.end())
+ m_minSize.setWidth(it.value().toInt());
+
+ it = control.find(QLatin1String("View_minHeight"));
+ if (it != control.end())
+ m_minSize.setHeight(it.value().toInt());
+
+ it = control.find(QLatin1String("View_maxWidth"));
+ if (it != control.end())
+ m_maxSize.setWidth(it.value().toInt());
+
+ it = control.find(QLatin1String("View_maxHeight"));
+ if (it != control.end())
+ m_maxSize.setHeight(it.value().toInt());
+}
+
+QAndroidStyle::AndroidControl::~AndroidControl()
+{
+ delete m_background;
+}
+
+void QAndroidStyle::AndroidControl::drawControl(const QStyleOption *opt, QPainter *p, const QWidget * /* w */)
+{
+ if (m_background)
+ m_background->draw(p, opt);
+}
+
+QRect QAndroidStyle::AndroidControl::subElementRect(QStyle::SubElement /* subElement */,
+ const QStyleOption *option,
+ const QWidget * /* widget */) const
+{
+ if (const AndroidDrawable *drawable=m_background) {
+ if (drawable->type() == State)
+ drawable = static_cast<const AndroidStateDrawable *>(m_background)->bestAndroidStateMatch(option);
+
+ const QMargins &padding = drawable->padding();
+
+ QRect r = option->rect.adjusted(padding.left(), padding.top(),
+ -padding.right(), -padding.bottom());
+
+ if (r.width() < m_minSize.width())
+ r.setWidth(m_minSize.width());
+
+ if (r.height() < m_minSize.height())
+ r.setHeight(m_minSize.height());
+
+ return visualRect(option->direction, option->rect, r);
+ }
+ return option->rect;
+
+}
+
+QRect QAndroidStyle::AndroidControl::subControlRect(const QStyleOptionComplex *option,
+ QStyle::SubControl /*sc*/,
+ const QWidget *widget) const
+{
+ return subElementRect(QStyle::SE_CustomBase, option, widget);
+}
+
+QSize QAndroidStyle::AndroidControl::sizeFromContents(const QStyleOption *opt,
+ const QSize &contentsSize,
+ const QWidget * /* w */) const
+{
+ QSize sz;
+ if (const AndroidDrawable *drawable=m_background) {
+
+ if (drawable->type() == State)
+ drawable = static_cast<const AndroidStateDrawable*>(m_background)->bestAndroidStateMatch(opt);
+ const QMargins &padding = drawable->padding();
+ sz.setWidth(padding.left() + padding.right());
+ sz.setHeight(padding.top() + padding.bottom());
+ if (sz.isEmpty())
+ sz = drawable->size();
+ }
+ sz += contentsSize;
+ if (contentsSize.height() < opt->fontMetrics.height())
+ sz.setHeight(sz.height() + (opt->fontMetrics.height() - contentsSize.height()));
+ if (sz.height() < m_minSize.height())
+ sz.setHeight(m_minSize.height());
+ if (sz.width() < m_minSize.width())
+ sz.setWidth(m_minSize.width());
+ return sz;
+}
+
+QMargins QAndroidStyle::AndroidControl::padding()
+{
+ if (const AndroidDrawable *drawable = m_background)
+ {
+ if (drawable->type() == State)
+ drawable=static_cast<const AndroidStateDrawable *>(m_background)->bestAndroidStateMatch(0);
+ return drawable->padding();
+ }
+ return QMargins();
+}
+
+QAndroidStyle::AndroidCompoundButtonControl::AndroidCompoundButtonControl(const QVariantMap &control,
+ ItemType itemType)
+ : AndroidControl(control, itemType)
+{
+ QVariantMap::const_iterator it = control.find(QLatin1String("CompoundButton_button"));
+ if (it != control.end())
+ m_button = AndroidDrawable::fromMap(it.value().toMap(), itemType);
+ else
+ m_button = 0;
+}
+
+QAndroidStyle::AndroidCompoundButtonControl::~AndroidCompoundButtonControl()
+{
+ delete m_button;
+}
+
+void QAndroidStyle::AndroidCompoundButtonControl::drawControl(const QStyleOption *opt,
+ QPainter *p,
+ const QWidget *w)
+{
+ AndroidControl::drawControl(opt, p, w);
+ if (m_button)
+ m_button->draw(p, opt);
+}
+
+QAndroidStyle::AndroidProgressBarControl::AndroidProgressBarControl(const QVariantMap &control,
+ ItemType itemType)
+ : AndroidControl(control, itemType)
+{
+ QVariantMap::const_iterator it = control.find(QLatin1String("ProgressBar_indeterminateDrawable"));
+ if (it != control.end())
+ m_indeterminateDrawable = AndroidDrawable::fromMap(it.value().toMap(), itemType);
+ else
+ m_indeterminateDrawable = 0;
+
+ it = control.find(QLatin1String("ProgressBar_progressDrawable"));
+ if (it != control.end())
+ m_progressDrawable = AndroidDrawable::fromMap(it.value().toMap(), itemType);
+ else
+ m_progressDrawable = 0;
+
+ it = control.find(QLatin1String("ProgressBar_progress_id"));
+ if (it != control.end())
+ m_progressId = it.value().toInt();
+
+ it = control.find(QLatin1String("ProgressBar_secondaryProgress_id"));
+ if (it != control.end())
+ m_secondaryProgress_id = it.value().toInt();
+
+ it = control.find(QLatin1String("ProgressBar_minWidth"));
+ if (it != control.end())
+ m_minSize.setWidth(it.value().toInt());
+
+ it = control.find(QLatin1String("ProgressBar_minHeight"));
+ if (it != control.end())
+ m_minSize.setHeight(it.value().toInt());
+
+ it = control.find(QLatin1String("ProgressBar_maxWidth"));
+ if (it != control.end())
+ m_maxSize.setWidth(it.value().toInt());
+
+ it = control.find(QLatin1String("ProgressBar_maxHeight"));
+ if (it != control.end())
+ m_maxSize.setHeight(it.value().toInt());
+}
+
+QAndroidStyle::AndroidProgressBarControl::~AndroidProgressBarControl()
+{
+ delete m_progressDrawable;
+ delete m_indeterminateDrawable;
+}
+
+void QAndroidStyle::AndroidProgressBarControl::drawControl(const QStyleOption *option, QPainter *p, const QWidget * /* w */)
+{
+ if (!m_progressDrawable)
+ return;
+
+ if (const QStyleOptionProgressBar *progressBarOption =
+ qstyleoption_cast<const QStyleOptionProgressBar *>(option)) {
+ QStyleOptionProgressBarV2 progressBarV2(*progressBarOption);
+ if (m_progressDrawable->type() == QAndroidStyle::Layer) {
+ QAndroidStyle::AndroidDrawable *clipDrawable = static_cast<QAndroidStyle::AndroidLayerDrawable *>(m_progressDrawable)->layer(m_progressId);
+ if (clipDrawable->type() == QAndroidStyle::Clip)
+ static_cast<QAndroidStyle::AndroidClipDrawable *>(clipDrawable)->setFactor(double(progressBarV2.progress/(progressBarV2.maximum-progressBarV2.minimum)),
+ progressBarV2.orientation);
+ }
+ m_progressDrawable->draw(p, option);
+ }
+}
+
+QRect QAndroidStyle::AndroidProgressBarControl::subElementRect(QStyle::SubElement subElement,
+ const QStyleOption *option,
+ const QWidget *widget) const
+{
+ if (const QStyleOptionProgressBar *progressBarOption =
+ qstyleoption_cast<const QStyleOptionProgressBar *>(option)) {
+ QStyleOptionProgressBarV2 progressBarV2(*progressBarOption);
+ const bool horizontal = progressBarV2.orientation == Qt::Vertical;
+ if (!m_background)
+ return option->rect;
+
+ QMargins padding = m_background->padding();
+ QRect p(padding.left(), padding.top(), padding.right()-padding.left(), padding.bottom()-padding.top());
+ padding = m_indeterminateDrawable->padding();
+ p |= QRect(padding.left(), padding.top(), padding.right()-padding.left(), padding.bottom()-padding.top());
+ padding = m_progressDrawable->padding();
+ p |= QRect(padding.left(), padding.top(), padding.right()-padding.left(), padding.bottom()-padding.top());
+
+ QRect r = option->rect.adjusted(p.left(), p.top(), -p.right(), -p.bottom());
+
+ if (horizontal) {
+ if (r.height()<m_minSize.height())
+ r.setHeight(m_minSize.height());
+
+ if (r.height()>m_maxSize.height())
+ r.setHeight(m_maxSize.height());
+ } else {
+ if (r.width()<m_minSize.width())
+ r.setWidth(m_minSize.width());
+
+ if (r.width()>m_maxSize.width())
+ r.setWidth(m_maxSize.width());
+ }
+ return visualRect(option->direction, option->rect, r);
+ }
+ return AndroidControl::subElementRect(subElement, option, widget);
+}
+
+QSize QAndroidStyle::AndroidProgressBarControl::sizeFromContents(const QStyleOption *opt,
+ const QSize &contentsSize,
+ const QWidget * /* w */) const
+{
+ QSize sz(contentsSize);
+ if (sz.height() < m_minSize.height())
+ sz.setHeight(m_minSize.height());
+ if (sz.width() < m_minSize.width())
+ sz.setWidth(m_minSize.width());
+
+ if (const QStyleOptionProgressBar *progressBarOption =
+ qstyleoption_cast<const QStyleOptionProgressBar *>(opt)) {
+ QStyleOptionProgressBarV2 progressBarV2(*progressBarOption);
+ if (progressBarV2.orientation == Qt::Vertical) {
+ if (sz.height() > m_maxSize.height())
+ sz.setHeight(m_maxSize.height());
+ } else {
+ if (sz.width() > m_maxSize.width())
+ sz.setWidth(m_maxSize.width());
+ }
+ }
+ return contentsSize;
+}
+
+QAndroidStyle::AndroidSeekBarControl::AndroidSeekBarControl(const QVariantMap &control,
+ ItemType itemType)
+ : AndroidProgressBarControl(control, itemType)
+{
+ QVariantMap::const_iterator it = control.find(QLatin1String("SeekBar_thumb"));
+ if (it != control.end())
+ m_seekBarThumb = AndroidDrawable::fromMap(it.value().toMap(), itemType);
+ else
+ m_seekBarThumb = 0;
+}
+
+QAndroidStyle::AndroidSeekBarControl::~AndroidSeekBarControl()
+{
+ delete m_seekBarThumb;
+}
+
+void QAndroidStyle::AndroidSeekBarControl::drawControl(const QStyleOption *option,
+ QPainter *p,
+ const QWidget * /* w */)
+{
+ if (!m_seekBarThumb || !m_progressDrawable)
+ return;
+
+ if (const QStyleOptionSlider *styleOption =
+ qstyleoption_cast<const QStyleOptionSlider *>(option)) {
+ double factor = double(styleOption->sliderPosition/(styleOption->maximum-styleOption->minimum));
+ if (m_progressDrawable->type()==QAndroidStyle::Layer) {
+ QAndroidStyle::AndroidDrawable *clipDrawable = static_cast<QAndroidStyle::AndroidLayerDrawable *>(m_progressDrawable)->layer(m_progressId);
+ if (clipDrawable->type() == QAndroidStyle::Clip)
+ static_cast<QAndroidStyle::AndroidClipDrawable *>(clipDrawable)->setFactor(factor, styleOption->orientation);
+ }
+ const AndroidDrawable *drawable=m_seekBarThumb;
+ if (drawable->type() == State)
+ drawable = static_cast<const QAndroidStyle::AndroidStateDrawable *>(m_seekBarThumb)->bestAndroidStateMatch(option);
+ QStyleOption copy(*option);
+ copy.rect.setY((copy.rect.height()-m_minSize.height())/2);
+ copy.rect.setHeight(m_minSize.height());
+ copy.rect.setWidth(copy.rect.width()-drawable->size().width());
+ copy.rect.translate(drawable->size().width()/2,0);
+ m_progressDrawable->draw(p, &copy);
+ if (styleOption->orientation == Qt::Vertical)
+ qCritical() << "Vertical slider are not supported";
+ int pos = (double(copy.rect.width()*factor - drawable->size().width()) / 2);
+ copy.rect.translate(pos, 0);
+ copy.rect.setSize(drawable->size());
+ m_seekBarThumb->draw(p, &copy);
+ }
+}
+
+QSize QAndroidStyle::AndroidSeekBarControl::sizeFromContents(const QStyleOption *opt,
+ const QSize &contentsSize,
+ const QWidget *w) const
+{
+ QSize sz = AndroidProgressBarControl::sizeFromContents(opt, contentsSize, w);
+ if (!m_seekBarThumb)
+ return sz;
+ const AndroidDrawable *drawable=m_seekBarThumb;
+ if (drawable->type() == State)
+ drawable = static_cast<const QAndroidStyle::AndroidStateDrawable *>(m_seekBarThumb)->bestAndroidStateMatch(opt);
+ return sz.expandedTo(drawable->size());
+}
+
+QRect QAndroidStyle::AndroidSeekBarControl::subControlRect(const QStyleOptionComplex *option,
+ SubControl sc,
+ const QWidget * /* widget */) const
+{
+ const QStyleOptionSlider *styleOption =
+ qstyleoption_cast<const QStyleOptionSlider *>(option);
+
+ if (m_seekBarThumb && sc == SC_SliderHandle && styleOption) {
+ const AndroidDrawable *drawable = m_seekBarThumb;
+ if (drawable->type() == State)
+ drawable = static_cast<const QAndroidStyle::AndroidStateDrawable *>(m_seekBarThumb)->bestAndroidStateMatch(option);
+
+ QRect r(option->rect);
+ double factor = double(styleOption->sliderPosition/(styleOption->maximum-styleOption->minimum));
+ int pos=(double(option->rect.width()*factor - drawable->size().width()) / 2);
+ r.setX(r.x()+pos);
+ r.setSize(drawable->size());
+ return r;
+ }
+ return option->rect;
+}
+
+QAndroidStyle::AndroidSpinnerControl::AndroidSpinnerControl(const QVariantMap &control,
+ QAndroidStyle::ItemType itemType)
+ : AndroidControl(control, itemType)
+{}
+
+QRect QAndroidStyle::AndroidSpinnerControl::subControlRect(const QStyleOptionComplex *option,
+ SubControl sc,
+ const QWidget *widget) const
+{
+ if (sc == QStyle::SC_ComboBoxListBoxPopup)
+ return option->rect;
+ return AndroidControl::subControlRect(option, sc, widget);
+}
+
+QT_END_NAMESPACE
+
+#endif // !defined(QT_NO_STYLE_ANDROID) || defined(QT_PLUGIN)
diff --git a/src/widgets/styles/qandroidstyle_p.h b/src/widgets/styles/qandroidstyle_p.h
new file mode 100644
index 0000000000..2d9abd65c5
--- /dev/null
+++ b/src/widgets/styles/qandroidstyle_p.h
@@ -0,0 +1,382 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 BogDan Vatra <bogdan@kde.org>
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtWidgets module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 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, Digia gives you certain additional
+** rights. These rights are described in the Digia 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.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QANDROIDSTYLE_P_H
+#define QANDROIDSTYLE_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of qstylefactory.cpp. This header may change from version to version
+// without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtCore/QList>
+#include <QtCore/QMargins>
+#include <QtWidgets/QCommonStyle>
+#include <QtCore/QHash>
+#include <QtCore/QVariantMap>
+
+QT_BEGIN_NAMESPACE
+
+#if !defined(QT_NO_STYLE_ANDROID)
+
+class Q_WIDGETS_EXPORT QAndroidStyle : public QCommonStyle
+{
+ Q_OBJECT
+
+public:
+ enum ItemType
+ {
+ QC_UnknownType = -1,
+ QC_View,
+ QC_GroupBox,
+ QC_Button,
+ QC_Checkbox,
+ QC_RadioButton,
+ QC_Slider,
+ QC_Switch,
+ QC_EditText,
+ QC_Combobox,
+ QC_BusyIndicator,
+ QC_ProgressBar,
+ QC_Tab,
+ QC_TabButton,
+ QC_RatingIndicator,
+ QC_SearchBox,
+ QC_CustomCOntrol=0xf00,
+ QC_ControlMask=0xfff
+ };
+
+ struct Android9PatchChunk
+ {
+ QVector<int> xDivs;
+ QVector<int> yDivs;
+ QVector<int> colors;
+ };
+
+ struct AndroidItemStateInfo
+ {
+ AndroidItemStateInfo():state(0){}
+ int state;
+ QByteArray filePath;
+ QByteArray hashKey;
+ Android9PatchChunk chunkData;
+ QSize size;
+ QMargins padding;
+ };
+
+ enum AndroidDrawableType
+ {
+ Color,
+ Image,
+ Clip,
+ NinePatch,
+ Gradient,
+ State,
+ Layer
+ };
+
+ class AndroidDrawable
+ {
+ public:
+ AndroidDrawable(const QVariantMap &drawable, ItemType itemType);
+ virtual ~AndroidDrawable();
+ virtual void initPadding(const QVariantMap &drawable);
+ virtual AndroidDrawableType type() const = 0;
+ virtual void draw(QPainter *painter,const QStyleOption *opt) const = 0;
+ const QMargins &padding() const;
+ virtual QSize size() const;
+ static AndroidDrawable *fromMap(const QVariantMap &drawable, ItemType itemType);
+ static QMargins extractMargins(const QVariantMap &value);
+ protected:
+ ItemType m_itemType;
+ QMargins m_padding;
+ };
+
+ class AndroidColorDrawable: public AndroidDrawable
+ {
+ public:
+ AndroidColorDrawable(const QVariantMap &drawable, ItemType itemType);
+ virtual AndroidDrawableType type() const;
+ virtual void draw(QPainter *painter,const QStyleOption *opt) const;
+
+ protected:
+ QColor m_color;
+ };
+
+ class AndroidImageDrawable: public AndroidDrawable
+ {
+ public:
+ AndroidImageDrawable(const QVariantMap &drawable, ItemType itemType);
+ virtual AndroidDrawableType type() const;
+ virtual void draw(QPainter *painter,const QStyleOption *opt) const;
+ virtual QSize size() const;
+
+ protected:
+ QString m_filePath;
+ mutable QString m_hashKey;
+ QSize m_size;
+ };
+
+ class Android9PatchDrawable: public AndroidImageDrawable
+ {
+ public:
+ Android9PatchDrawable(const QVariantMap &drawable, ItemType itemType);
+ virtual AndroidDrawableType type() const;
+ virtual void draw(QPainter *painter, const QStyleOption *opt) const;
+ private:
+ static int calculateStretch(int boundsLimit, int startingPoint,
+ int srcSpace, int numStrechyPixelsRemaining,
+ int numFixedPixelsRemaining);
+ void extractIntArray(const QVariantList &values, QVector<int> &array);
+ private:
+ Android9PatchChunk m_chunkData;
+ };
+
+ class AndroidGradientDrawable: public AndroidDrawable
+ {
+ public:
+ enum GradientOrientation
+ {
+ TOP_BOTTOM,
+ TR_BL,
+ RIGHT_LEFT,
+ BR_TL,
+ BOTTOM_TOP,
+ BL_TR,
+ LEFT_RIGHT,
+ TL_BR
+ };
+
+ public:
+ AndroidGradientDrawable(const QVariantMap &drawable, ItemType itemType);
+ virtual AndroidDrawableType type() const;
+ virtual void draw(QPainter *painter, const QStyleOption *opt) const;
+ QSize size() const;
+ private:
+ mutable QLinearGradient m_gradient;
+ GradientOrientation m_orientation;
+ int m_radius;
+ };
+
+ class AndroidClipDrawable: public AndroidDrawable
+ {
+ public:
+ AndroidClipDrawable(const QVariantMap &drawable, ItemType itemType);
+ ~AndroidClipDrawable();
+ virtual AndroidDrawableType type() const;
+ virtual void setFactor(double factor, Qt::Orientation orientation);
+ virtual void draw(QPainter *painter, const QStyleOption *opt) const;
+
+ private:
+ double m_factor;
+ Qt::Orientation m_orientation;
+ const AndroidDrawable *m_drawable;
+ };
+
+ class AndroidStateDrawable: public AndroidDrawable
+ {
+ public:
+ AndroidStateDrawable(const QVariantMap &drawable, ItemType itemType);
+ ~AndroidStateDrawable();
+ virtual AndroidDrawableType type() const;
+ virtual void draw(QPainter *painter, const QStyleOption *opt) const;
+ inline const AndroidDrawable *bestAndroidStateMatch(const QStyleOption *opt) const;
+ static int extractState(const QVariantMap &value);
+
+ private:
+ typedef QPair<int, const AndroidDrawable *> StateType;
+ QList<StateType> m_states;
+ };
+
+ class AndroidLayerDrawable: public AndroidDrawable
+ {
+ public:
+ AndroidLayerDrawable(const QVariantMap &drawable, QAndroidStyle::ItemType itemType);
+ ~AndroidLayerDrawable();
+ virtual AndroidDrawableType type() const;
+ virtual void draw(QPainter *painter, const QStyleOption *opt) const;
+ AndroidDrawable *layer(int id) const;
+ QSize size() const;
+ private:
+ typedef QPair<int, AndroidDrawable *> LayerType;
+ QList<LayerType> m_layers;
+ };
+
+ class AndroidControl
+ {
+ public:
+ AndroidControl(const QVariantMap &control, ItemType itemType);
+ virtual ~AndroidControl();
+ virtual void drawControl(const QStyleOption *opt, QPainter *p, const QWidget *w);
+ virtual QRect subElementRect(SubElement subElement,
+ const QStyleOption *option,
+ const QWidget *widget = 0) const;
+ virtual QRect subControlRect(const QStyleOptionComplex *option,
+ SubControl sc,
+ const QWidget *widget = 0) const;
+ virtual QSize sizeFromContents(const QStyleOption *opt,
+ const QSize &contentsSize,
+ const QWidget *w) const;
+ virtual QMargins padding();
+ protected:
+ const AndroidDrawable *m_background;
+ QSize m_minSize;
+ QSize m_maxSize;
+ };
+
+ class AndroidCompoundButtonControl : public AndroidControl
+ {
+ public:
+ AndroidCompoundButtonControl(const QVariantMap &control, ItemType itemType);
+ virtual ~AndroidCompoundButtonControl();
+ virtual void drawControl(const QStyleOption *opt, QPainter *p, const QWidget *w);
+
+ protected:
+ const AndroidDrawable *m_button;
+ };
+
+ class AndroidProgressBarControl : public AndroidControl
+ {
+ public:
+ AndroidProgressBarControl(const QVariantMap &control, ItemType itemType);
+ virtual ~AndroidProgressBarControl();
+ virtual void drawControl(const QStyleOption *option, QPainter *p, const QWidget *w);
+ virtual QRect subElementRect(SubElement subElement,
+ const QStyleOption *option,
+ const QWidget *widget = 0) const;
+
+ QSize sizeFromContents(const QStyleOption *opt,
+ const QSize &contentsSize,
+ const QWidget *w) const;
+ protected:
+ AndroidDrawable *m_progressDrawable;
+ AndroidDrawable *m_indeterminateDrawable;
+ int m_secondaryProgress_id;
+ int m_progressId;
+ };
+
+ class AndroidSeekBarControl : public AndroidProgressBarControl
+ {
+ public:
+ AndroidSeekBarControl(const QVariantMap &control, ItemType itemType);
+ virtual ~AndroidSeekBarControl();
+ virtual void drawControl(const QStyleOption *option, QPainter *p, const QWidget *w);
+ QSize sizeFromContents(const QStyleOption *opt,
+ const QSize &contentsSize, const QWidget *w) const;
+ QRect subControlRect(const QStyleOptionComplex *option, SubControl sc,
+ const QWidget *widget = 0) const;
+ private:
+ AndroidDrawable *m_seekBarThumb;
+ };
+
+ class AndroidSpinnerControl : public AndroidControl
+ {
+ public:
+ AndroidSpinnerControl(const QVariantMap &control, ItemType itemType);
+ virtual ~AndroidSpinnerControl(){}
+ virtual QRect subControlRect(const QStyleOptionComplex *option,
+ SubControl sc,
+ const QWidget *widget = 0) const;
+ };
+
+ typedef QList<AndroidItemStateInfo *> AndroidItemStateInfoList;
+
+public:
+ QAndroidStyle();
+ ~QAndroidStyle();
+
+ virtual void drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPainter *p,
+ const QWidget *w = 0) const;
+
+ virtual void drawControl(QStyle::ControlElement element, const QStyleOption *opt, QPainter *p,
+ const QWidget *w = 0) const;
+
+ virtual QRect subElementRect(SubElement subElement, const QStyleOption *option,
+ const QWidget *widget = 0) const;
+ virtual void drawComplexControl(ComplexControl cc, const QStyleOptionComplex *opt, QPainter *p,
+ const QWidget *widget = 0) const;
+ virtual SubControl hitTestComplexControl(ComplexControl cc, const QStyleOptionComplex *opt,
+ const QPoint &pt, const QWidget *widget = 0) const;
+ virtual QRect subControlRect(ComplexControl cc, const QStyleOptionComplex *opt,
+ SubControl sc, const QWidget *widget = 0) const;
+
+ virtual int pixelMetric(PixelMetric metric, const QStyleOption *option = 0,
+ const QWidget *widget = 0) const;
+
+ virtual QSize sizeFromContents(ContentsType ct, const QStyleOption *opt,
+ const QSize &contentsSize, const QWidget *w = 0) const;
+
+ virtual QPixmap standardPixmap(StandardPixmap standardPixmap, const QStyleOption *opt = 0,
+ const QWidget *widget = 0) const;
+
+ virtual QPixmap generatedIconPixmap(QIcon::Mode iconMode, const QPixmap &pixmap,
+ const QStyleOption *opt) const;
+
+ virtual QPalette standardPalette() const;
+private:
+ Q_DISABLE_COPY(QAndroidStyle)
+ static ItemType qtControl(QStyle::ComplexControl control);
+ static ItemType qtControl(QStyle::ContentsType contentsType);
+ static ItemType qtControl(QStyle::ControlElement controlElement);
+ static ItemType qtControl(QStyle::PrimitiveElement primitiveElement);
+ static ItemType qtControl(QStyle::SubElement subElement);
+ static ItemType qtControl(const QString &android);
+
+ static void setPaletteColor(const QVariantMap &object,
+ QPalette &palette,
+ QPalette::ColorRole role);
+private:
+ typedef QHash<int, AndroidControl *> AndroidControlsHash;
+ AndroidControlsHash m_androidControlsHash;
+ QPalette m_standardPalette;
+};
+
+#endif // QT_NO_STYLE_ANDROID
+
+QT_END_NAMESPACE
+
+#endif // QANDROIDSTYLE_P_H
diff --git a/src/widgets/styles/qcommonstyle.cpp b/src/widgets/styles/qcommonstyle.cpp
index 4b6ba17595..1af909a3cb 100644
--- a/src/widgets/styles/qcommonstyle.cpp
+++ b/src/widgets/styles/qcommonstyle.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -2138,9 +2138,9 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
p->save();
p->setClipRect(opt->rect);
- QRect checkRect = subElementRect(SE_ItemViewItemCheckIndicator, vopt, widget);
- QRect iconRect = subElementRect(SE_ItemViewItemDecoration, vopt, widget);
- QRect textRect = subElementRect(SE_ItemViewItemText, vopt, widget);
+ QRect checkRect = proxy()->subElementRect(SE_ItemViewItemCheckIndicator, vopt, widget);
+ QRect iconRect = proxy()->subElementRect(SE_ItemViewItemDecoration, vopt, widget);
+ QRect textRect = proxy()->subElementRect(SE_ItemViewItemText, vopt, widget);
// draw the background
proxy()->drawPrimitive(PE_PanelItemViewItem, opt, p, widget);
@@ -3003,7 +3003,7 @@ QRect QCommonStyle::subElementRect(SubElement sr, const QStyleOption *opt,
case SE_ToolBarHandle:
if (const QStyleOptionToolBar *tbopt = qstyleoption_cast<const QStyleOptionToolBar *>(opt)) {
if (tbopt->features & QStyleOptionToolBar::Movable) {
- ///we need to access the widget here because the style option doesn't
+ ///we need to access the widget here because the style option doesn't
//have all the information we need (ie. the layout's margin)
const QToolBar *tb = qobject_cast<const QToolBar*>(widget);
const int margin = tb && tb->layout() ? tb->layout()->margin() : 2;
@@ -4808,6 +4808,16 @@ QSize QCommonStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt,
}
break;
#endif // QT_NO_ITEMVIEWS
+#ifndef QT_NO_SPINBOX
+ case CT_SpinBox:
+ if (const QStyleOptionSpinBox *vopt = qstyleoption_cast<const QStyleOptionSpinBox *>(opt)) {
+ // Add button + frame widths
+ int buttonWidth = 20;
+ int fw = vopt->frame ? proxy()->pixelMetric(PM_SpinBoxFrameWidth, vopt, widget) : 0;
+ sz += QSize(buttonWidth + 2*fw, 2*fw);
+ }
+ break;
+#endif
case CT_ScrollBar:
case CT_MenuBar:
case CT_Menu:
@@ -5090,11 +5100,18 @@ int QCommonStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget
ret = theme->themeHint(QPlatformTheme::ToolButtonStyle).toInt();
break;
case SH_RequestSoftwareInputPanel:
+#ifdef Q_OS_ANDROID
+ ret = RSIP_OnMouseClick;
+#else
ret = RSIP_OnMouseClickAndAlreadyFocused;
+#endif
break;
case SH_ScrollBar_Transient:
ret = false;
break;
+ case SH_Menu_SupportsSections:
+ ret = false;
+ break;
default:
ret = 0;
break;
diff --git a/src/widgets/styles/qcommonstyle.h b/src/widgets/styles/qcommonstyle.h
index 1d203ded34..942721a6a3 100644
--- a/src/widgets/styles/qcommonstyle.h
+++ b/src/widgets/styles/qcommonstyle.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -44,8 +44,6 @@
#include <QtWidgets/qstyle.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
class QCommonStylePrivate;
@@ -53,7 +51,7 @@ class QCommonStylePrivate;
class Q_WIDGETS_EXPORT QCommonStyle: public QStyle
{
Q_OBJECT
-
+
public:
QCommonStyle();
~QCommonStyle();
@@ -105,6 +103,4 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QCOMMONSTYLE_H
diff --git a/src/widgets/styles/qcommonstyle_p.h b/src/widgets/styles/qcommonstyle_p.h
index dbb4d3cd37..979c2a5548 100644
--- a/src/widgets/styles/qcommonstyle_p.h
+++ b/src/widgets/styles/qcommonstyle_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/styles/qcommonstylepixmaps_p.h b/src/widgets/styles/qcommonstylepixmaps_p.h
index 0699ff8914..d47b16d1a4 100644
--- a/src/widgets/styles/qcommonstylepixmaps_p.h
+++ b/src/widgets/styles/qcommonstylepixmaps_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -39,6 +39,8 @@
**
****************************************************************************/
+#include <QtCore/qglobal.h>
+
#ifndef QT_NO_IMAGEFORMAT_XPM
//
diff --git a/src/widgets/styles/qdrawutil.cpp b/src/widgets/styles/qdrawutil.cpp
index 0f73a16bcb..3df3bfa50d 100644
--- a/src/widgets/styles/qdrawutil.cpp
+++ b/src/widgets/styles/qdrawutil.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -748,10 +748,10 @@ void qDrawPlainRect(QPainter *p, const QRect &r, const QColor &c,
\since 4.6
\inmodule QtWidgets
-
+
\brief The QTileRules class provides the rules used to draw a
pixmap or image split into nine segments.
-
+
Spliiting is similar to \l{http://www.w3.org/TR/css3-background/}{CSS3 border-images}.
\sa Qt::TileRule, QMargins
diff --git a/src/widgets/styles/qdrawutil.h b/src/widgets/styles/qdrawutil.h
index f0cc98f54a..6e9dc26591 100644
--- a/src/widgets/styles/qdrawutil.h
+++ b/src/widgets/styles/qdrawutil.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -46,8 +46,6 @@
#include <QtCore/qstring.h> // char*->QString conversion
#include <QtCore/qmargins.h>
#include <QtGui/qpixmap.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -169,6 +167,4 @@ inline void qDrawBorderPixmap(QPainter *painter,
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QDRAWUTIL_H
diff --git a/src/widgets/styles/qfusionstyle.cpp b/src/widgets/styles/qfusionstyle.cpp
index 11558de16a..0ba9ec38c0 100644
--- a/src/widgets/styles/qfusionstyle.cpp
+++ b/src/widgets/styles/qfusionstyle.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -1768,12 +1768,10 @@ void QFusionStyle::drawControl(ControlElement element, const QStyleOption *optio
painter->save();
{
painter->fillRect(rect, option->palette.window());
- if (widget && qobject_cast<const QMainWindow *>(widget->parentWidget())) {
- QColor shadow = mergedColors(option->palette.background().color().darker(120),
- outline.lighter(140), 60);
- painter->setPen(QPen(shadow));
- painter->drawLine(option->rect.bottomLeft(), option->rect.bottomRight());
- }
+ QColor shadow = mergedColors(option->palette.background().color().darker(120),
+ outline.lighter(140), 60);
+ painter->setPen(QPen(shadow));
+ painter->drawLine(option->rect.bottomLeft(), option->rect.bottomRight());
}
painter->restore();
break;
@@ -3475,6 +3473,7 @@ int QFusionStyle::styleHint(StyleHint hint, const QStyleOption *option, const QW
case SH_ItemView_ChangeHighlightOnFocus:
case SH_MenuBar_MouseTracking:
case SH_Menu_MouseTracking:
+ case SH_Menu_SupportsSections:
return 1;
case SH_ToolBox_SelectedPageTitleBold:
diff --git a/src/widgets/styles/qfusionstyle_p.h b/src/widgets/styles/qfusionstyle_p.h
index e024677a9b..9e5a55918d 100644
--- a/src/widgets/styles/qfusionstyle_p.h
+++ b/src/widgets/styles/qfusionstyle_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -44,8 +44,6 @@
#include <QtWidgets/qcommonstyle.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -106,6 +104,4 @@ protected:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif //QFUSIONSTYLE_P_H
diff --git a/src/widgets/styles/qfusionstyle_p_p.h b/src/widgets/styles/qfusionstyle_p_p.h
index d3f2ff5f40..acdf409dbf 100644
--- a/src/widgets/styles/qfusionstyle_p_p.h
+++ b/src/widgets/styles/qfusionstyle_p_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -88,9 +88,9 @@ public:
// On mac we want a standard blue color used when the system palette is used
bool isMacSystemPalette(const QPalette &pal) const {
Q_UNUSED(pal);
-#ifdef Q_OS_MAC
+#if defined(Q_OS_MAC) && !defined(Q_OS_IOS)
const QPalette *themePalette = QGuiApplicationPrivate::platformTheme()->palette();
- if (themePalette->color(QPalette::Normal, QPalette::Highlight) ==
+ if (themePalette && themePalette->color(QPalette::Normal, QPalette::Highlight) ==
pal.color(QPalette::Normal, QPalette::Highlight) &&
themePalette->color(QPalette::Normal, QPalette::HighlightedText) ==
pal.color(QPalette::Normal, QPalette::HighlightedText))
diff --git a/src/widgets/styles/qgtk2painter.cpp b/src/widgets/styles/qgtk2painter.cpp
index 4d00a7385e..7b9bd975d8 100644
--- a/src/widgets/styles/qgtk2painter.cpp
+++ b/src/widgets/styles/qgtk2painter.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/styles/qgtk2painter_p.h b/src/widgets/styles/qgtk2painter_p.h
index 286430cd33..f1444a87de 100644
--- a/src/widgets/styles/qgtk2painter_p.h
+++ b/src/widgets/styles/qgtk2painter_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/styles/qgtkglobal_p.h b/src/widgets/styles/qgtkglobal_p.h
index 24da8c8e64..06ed7cfce4 100644
--- a/src/widgets/styles/qgtkglobal_p.h
+++ b/src/widgets/styles/qgtkglobal_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/styles/qgtkpainter.cpp b/src/widgets/styles/qgtkpainter.cpp
index dac98a199c..a733049f65 100644
--- a/src/widgets/styles/qgtkpainter.cpp
+++ b/src/widgets/styles/qgtkpainter.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/styles/qgtkpainter_p.h b/src/widgets/styles/qgtkpainter_p.h
index 58833b7c95..12d4dc9bc4 100644
--- a/src/widgets/styles/qgtkpainter_p.h
+++ b/src/widgets/styles/qgtkpainter_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/styles/qgtkstyle.cpp b/src/widgets/styles/qgtkstyle.cpp
index 159f8dce83..15fa00d8a6 100644
--- a/src/widgets/styles/qgtkstyle.cpp
+++ b/src/widgets/styles/qgtkstyle.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -2121,7 +2121,7 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom
label.state = bflags;
GtkWidget *gtkButton = d->gtkWidget("GtkToolButton.GtkButton");
QPalette pal = toolbutton->palette;
- if (option->state & State_Enabled &&
+ if (option->state & State_Enabled &&
option->state & State_MouseOver && !(widget && widget->testAttribute(Qt::WA_SetPalette))) {
GdkColor gdkText = d->gtk_widget_get_style(gtkButton)->fg[GTK_STATE_PRELIGHT];
QColor textColor = QColor(gdkText.red>>8, gdkText.green>>8, gdkText.blue>>8);
@@ -2971,7 +2971,7 @@ void QGtkStyle::drawControl(ControlElement element,
if (option->state & State_Sunken)
shadow = GTK_SHADOW_IN;
-
+
gtkPainter->paintBox(gtkTreeHeader, "button", option->rect.adjusted(-1, 0, 0, 0), state, shadow, d->gtk_widget_get_style(gtkTreeHeader));
}
@@ -3171,7 +3171,8 @@ void QGtkStyle::drawControl(ControlElement element,
#ifndef QT_NO_COMBOBOX
- if (qobject_cast<const QComboBox*>(widget))
+ if (qobject_cast<const QComboBox*>(widget) ||
+ (option->styleObject && option->styleObject->property("_q_isComboBoxPopupItem").toBool()))
ignoreCheckMark = true; // Ignore the checkmarks provided by the QComboMenuDelegate
#endif
@@ -3912,7 +3913,7 @@ QSize QGtkStyle::sizeFromContents(ContentsType type, const QStyleOption *option,
break;
case CT_SpinBox:
// QSpinBox does some nasty things that depends on CT_LineEdit
- newSize = size + QSize(0, -d->gtk_widget_get_style(d->gtkWidget("GtkSpinButton"))->ythickness * 2);
+ newSize = newSize + QSize(0, -d->gtk_widget_get_style(d->gtkWidget("GtkSpinButton"))->ythickness * 2);
break;
case CT_RadioButton:
case CT_CheckBox:
diff --git a/src/widgets/styles/qgtkstyle_p.cpp b/src/widgets/styles/qgtkstyle_p.cpp
index 810a8995f8..f29f250de0 100644
--- a/src/widgets/styles/qgtkstyle_p.cpp
+++ b/src/widgets/styles/qgtkstyle_p.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/styles/qgtkstyle_p.h b/src/widgets/styles/qgtkstyle_p.h
index f2710af4c6..525d7f840a 100644
--- a/src/widgets/styles/qgtkstyle_p.h
+++ b/src/widgets/styles/qgtkstyle_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -47,8 +47,6 @@
#include <QtGui/QFont>
#include <QtWidgets/QFileDialog>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -119,6 +117,4 @@ public:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif //QGTKSTYLE_P_H
diff --git a/src/widgets/styles/qgtkstyle_p_p.h b/src/widgets/styles/qgtkstyle_p_p.h
index fc77aea48b..6f3759bd9e 100644
--- a/src/widgets/styles/qgtkstyle_p_p.h
+++ b/src/widgets/styles/qgtkstyle_p_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/styles/qmacstyle.qdoc b/src/widgets/styles/qmacstyle.qdoc
index 9f5299032f..9ee464667a 100644
--- a/src/widgets/styles/qmacstyle.qdoc
+++ b/src/widgets/styles/qmacstyle.qdoc
@@ -104,43 +104,43 @@
*/
/*! \fn void QMacStyle::polish(QPalette &pal)
- \reimp
+ \reimp
*/
/*! \fn void QMacStyle::polish(QApplication *)
- \reimp
+ \reimp
*/
/*! \fn void QMacStyle::unpolish(QApplication *)
- \reimp
+ \reimp
*/
/*! \fn void QMacStyle::polish(QWidget* w)
- \reimp
+ \reimp
*/
/*! \fn void QMacStyle::unpolish(QWidget* w)
- \reimp
+ \reimp
*/
/*! \fn int QMacStyle::pixelMetric(PixelMetric metric, const QStyleOption *opt, const QWidget *widget) const
- \reimp
+ \reimp
*/
/*! \fn QPalette QMacStyle::standardPalette() const
- \reimp
+ \reimp
*/
/*! \fn int QMacStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget *w, QStyleHintReturn *hret) const
- \reimp
+ \reimp
*/
/*! \fn QPixmap QMacStyle::generatedIconPixmap(QIcon::Mode iconMode, const QPixmap &pixmap, const QStyleOption *opt) const
- \reimp
+ \reimp
*/
/*! \fn QPixmap QMacStyle::standardPixmap(StandardPixmap standardPixmap, const QStyleOption *opt, const QWidget *widget) const
- \reimp
+ \reimp
*/
/*!
@@ -199,41 +199,41 @@
/*! \fn void QMacStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPainter *p, const QWidget *w) const
- \reimp
+ \reimp
*/
/*! \fn void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter *p, const QWidget *w) const
- \reimp
+ \reimp
*/
/*! \fn QRect QMacStyle::subElementRect(SubElement sr, const QStyleOption *opt, const QWidget *widget) const
- \reimp
+ \reimp
*/
/*! \fn void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex *opt, QPainter *p, const QWidget *widget) const
- \reimp
+ \reimp
*/
/*! \fn QStyle::SubControl QMacStyle::hitTestComplexControl(ComplexControl cc, const QStyleOptionComplex *opt, const QPoint &pt, const QWidget *widget) const
- \reimp
+ \reimp
*/
/*! \fn QRect QMacStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex *opt, SubControl sc, const QWidget *widget) const
- \reimp
+ \reimp
*/
/*! \fn QSize QMacStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt, const QSize &csz, const QWidget *widget) const
- \reimp
+ \reimp
*/
/*! \fn void QMacStyle::drawItemText(QPainter *p, const QRect &r, int flags, const QPalette &pal, bool enabled, const QString &text, QPalette::ColorRole textRole) const
- \reimp
+ \reimp
*/
/*! \fn bool QMacStyle::event(QEvent *e)
- \reimp
+ \reimp
*/
/*! \fn QIcon QMacStyle::standardIcon(StandardPixmap standardIcon, const QStyleOption *opt, const QWidget *widget) const
diff --git a/src/widgets/styles/qmacstyle_mac.mm b/src/widgets/styles/qmacstyle_mac.mm
index 132cc8d59e..4adda2f151 100644
--- a/src/widgets/styles/qmacstyle_mac.mm
+++ b/src/widgets/styles/qmacstyle_mac.mm
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -41,14 +41,13 @@
/*
Note: The qdoc comments for QMacStyle are contained in
- .../doc/src/qstyles.qdoc.
+ .../doc/src/qstyles.qdoc.
*/
#include <Cocoa/Cocoa.h>
#include "qmacstyle_mac_p.h"
#include "qmacstyle_mac_p_p.h"
-#include "qmacstylepixmaps_mac_p.h"
#define QMAC_QAQUASTYLE_SIZE_CONSTRAIN
//#define DEBUG_SIZE_CONSTRAINT
@@ -458,6 +457,9 @@ static QString qt_mac_removeMnemonics(const QString &original)
return returnText;
}
+static CGContextRef qt_mac_cg_context(const QPaintDevice *pdev);
+
+namespace {
class QMacCGContext
{
CGContextRef context;
@@ -465,7 +467,6 @@ public:
QMacCGContext(QPainter *p);
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) {
@@ -495,6 +496,7 @@ public:
return *this;
}
};
+} // anonymous namespace
static QColor qcolorFromCGColor(CGColorRef cgcolor)
{
@@ -578,19 +580,17 @@ QRegion qt_mac_fromHIShapeRef(HIShapeRef shape)
}
CGColorSpaceRef m_genericColorSpace = 0;
-QHash<CGDirectDisplayID, CGColorSpaceRef> m_displayColorSpaceHash;
+static QHash<CGDirectDisplayID, CGColorSpaceRef> m_displayColorSpaceHash;
bool m_postRoutineRegistered = false;
-CGColorSpaceRef qt_mac_displayColorSpace(const QWidget *widget);
-CGColorSpaceRef qt_mac_genericColorSpace()
+static CGColorSpaceRef qt_mac_displayColorSpace(const QWidget *widget);
+static CGColorSpaceRef qt_mac_genericColorSpace()
{
#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();
}
@@ -606,11 +606,26 @@ CGColorSpaceRef qt_mac_genericColorSpace()
#endif
}
+static void qt_mac_cleanUpMacColorSpaces()
+{
+ if (m_genericColorSpace) {
+ CFRelease(m_genericColorSpace);
+ m_genericColorSpace = 0;
+ }
+ QHash<CGDirectDisplayID, CGColorSpaceRef>::const_iterator it = m_displayColorSpaceHash.constBegin();
+ while (it != m_displayColorSpaceHash.constEnd()) {
+ if (it.value())
+ CFRelease(it.value());
+ ++it;
+ }
+ m_displayColorSpaceHash.clear();
+}
+
/*
Ideally, we should pass the widget in here, and use CGGetDisplaysWithRect() etc.
to support multiple displays correctly.
*/
-CGColorSpaceRef qt_mac_displayColorSpace(const QWidget *widget)
+static CGColorSpaceRef qt_mac_displayColorSpace(const QWidget *widget)
{
CGColorSpaceRef colorSpace;
@@ -639,27 +654,11 @@ CGColorSpaceRef qt_mac_displayColorSpace(const QWidget *widget)
m_displayColorSpaceHash.insert(displayID, colorSpace);
if (!m_postRoutineRegistered) {
m_postRoutineRegistered = true;
- void qt_mac_cleanUpMacColorSpaces();
qAddPostRoutine(qt_mac_cleanUpMacColorSpaces);
}
return colorSpace;
}
-void qt_mac_cleanUpMacColorSpaces()
-{
- if (m_genericColorSpace) {
- CFRelease(m_genericColorSpace);
- m_genericColorSpace = 0;
- }
- QHash<CGDirectDisplayID, CGColorSpaceRef>::const_iterator it = m_displayColorSpaceHash.constBegin();
- while (it != m_displayColorSpaceHash.constEnd()) {
- if (it.value())
- CFRelease(it.value());
- ++it;
- }
- m_displayColorSpaceHash.clear();
-}
-
bool qt_macWindowIsTextured(const QWidget *window)
{
NSWindow *nswindow = static_cast<NSWindow*>(
@@ -2371,6 +2370,9 @@ int QMacStyle::pixelMetric(PixelMetric metric, const QStyleOption *opt, const QW
case PM_MenuHMargin:
ret = 0;
break;
+ case PM_ToolBarExtensionExtent:
+ ret = 21;
+ break;
case PM_ToolBarFrameWidth:
ret = 1;
if (widget) {
@@ -2954,16 +2956,16 @@ void QMacStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPai
p->save();
QPainterPath path;
int x = opt->rect.x() + 6;
- int y = opt->rect.y() + 5;
+ int y = opt->rect.y() + 7;
static const int RectHeight = 2;
if (opt->state & State_Horizontal) {
- while (y < opt->rect.height() - RectHeight - 6) {
+ while (y < opt->rect.height() - RectHeight - 5) {
path.moveTo(x, y);
path.addRect(x, y, RectHeight, RectHeight);
y += 6;
}
} else {
- while (x < opt->rect.width() - RectHeight - 6) {
+ while (x < opt->rect.width() - RectHeight - 5) {
path.moveTo(x, y);
path.addRect(x, y, RectHeight, RectHeight);
x += 6;
@@ -2975,12 +2977,6 @@ void QMacStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPai
QColor light = opt->palette.light().color();
light.setAlphaF(0.6);
p->fillPath(path, light);
- p->save();
- p->translate(1, 1);
- p->fillPath(path, dark);
- p->restore();
- p->translate(3, 3);
- p->fillPath(path, light);
p->translate(1, 1);
p->fillPath(path, dark);
p->restore();
@@ -3196,18 +3192,6 @@ void QMacStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPai
drawTabCloseButton(p, hover, active, selected);
} break;
case PE_PanelStatusBar: {
- if (QSysInfo::MacintoshVersion <= QSysInfo::MV_10_4) {
- QCommonStyle::drawPrimitive(pe, opt, p, w);
- break;
- }
- // Use the Leopard style only if the status bar is the status bar for a
- // QMainWindow with a unifed toolbar.
- if (w == 0 || w->parent() == 0 || qobject_cast<QMainWindow *>(w->parent()) == 0 ||
- qobject_cast<QMainWindow *>(w->parent())->unifiedTitleAndToolBarOnMac() == false ) {
- QCommonStyle::drawPrimitive(pe, opt, p, w);
- break;
- }
-
// Fill the status bar with the titlebar gradient.
QLinearGradient linearGrad(0, opt->rect.top(), 0, opt->rect.bottom());
if (opt->state & QStyle::State_Active) {
@@ -3413,7 +3397,7 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
} else {
pr.setHeight(pixmap.size().height() + 6);
cr.adjust(0, pr.bottom(), 0, -3);
- }
+ }
alignment |= Qt::AlignCenter;
} else {
pr.setWidth(pixmap.width() + 8);
@@ -4905,14 +4889,12 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex
} else {
if (!(slider->subControls & SC_SliderHandle))
tdi.attributes &= ~kThemeTrackShowThumb;
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
if (!(slider->subControls & SC_SliderGroove))
tdi.attributes |= kThemeTrackHideTrack;
-#endif
}
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
- if (cc == CC_ScrollBar && proxy()->styleHint(SH_ScrollBar_Transient, 0, widget)) {
+ if (cc == CC_ScrollBar && proxy()->styleHint(SH_ScrollBar_Transient, opt, widget)) {
bool wasActive = false;
CGFloat opacity = 1.0;
CGFloat expandScale = 1.0;
@@ -5303,7 +5285,7 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex
else
x += br.width() / 2 - p->fontMetrics().width(titlebar->text) / 2;
if (iw)
- p->drawPixmap(x - iw, y,
+ p->drawPixmap(x - iw, y,
titlebar->icon.pixmap(proxy()->pixelMetric(PM_SmallIconSize), QIcon::Normal));
drawItemText(p, br, Qt::AlignCenter, opt->palette, tds == kThemeStateActive,
titlebar->text, QPalette::Text);
@@ -5981,10 +5963,11 @@ QSize QMacStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt,
switch (ct) {
case QStyle::CT_SpinBox:
- // hack to work around horrible sizeHint() code in QAbstractSpinBox
+ // hack to work around horrible sizeHint() code in QAbstractSpinBox
+ sz = QCommonStyle::sizeFromContents(ct, opt, csz, widget);
sz.setHeight(sz.height() - 3);
break;
- case QStyle::CT_TabWidget:
+ case QStyle::CT_TabWidget:
// the size between the pane and the "contentsRect" (+4,+4)
// (the "contentsRect" is on the inside of the pane)
sz = QCommonStyle::sizeFromContents(ct, opt, csz, widget);
@@ -6012,12 +5995,12 @@ QSize QMacStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt,
------------------------------ <- top of stack widget
- To summarize:
- * 2 is the distance between the pane and the contentsRect
+ To summarize:
+ * 2 is the distance between the pane and the contentsRect
* The 14 and the 1's are the distance from the contentsRect to the stack widget.
(same value as used in SE_TabWidgetTabContents)
* overlap is how much the pane should overlap the tab bar
- */
+ */
// then add the size between the stackwidget and the "contentsRect"
if (const QStyleOptionTabWidgetFrame *twf
@@ -6368,7 +6351,7 @@ QIcon QMacStyle::standardIcon(StandardPixmap standardIcon, const QStyleOption *o
return QCommonStyle::standardIcon(standardIcon, opt, widget);
case SP_ToolBarHorizontalExtensionButton:
case SP_ToolBarVerticalExtensionButton: {
- QPixmap pixmap(qt_mac_toolbar_ext);
+ QPixmap pixmap(QLatin1String(":/qt-project.org/styles/macstyle/images/toolbar-ext.png"));
if (standardIcon == SP_ToolBarVerticalExtensionButton) {
QPixmap pix2(pixmap.height(), pixmap.width());
pix2.fill(Qt::transparent);
@@ -6484,7 +6467,7 @@ int QMacStyle::layoutSpacing(QSizePolicy::ControlType control1,
return_SIZE(10, 8, 6); // guess
}
-void qt_mac_clip_cg(CGContextRef hd, const QRegion &rgn, CGAffineTransform *orig_xform)
+static void qt_mac_clip_cg(CGContextRef hd, const QRegion &rgn, CGAffineTransform *orig_xform)
{
CGAffineTransform old_xform = CGAffineTransformIdentity;
if (orig_xform) { //setup xforms
@@ -6525,6 +6508,9 @@ void qt_mac_scale_region(QRegion *region, qreal scaleFactor)
region->setRects(&scaledRects[0], scaledRects.count());
}
+static CGColorSpaceRef qt_mac_colorSpaceForDeviceType(const QPaintDevice *paintDevice);
+
+namespace {
QMacCGContext::QMacCGContext(QPainter *p)
{
QPaintEngine *pe = p->paintEngine();
@@ -6537,7 +6523,6 @@ QMacCGContext::QMacCGContext(QPainter *p)
devType == QInternal::Pixmap ||
devType == QInternal::Image)) {
- extern CGColorSpaceRef qt_mac_colorSpaceForDeviceType(const QPaintDevice *paintDevice);
CGColorSpaceRef colorspace = qt_mac_colorSpaceForDeviceType(pe->paintDevice());
uint flags = kCGImageAlphaPremultipliedFirst;
flags |= kCGBitmapByteOrder32Host;
@@ -6579,7 +6564,9 @@ QMacCGContext::QMacCGContext(QPainter *p)
}
}
-CGColorSpaceRef qt_mac_colorSpaceForDeviceType(const QPaintDevice *paintDevice)
+} // anonymous namespace
+
+static CGColorSpaceRef qt_mac_colorSpaceForDeviceType(const QPaintDevice *paintDevice)
{
bool isWidget = (paintDevice->devType() == QInternal::Widget);
return qt_mac_displayColorSpace(isWidget ? static_cast<const QWidget *>(paintDevice) : 0);
diff --git a/src/widgets/styles/qmacstyle_mac_p.h b/src/widgets/styles/qmacstyle_mac_p.h
index d06a5a951f..305bcf871c 100644
--- a/src/widgets/styles/qmacstyle_mac_p.h
+++ b/src/widgets/styles/qmacstyle_mac_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -44,8 +44,6 @@
#include <QtWidgets/qcommonstyle.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -130,6 +128,4 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QMACSTYLE_MAC_P_H
diff --git a/src/widgets/styles/qmacstyle_mac_p_p.h b/src/widgets/styles/qmacstyle_mac_p_p.h
index 6c0493fe04..c424ff0c3c 100644
--- a/src/widgets/styles/qmacstyle_mac_p_p.h
+++ b/src/widgets/styles/qmacstyle_mac_p_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/styles/qproxystyle.cpp b/src/widgets/styles/qproxystyle.cpp
index 66ace0f60b..b63e820bb9 100644
--- a/src/widgets/styles/qproxystyle.cpp
+++ b/src/widgets/styles/qproxystyle.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -59,7 +59,7 @@ QT_BEGIN_NAMESPACE
\since 4.6
\inmodule QtWidgets
-
+
A QProxyStyle wraps a QStyle (usually the default system style) for the
purpose of dynamically overriding painting or other specific style behavior.
@@ -108,10 +108,9 @@ void QProxyStylePrivate::ensureBaseStyle() const
}
/*!
- Constructs a QProxyStyle object for overriding behavior in \a style
- or in the current application \l{QStyle}{style} if \a style is 0
- (default). Normally \a style is 0, because you want to override
- behavior in the system style.
+ Constructs a QProxyStyle object for overriding behavior in the
+ specified base \a style, or in the current \l{QApplication::style}
+ {application style} if base \a style is not specified.
Ownership of \a style is transferred to QProxyStyle.
*/
@@ -127,6 +126,26 @@ QProxyStyle::QProxyStyle(QStyle *style) :
}
/*!
+ Constructs a QProxyStyle object for overriding behavior in
+ the base style specified by style \a key, or in the current
+ \l{QApplication::style}{application style} if the specified
+ style \a key is unrecognized.
+
+ \sa QStyleFactory::create()
+*/
+QProxyStyle::QProxyStyle(const QString &key) :
+ QCommonStyle(*new QProxyStylePrivate())
+{
+ Q_D(QProxyStyle);
+ QStyle *style = QStyleFactory::create(key);
+ if (style) {
+ d->baseStyle = style;
+ style->setProxy(this);
+ style->setParent(this); // Take ownership
+ }
+}
+
+/*!
Destroys the QProxyStyle object.
*/
QProxyStyle::~QProxyStyle()
diff --git a/src/widgets/styles/qproxystyle.h b/src/widgets/styles/qproxystyle.h
index 52b02c8e5b..5864c195c6 100644
--- a/src/widgets/styles/qproxystyle.h
+++ b/src/widgets/styles/qproxystyle.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -44,8 +44,6 @@
#include <QtWidgets/QCommonStyle>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -57,7 +55,8 @@ class Q_WIDGETS_EXPORT QProxyStyle : public QCommonStyle
Q_OBJECT
public:
- QProxyStyle(QStyle *baseStyle = 0);
+ QProxyStyle(QStyle *style = 0);
+ QProxyStyle(const QString &key);
~QProxyStyle();
QStyle *baseStyle() const;
@@ -107,6 +106,4 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QPROXYSTYLE_H
diff --git a/src/widgets/styles/qproxystyle_p.h b/src/widgets/styles/qproxystyle_p.h
index 3d428a0c84..92f6f73ccc 100644
--- a/src/widgets/styles/qproxystyle_p.h
+++ b/src/widgets/styles/qproxystyle_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/styles/qstyle.cpp b/src/widgets/styles/qstyle.cpp
index 9c4901795d..603d0e50a5 100644
--- a/src/widgets/styles/qstyle.cpp
+++ b/src/widgets/styles/qstyle.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -137,7 +137,7 @@ static int unpackControlTypes(QSizePolicy::ControlTypes controls, QSizePolicy::C
state.
\endtable
-
+
For more information about widget styling and appearance, see the
\l{Styles and Style Aware Widgets}.
*/
@@ -1891,6 +1891,9 @@ void QStyle::drawItemPixmap(QPainter *painter, const QRect &rect, int alignment,
\value SH_ScrollBar_Transient Determines if the style supports transient scroll bars. Transient
scroll bars appear when the content is scrolled and disappear when they are no longer needed.
+ \value SH_Menu_SupportsSections Determines if the style displays sections in menus or treat them as
+ plain separators. Sections are separators with a text and icon hint.
+
\sa styleHint()
*/
diff --git a/src/widgets/styles/qstyle.h b/src/widgets/styles/qstyle.h
index b69f5da6c5..beafad326e 100644
--- a/src/widgets/styles/qstyle.h
+++ b/src/widgets/styles/qstyle.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -50,8 +50,6 @@
#include <QtGui/qpalette.h>
#include <QtWidgets/qsizepolicy.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -699,6 +697,7 @@ public:
SH_ToolButtonStyle,
SH_RequestSoftwareInputPanel,
SH_ScrollBar_Transient,
+ SH_Menu_SupportsSections,
// Add new style hint values here
SH_CustomBase = 0xf0000000
@@ -831,6 +830,4 @@ Q_WIDGETS_EXPORT QDebug operator<<(QDebug debug, QStyle::State state);
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QSTYLE_H
diff --git a/src/widgets/styles/qstyle.qrc b/src/widgets/styles/qstyle.qrc
index d835728928..28ad484032 100644
--- a/src/widgets/styles/qstyle.qrc
+++ b/src/widgets/styles/qstyle.qrc
@@ -133,5 +133,7 @@
<file>images/closedock-down-16.png</file>
<file>images/dockdock-16.png</file>
<file>images/dockdock-down-16.png</file>
+ <file>images/toolbar-ext.png</file>
+ <file>images/toolbar-ext@2x.png</file>
</qresource>
</RCC>
diff --git a/src/widgets/styles/qstyle_p.h b/src/widgets/styles/qstyle_p.h
index 6cc28b7506..70221f6d8f 100644
--- a/src/widgets/styles/qstyle_p.h
+++ b/src/widgets/styles/qstyle_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/styles/qstyleanimation.cpp b/src/widgets/styles/qstyleanimation.cpp
index 61048df96a..4fb67d90c0 100644
--- a/src/widgets/styles/qstyleanimation.cpp
+++ b/src/widgets/styles/qstyleanimation.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -46,13 +46,9 @@
QT_BEGIN_NAMESPACE
-QStyleAnimation::QStyleAnimation(QObject *target) : QAbstractAnimation(),
+QStyleAnimation::QStyleAnimation(QObject *target) : QAbstractAnimation(target),
_delay(0), _duration(-1), _startTime(QTime::currentTime())
{
- if (target) {
- moveToThread(target->thread());
- setParent(target);
- }
}
QStyleAnimation::~QStyleAnimation()
diff --git a/src/widgets/styles/qstyleanimation_p.h b/src/widgets/styles/qstyleanimation_p.h
index f9f0eced9d..77962bedac 100644
--- a/src/widgets/styles/qstyleanimation_p.h
+++ b/src/widgets/styles/qstyleanimation_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/styles/qstylefactory.cpp b/src/widgets/styles/qstylefactory.cpp
index 471d3b748d..2b81acf246 100644
--- a/src/widgets/styles/qstylefactory.cpp
+++ b/src/widgets/styles/qstylefactory.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -48,6 +48,9 @@
#include "qwindowsstyle_p.h"
#ifndef QT_NO_STYLE_FUSION
#include "qfusionstyle_p.h"
+#ifndef QT_NO_STYLE_ANDROID
+#include "qandroidstyle_p.h"
+#endif
#endif
#ifndef QT_NO_STYLE_GTK
#include "qgtkstyle_p.h"
@@ -143,6 +146,11 @@ QStyle *QStyleFactory::create(const QString& key)
ret = new QFusionStyle;
else
#endif
+#ifndef QT_NO_STYLE_ANDROID
+ if (style == QLatin1String("android"))
+ ret = new QAndroidStyle;
+ else
+#endif
#ifndef QT_NO_STYLE_GTK
if (style == QLatin1String("gtk") || style == QLatin1String("gtk+"))
ret = new QGtkStyle;
@@ -206,6 +214,10 @@ QStringList QStyleFactory::keys()
(QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA && (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based)))
list << QLatin1String("WindowsVista");
#endif
+#ifndef QT_NO_STYLE_ANDROID
+ if (!list.contains(QLatin1String("Android")))
+ list << QLatin1String("Android");
+#endif
#ifndef QT_NO_STYLE_GTK
if (!list.contains(QLatin1String("GTK+")))
list << QLatin1String("GTK+");
diff --git a/src/widgets/styles/qstylefactory.h b/src/widgets/styles/qstylefactory.h
index 500e86a9d4..539f47464b 100644
--- a/src/widgets/styles/qstylefactory.h
+++ b/src/widgets/styles/qstylefactory.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -44,8 +44,6 @@
#include <QtCore/qstringlist.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -60,6 +58,4 @@ public:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QSTYLEFACTORY_H
diff --git a/src/widgets/styles/qstylehelper.cpp b/src/widgets/styles/qstylehelper.cpp
index 75c74e4a88..33a422fdd4 100644
--- a/src/widgets/styles/qstylehelper.cpp
+++ b/src/widgets/styles/qstylehelper.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/styles/qstylehelper_p.h b/src/widgets/styles/qstylehelper_p.h
index 01772e765c..6355cbc985 100644
--- a/src/widgets/styles/qstylehelper_p.h
+++ b/src/widgets/styles/qstylehelper_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/styles/qstyleoption.cpp b/src/widgets/styles/qstyleoption.cpp
index 01e51d594d..4f4cd71070 100644
--- a/src/widgets/styles/qstyleoption.cpp
+++ b/src/widgets/styles/qstyleoption.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -206,7 +206,7 @@ void QStyleOption::init(const QWidget *widget)
if (!(state & QStyle::State_Active) && !qt_mac_can_clickThrough(widget))
state &= ~QStyle::State_Enabled;
#endif
-#ifdef Q_OS_MAC
+#if defined(Q_OS_MAC) && !defined(Q_OS_IOS)
switch (QMacStyle::widgetSizePolicy(widget)) {
case QMacStyle::SizeSmall:
state |= QStyle::State_Small;
@@ -374,7 +374,7 @@ QStyleOption &QStyleOption::operator=(const QStyleOption &other)
parameters for drawing a focus rectangle with QStyle.
\inmodule QtWidgets
-
+
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
@@ -458,7 +458,7 @@ QStyleOptionFocusRect::QStyleOptionFocusRect(int version)
parameters for drawing a frame.
\inmodule QtWidgets
-
+
QStyleOptionFrame is used for drawing several built-in Qt widgets,
including QFrame, QGroupBox, QLineEdit, and QMenu.
@@ -738,7 +738,7 @@ QStyleOptionGroupBox::QStyleOptionGroupBox(int version)
parameters for drawing a header.
\inmodule QtWidgets
-
+
QStyleOptionHeader contains all the information that QStyle
functions need to draw the item views' header pane, header sort
arrow, and header label.
@@ -925,7 +925,7 @@ QStyleOptionHeader::QStyleOptionHeader(int version)
parameters for drawing buttons.
\inmodule QtWidgets
-
+
QStyleOptionButton contains all the information that QStyle
functions need to draw graphical elements like QPushButton,
QCheckBox, and QRadioButton.
@@ -1237,7 +1237,7 @@ QStyleOptionToolBar::QStyleOptionToolBar(int version)
parameters for drawing a tab bar.
\inmodule QtWidgets
-
+
The QStyleOptionTab class is used for drawing several built-in Qt
widgets including \l QTabBar and the panel for \l QTabWidget.
@@ -1662,7 +1662,7 @@ QStyleOptionProgressBar::QStyleOptionProgressBar(int version)
parameter necessary for drawing a menu item.
\inmodule QtWidgets
-
+
QStyleOptionMenuItem contains all the information that QStyle
functions need to draw the menu items from \l QMenu. It is also
used for drawing other menu-related widgets.
@@ -1862,7 +1862,7 @@ QStyleOptionMenuItem::QStyleOptionMenuItem(int version)
common to all complex controls.
\inmodule QtWidgets
-
+
This class is not used on its own. Instead it is used to derive
other complex control options, for example QStyleOptionSlider and
QStyleOptionSpinBox.
@@ -1953,7 +1953,7 @@ QStyleOptionComplex::QStyleOptionComplex(int version, int type)
parameters needed for drawing a slider.
\inmodule QtWidgets
-
+
QStyleOptionSlider contains all the information that QStyle
functions need to draw QSlider and QScrollBar.
@@ -2152,7 +2152,7 @@ QStyleOptionSlider::QStyleOptionSlider(int version)
parameters necessary for drawing a spin box.
\inmodule QtWidgets
-
+
QStyleOptionSpinBox contains all the information that QStyle
functions need to draw QSpinBox and QDateTimeEdit.
@@ -2257,7 +2257,7 @@ QStyleOptionSpinBox::QStyleOptionSpinBox(int version)
parameters for drawing a dock widget.
\inmodule QtWidgets
-
+
QStyleOptionDockWidget contains all the information that QStyle
functions need to draw graphical elements like QDockWidget.
diff --git a/src/widgets/styles/qstyleoption.h b/src/widgets/styles/qstyleoption.h
index 4109c8e702..4f817a3353 100644
--- a/src/widgets/styles/qstyleoption.h
+++ b/src/widgets/styles/qstyleoption.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -56,8 +56,6 @@
# include <QtCore/qabstractitemmodel.h>
#endif
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -751,6 +749,4 @@ Q_WIDGETS_EXPORT QDebug operator<<(QDebug debug, const QStyleOption &option);
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QSTYLEOPTION_H
diff --git a/src/widgets/styles/qstylepainter.cpp b/src/widgets/styles/qstylepainter.cpp
index 1faf4a743b..5c2c44b45b 100644
--- a/src/widgets/styles/qstylepainter.cpp
+++ b/src/widgets/styles/qstylepainter.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/styles/qstylepainter.h b/src/widgets/styles/qstylepainter.h
index dee01c09a3..2031921d12 100644
--- a/src/widgets/styles/qstylepainter.h
+++ b/src/widgets/styles/qstylepainter.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -46,8 +46,6 @@
#include <QtWidgets/qstyle.h>
#include <QtWidgets/qwidget.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -106,6 +104,4 @@ void QStylePainter::drawItemPixmap(const QRect &r, int flags, const QPixmap &pix
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QSTYLEPAINTER_H
diff --git a/src/widgets/styles/qstyleplugin.cpp b/src/widgets/styles/qstyleplugin.cpp
index e8f9878603..77f5bd30f4 100644
--- a/src/widgets/styles/qstyleplugin.cpp
+++ b/src/widgets/styles/qstyleplugin.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/styles/qstyleplugin.h b/src/widgets/styles/qstyleplugin.h
index d34f0c0a15..041bdbfa68 100644
--- a/src/widgets/styles/qstyleplugin.h
+++ b/src/widgets/styles/qstyleplugin.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -45,8 +45,6 @@
#include <QtCore/qplugin.h>
#include <QtCore/qfactoryinterface.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -66,6 +64,4 @@ public:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QSTYLEPLUGIN_H
diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp
index 7087e2a5ca..be89abf2b2 100644
--- a/src/widgets/styles/qstylesheetstyle.cpp
+++ b/src/widgets/styles/qstylesheetstyle.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/styles/qstylesheetstyle_default.cpp b/src/widgets/styles/qstylesheetstyle_default.cpp
index 2c9a72b4b4..bca4c8928a 100644
--- a/src/widgets/styles/qstylesheetstyle_default.cpp
+++ b/src/widgets/styles/qstylesheetstyle_default.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/styles/qstylesheetstyle_p.h b/src/widgets/styles/qstylesheetstyle_p.h
index a199721200..9ca3c9ed24 100644
--- a/src/widgets/styles/qstylesheetstyle_p.h
+++ b/src/widgets/styles/qstylesheetstyle_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/styles/qwindowscestyle.cpp b/src/widgets/styles/qwindowscestyle.cpp
index f297e64631..564e84b35b 100644
--- a/src/widgets/styles/qwindowscestyle.cpp
+++ b/src/widgets/styles/qwindowscestyle.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/styles/qwindowscestyle_p.h b/src/widgets/styles/qwindowscestyle_p.h
index 5d38abe41b..73fb2b7ab7 100644
--- a/src/widgets/styles/qwindowscestyle_p.h
+++ b/src/widgets/styles/qwindowscestyle_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -44,8 +44,6 @@
#include <private/qwindowsstyle_p.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -98,6 +96,4 @@ public:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QWINDOWSCESTYLE_P_H
diff --git a/src/widgets/styles/qwindowscestyle_p_p.h b/src/widgets/styles/qwindowscestyle_p_p.h
index 7fbf6d8160..f17aae7cbb 100644
--- a/src/widgets/styles/qwindowscestyle_p_p.h
+++ b/src/widgets/styles/qwindowscestyle_p_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/styles/qwindowsmobilestyle.cpp b/src/widgets/styles/qwindowsmobilestyle.cpp
index 2b30bf5a2d..36c5d7e1bb 100644
--- a/src/widgets/styles/qwindowsmobilestyle.cpp
+++ b/src/widgets/styles/qwindowsmobilestyle.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -90,7 +90,7 @@ static const int windowsMobileExclusiveIndicatorSize = 14;
static const int windowsMobileSliderThickness = 6;
static const int windowsMobileIconSize = 16;
static const int PE_IndicatorArrowUpBig = 0xf000101;
-static const int PE_IndicatorArrowDownBig = 0xf000102;
+static const int PE_IndicatorArrowDownBig = 0xf000102;
static const int PE_IndicatorArrowLeftBig = 0xf000103;
static const int PE_IndicatorArrowRightBig = 0xf000104;
@@ -241,7 +241,7 @@ static const char *const radiochecked_xpm[] = {
static const char * const radiochecked_low_xpm[] = {
"9 9 2 1",
" c None",
- ". c #000000",
+ ". c #000000",
" ... ",
" ....... ",
" ....... ",
@@ -3904,39 +3904,39 @@ QColor fromHsl(QColor c)
qreal ca[3] = {0, 0, 0};
if (s == 0 || h == 1) {
- // achromatic case
+ // achromatic case
ca[0] = ca[1] = ca[2] = l;
- } else {
- // chromatic case
- qreal temp2;
- if (l < qreal(0.5))
- temp2 = l * (qreal(1.0) + s);
- else
- temp2 = l + s - (l * s);
-
- const qreal temp1 = (qreal(2.0) * l) - temp2;
- qreal temp3[3] = { h + (qreal(1.0) / qreal(3.0)),
- h,
- h - (qreal(1.0) / qreal(3.0)) };
-
- for (int i = 0; i != 3; ++i) {
- if (temp3[i] < qreal(0.0))
- temp3[i] += qreal(1.0);
- else if (temp3[i] > qreal(1.0))
+ } else {
+ // chromatic case
+ qreal temp2;
+ if (l < qreal(0.5))
+ temp2 = l * (qreal(1.0) + s);
+ else
+ temp2 = l + s - (l * s);
+
+ const qreal temp1 = (qreal(2.0) * l) - temp2;
+ qreal temp3[3] = { h + (qreal(1.0) / qreal(3.0)),
+ h,
+ h - (qreal(1.0) / qreal(3.0)) };
+
+ for (int i = 0; i != 3; ++i) {
+ if (temp3[i] < qreal(0.0))
+ temp3[i] += qreal(1.0);
+ else if (temp3[i] > qreal(1.0))
temp3[i] -= qreal(1.0);
const qreal sixtemp3 = temp3[i] * qreal(6.0);
- if (sixtemp3 < qreal(1.0))
- ca[i] = ((temp1 + (temp2 - temp1) * sixtemp3));
- else if ((temp3[i] * qreal(2.0)) < qreal(1.0))
- ca[i] = (temp2);
- else if ((temp3[i] * qreal(3.0)) < qreal(2.0))
+ if (sixtemp3 < qreal(1.0))
+ ca[i] = ((temp1 + (temp2 - temp1) * sixtemp3));
+ else if ((temp3[i] * qreal(2.0)) < qreal(1.0))
+ ca[i] = (temp2);
+ else if ((temp3[i] * qreal(3.0)) < qreal(2.0))
ca[i] = temp1 + (temp2 -temp1) * (qreal(2.0) /qreal(3.0) - temp3[i]) * qreal(6.0);
else ca[i] = temp1;
}
}
-
+
return QColor::fromRgbF(ca[0], ca[1], ca[2]);
}
@@ -3945,7 +3945,7 @@ QColor fromHsl(QColor c)
QColor toHsl(QColor c)
{
- QColor color;
+ QColor color;
qreal h;
qreal s;
qreal l;
@@ -3953,36 +3953,36 @@ QColor toHsl(QColor c)
const qreal r = c.redF();
const qreal g = c.greenF();
const qreal b = c.blueF();
- const qreal max = Q_MAX_3(r, g, b);
- const qreal min = Q_MIN_3(r, g, b);
- const qreal delta = max - min;
- const qreal delta2 = max + min;
- const qreal lightness = qreal(0.5) * delta2;
+ const qreal max = Q_MAX_3(r, g, b);
+ const qreal min = Q_MIN_3(r, g, b);
+ const qreal delta = max - min;
+ const qreal delta2 = max + min;
+ const qreal lightness = qreal(0.5) * delta2;
l = (lightness);
- if (qFuzzyIsNull(delta)) {
- // achromatic case, hue is undefined
+ if (qFuzzyIsNull(delta)) {
+ // achromatic case, hue is undefined
h = 0;
- s = 0;
+ s = 0;
} else {
- // chromatic case
- qreal hue = 0;
- if (lightness < qreal(0.5))
- s = ((delta / delta2));
- else
- s = ((delta / (qreal(2.0) - delta2)));
- if (qFuzzyCompare(r, max)) {
- hue = ((g - b) /delta);
- } else if (qFuzzyCompare(g, max)) {
- hue = (2.0 + (b - r) / delta);
- } else if (qFuzzyCompare(b, max)) {
- hue = (4.0 + (r - g) / delta);
- } else {
- Q_ASSERT_X(false, "QColor::toHsv", "internal error");
+ // chromatic case
+ qreal hue = 0;
+ if (lightness < qreal(0.5))
+ s = ((delta / delta2));
+ else
+ s = ((delta / (qreal(2.0) - delta2)));
+ if (qFuzzyCompare(r, max)) {
+ hue = ((g - b) /delta);
+ } else if (qFuzzyCompare(g, max)) {
+ hue = (2.0 + (b - r) / delta);
+ } else if (qFuzzyCompare(b, max)) {
+ hue = (4.0 + (r - g) / delta);
+ } else {
+ Q_ASSERT_X(false, "QColor::toHsv", "internal error");
}
- hue *= 60.0;
- if (hue < 0.0)
- hue += 360.0;
- h = (hue * 100);
+ hue *= 60.0;
+ if (hue < 0.0)
+ hue += 360.0;
+ h = (hue * 100);
}
h = h / 36000;
@@ -4083,7 +4083,7 @@ void QWindowsMobileStylePrivate::tintListViewHighlight(QColor color)
imageListViewHighlightMiddle = QImage(listviewhighmiddle_xpm);
tintImage(&imageListViewHighlightMiddle, color, qreal(0.0));
-
+
int height = imageListViewHighlightMiddle.height();
if (!doubleControls) {
height = height / 2;
@@ -4218,7 +4218,7 @@ void QWindowsMobileStylePrivate::drawPanelItemViewSelected(QPainter *painter, co
QRect r;
if (rect.isValid())
r = rect;
- else
+ else
r = option->rect;
tintImagesHigh(option->palette.highlight().color());
@@ -4892,7 +4892,7 @@ void QWindowsMobileStyle::drawPrimitive(PrimitiveElement element, const QStyleOp
} else {
QRect r = QRect(option->rect.x(), option->rect.y(), windowsMobileitemViewCheckBoxSize, windowsMobileitemViewCheckBoxSize);
qDrawPlainRect(painter, r, option->palette.shadow().color(), 1);
- }
+ }
if (option->state & State_Enabled)
d->imageChecked.setColor(1, option->palette.shadow().color().rgba());
else
@@ -5129,7 +5129,7 @@ void QWindowsMobileStyle::drawPrimitive(PrimitiveElement element, const QStyleOp
image.setColor(1, color.rgba());
painter->drawImage(option->rect.x() + xoffset, option->rect.y() + yoffset, image);
}
- else {
+ else {
QPoint points[7];
switch (element) {
case PE_IndicatorArrowUp:
@@ -5194,7 +5194,7 @@ void QWindowsMobileStyle::drawPrimitive(PrimitiveElement element, const QStyleOp
painter->drawLine(points[2], points[3]);
painter->drawLine(points[4], points[5]);
painter->drawPoint(points[6]);
- }
+ }
}
painter->restore();
break; }
@@ -5432,7 +5432,7 @@ void QWindowsMobileStyle::drawControl(ControlElement element, const QStyleOption
QWindowsMobileStylePrivate *d = const_cast<QWindowsMobileStylePrivate*>(d_func());
-
+
painter->setClipping(false);
switch (element) {
case CE_MenuBarEmptyArea:
@@ -5527,7 +5527,7 @@ void QWindowsMobileStyle::drawControl(ControlElement element, const QStyleOption
break;
case CE_TabBarTabShape:
if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(option)) {
-
+
if (tab->shape == QTabBar::RoundedNorth || tab->shape == QTabBar::RoundedEast ||
tab->shape == QTabBar::RoundedSouth || tab->shape == QTabBar::RoundedWest) {
d->drawTabBarTab(painter, tab);
@@ -5564,7 +5564,7 @@ void QWindowsMobileStyle::drawControl(ControlElement element, const QStyleOption
proxy()->drawControl(CE_HeaderSection, header, painter, widget);
QStyleOptionHeader subopt = *header;
subopt.rect = proxy()->subElementRect(SE_HeaderLabel, header, widget);
- if (header->state & State_Sunken)
+ if (header->state & State_Sunken)
subopt.palette.setColor(QPalette::ButtonText, header->palette.brightText().color());
subopt.state |= QStyle::State_On;
if (subopt.rect.isValid())
@@ -7079,7 +7079,7 @@ int QWindowsMobileStyle::pixelMetric(PixelMetric pm, const QStyleOption *opt, co
}
break;
case PM_ScrollBarExtent: {
-
+
if (d->smartphone)
ret = 9;
else
diff --git a/src/widgets/styles/qwindowsmobilestyle_p.h b/src/widgets/styles/qwindowsmobilestyle_p.h
index 21df982344..4262bf5c73 100644
--- a/src/widgets/styles/qwindowsmobilestyle_p.h
+++ b/src/widgets/styles/qwindowsmobilestyle_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -44,8 +44,6 @@
#include <private/qwindowsstyle_p.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -111,6 +109,4 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif //QWINDOWSMOBILESTYLE_P_H
diff --git a/src/widgets/styles/qwindowsmobilestyle_p_p.h b/src/widgets/styles/qwindowsmobilestyle_p_p.h
index d73c6eebaa..45e02fb379 100644
--- a/src/widgets/styles/qwindowsmobilestyle_p_p.h
+++ b/src/widgets/styles/qwindowsmobilestyle_p_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/styles/qwindowsstyle.cpp b/src/widgets/styles/qwindowsstyle.cpp
index 2b48096a7b..86fccabcbc 100644
--- a/src/widgets/styles/qwindowsstyle.cpp
+++ b/src/widgets/styles/qwindowsstyle.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -2358,7 +2358,6 @@ QSize QWindowsStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt,
sz += QSize(QWindowsStylePrivate::windowsItemHMargin * 4, QWindowsStylePrivate::windowsItemVMargin * 2);
break;
#endif
- // Otherwise, fall through
case CT_ToolButton:
if (qstyleoption_cast<const QStyleOptionToolButton *>(opt))
return sz += QSize(7, 6);
diff --git a/src/widgets/styles/qwindowsstyle_p.h b/src/widgets/styles/qwindowsstyle_p.h
index 65573acf67..1107e70061 100644
--- a/src/widgets/styles/qwindowsstyle_p.h
+++ b/src/widgets/styles/qwindowsstyle_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -44,8 +44,6 @@
#include <QtWidgets/qcommonstyle.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -103,6 +101,4 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QWINDOWSSTYLE_P_H
diff --git a/src/widgets/styles/qwindowsstyle_p_p.h b/src/widgets/styles/qwindowsstyle_p_p.h
index ca77964fb8..872b6f0e9e 100644
--- a/src/widgets/styles/qwindowsstyle_p_p.h
+++ b/src/widgets/styles/qwindowsstyle_p_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/styles/qwindowsvistastyle.cpp b/src/widgets/styles/qwindowsvistastyle.cpp
index a621cab04d..df5a02d17f 100644
--- a/src/widgets/styles/qwindowsvistastyle.cpp
+++ b/src/widgets/styles/qwindowsvistastyle.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -273,15 +273,15 @@ void QWindowsVistaAnimation::paint(QPainter *painter, const QStyleOption *option
/*!
\internal
-
+
Animations are used for some state transitions on specific widgets.
-
+
Only one running animation can exist for a widget at any specific
time. Animations can be added through
QWindowsVistaStylePrivate::startAnimation(Animation *) and any
existing animation on a widget can be retrieved with
QWindowsVistaStylePrivate::widgetAnimation(Widget *).
-
+
Once an animation has been started,
QWindowsVistaStylePrivate::timerEvent(QTimerEvent *) will
continuously call update() on the widget until it is stopped,
@@ -798,17 +798,17 @@ void QWindowsVistaStyle::drawPrimitive(PrimitiveElement element, const QStyleOpt
|| vopt->viewItemPosition == QStyleOptionViewItem::Invalid)
painter->drawPixmap(pixmapRect.topLeft(), pixmap);
else if (reverse ? rightSection : leftSection){
- painter->drawPixmap(QRect(pixmapRect.topLeft(),
- QSize(frame, pixmapRect.height())), pixmap,
+ painter->drawPixmap(QRect(pixmapRect.topLeft(),
+ QSize(frame, pixmapRect.height())), pixmap,
QRect(QPoint(0, 0), QSize(frame, pixmapRect.height())));
- painter->drawPixmap(pixmapRect.adjusted(frame, 0, 0, 0),
+ painter->drawPixmap(pixmapRect.adjusted(frame, 0, 0, 0),
pixmap, srcRect.adjusted(frame, 0, -frame, 0));
} else if (reverse ? leftSection : rightSection) {
- painter->drawPixmap(QRect(pixmapRect.topRight() - QPoint(frame - 1, 0),
- QSize(frame, pixmapRect.height())), pixmap,
- QRect(QPoint(pixmapRect.width() - frame, 0),
+ painter->drawPixmap(QRect(pixmapRect.topRight() - QPoint(frame - 1, 0),
+ QSize(frame, pixmapRect.height())), pixmap,
+ QRect(QPoint(pixmapRect.width() - frame, 0),
QSize(frame, pixmapRect.height())));
- painter->drawPixmap(pixmapRect.adjusted(0, 0, -frame, 0),
+ painter->drawPixmap(pixmapRect.adjusted(0, 0, -frame, 0),
pixmap, srcRect.adjusted(frame, 0, -frame, 0));
} else if (vopt->viewItemPosition == QStyleOptionViewItem::Middle)
painter->drawPixmap(pixmapRect, pixmap,
@@ -1110,7 +1110,7 @@ void QWindowsVistaStyle::drawControl(ControlElement element, const QStyleOption
} else {
animRect = QRect(rect.left() - glowSize + animOffset,
rect.top(), glowSize, rect.height());
- animRect = QStyle::visualRect(reverse ? Qt::RightToLeft : Qt::LeftToRight,
+ animRect = QStyle::visualRect(reverse ? Qt::RightToLeft : Qt::LeftToRight,
option->rect, animRect);
pixmapSize.setWidth(animRect.width());
}
@@ -1156,7 +1156,7 @@ void QWindowsVistaStyle::drawControl(ControlElement element, const QStyleOption
double vc6_workaround = ((progress - qint64(bar->minimum)) / qMax(double(1.0), double(qint64(bar->maximum) - qint64(bar->minimum))) * maxWidth);
int width = isIndeterminate ? maxWidth : qMax(int(vc6_workaround), minWidth);
theme.rect.setWidth(width);
- theme.rect = QStyle::visualRect(reverse ? Qt::RightToLeft : Qt::LeftToRight,
+ theme.rect = QStyle::visualRect(reverse ? Qt::RightToLeft : Qt::LeftToRight,
option->rect, theme.rect);
}
d->drawBackground(theme);
@@ -1522,7 +1522,7 @@ void QWindowsVistaStyle::drawControl(ControlElement element, const QStyleOption
QStyleOptionViewItem adjustedOption = *vopt;
adjustedOption.palette = palette;
// We hide the focusrect in singleselection as it is not required
- if ((view->selectionMode() == QAbstractItemView::SingleSelection)
+ if ((view->selectionMode() == QAbstractItemView::SingleSelection)
&& !(vopt->state & State_KeyboardFocusChange))
adjustedOption.state &= ~State_HasFocus;
QWindowsXPStyle::drawControl(element, &adjustedOption, painter, widget);
@@ -1585,7 +1585,7 @@ void QWindowsVistaStyle::drawComplexControl(ComplexControl control, const QStyle
bool doTransition = ((state & State_Sunken) != (oldState & State_Sunken) ||
(state & State_On) != (oldState & State_On) ||
(state & State_MouseOver) != (oldState & State_MouseOver) ||
- oldActiveControls != option->activeSubControls);
+ oldActiveControls != int(option->activeSubControls));
if (qstyleoption_cast<const QStyleOptionSlider *>(option)) {
QRect oldSliderPos = styleObject->property("_q_stylesliderpos").toRect();
@@ -1944,7 +1944,7 @@ QSize QWindowsVistaStyle::sizeFromContents(ContentsType type, const QStyleOption
minimumHeight = qMax<qint32>(size.cy + margins.cyBottomHeight+ margins.cyTopHeight, sz.height());
sz.rwidth() += size.cx + margins.cxLeftWidth + margins.cxRightWidth;
}
-
+
if (const QStyleOptionMenuItem *menuitem = qstyleoption_cast<const QStyleOptionMenuItem *>(option)) {
if (menuitem->menuItemType != QStyleOptionMenuItem::Separator)
sz.setHeight(minimumHeight);
diff --git a/src/widgets/styles/qwindowsvistastyle_p.h b/src/widgets/styles/qwindowsvistastyle_p.h
index 2a06c78806..f7914f1645 100644
--- a/src/widgets/styles/qwindowsvistastyle_p.h
+++ b/src/widgets/styles/qwindowsvistastyle_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -44,8 +44,6 @@
#include <private/qwindowsxpstyle_p.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -99,6 +97,4 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QWINDOWSVISTASTYLE_P_H
diff --git a/src/widgets/styles/qwindowsvistastyle_p_p.h b/src/widgets/styles/qwindowsvistastyle_p_p.h
index 17d510abf2..f2f208fbb5 100644
--- a/src/widgets/styles/qwindowsvistastyle_p_p.h
+++ b/src/widgets/styles/qwindowsvistastyle_p_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/styles/qwindowsxpstyle.cpp b/src/widgets/styles/qwindowsxpstyle.cpp
index 8bd5699e4a..64569cfd9b 100644
--- a/src/widgets/styles/qwindowsxpstyle.cpp
+++ b/src/widgets/styles/qwindowsxpstyle.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/styles/qwindowsxpstyle_p.h b/src/widgets/styles/qwindowsxpstyle_p.h
index 626bcc4ad7..d61132295c 100644
--- a/src/widgets/styles/qwindowsxpstyle_p.h
+++ b/src/widgets/styles/qwindowsxpstyle_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -44,8 +44,6 @@
#include <private/qwindowsstyle_p.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -99,6 +97,4 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QWINDOWSXPSTYLE_P_H
diff --git a/src/widgets/styles/qwindowsxpstyle_p_p.h b/src/widgets/styles/qwindowsxpstyle_p_p.h
index 234b8e8a59..783adc3085 100644
--- a/src/widgets/styles/qwindowsxpstyle_p_p.h
+++ b/src/widgets/styles/qwindowsxpstyle_p_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/styles/styles.pri b/src/widgets/styles/styles.pri
index b15eb1fa48..b39b17fd86 100644
--- a/src/widgets/styles/styles.pri
+++ b/src/widgets/styles/styles.pri
@@ -40,7 +40,7 @@ contains( styles, all ) {
styles = fusion mac windows windowsxp windowsvista
}
-!macx-*|ios:styles -= mac
+!macx:styles -= mac
contains(QT_CONFIG, gtkstyle) {
QMAKE_CXXFLAGS += $$QT_CFLAGS_QGTKSTYLE
@@ -52,7 +52,6 @@ contains(QT_CONFIG, gtkstyle) {
contains( styles, mac ) {
HEADERS += \
styles/qmacstyle_mac_p.h \
- styles/qmacstylepixmaps_mac_p.h \
styles/qmacstyle_mac_p_p.h
OBJECTIVE_SOURCES += styles/qmacstyle_mac.mm
@@ -136,3 +135,10 @@ contains( styles, windowsmobile ) {
} else {
DEFINES += QT_NO_STYLE_WINDOWSMOBILE
}
+
+contains( styles, android ) {
+ HEADERS += styles/qandroidstyle_p.h
+ SOURCES += styles/qandroidstyle.cpp
+} else {
+ DEFINES += QT_NO_STYLE_ANDROID
+}
diff --git a/src/widgets/util/qcolormap.cpp b/src/widgets/util/qcolormap.cpp
index 24457520c4..03ee8a395e 100644
--- a/src/widgets/util/qcolormap.cpp
+++ b/src/widgets/util/qcolormap.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/util/qcolormap.h b/src/widgets/util/qcolormap.h
index d3b9535923..b869bd9555 100644
--- a/src/widgets/util/qcolormap.h
+++ b/src/widgets/util/qcolormap.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -47,8 +47,6 @@
#include <QtCore/qvector.h>
#include <QtGui/qwindowdefs.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -91,6 +89,4 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QCOLORMAP_H
diff --git a/src/widgets/util/qcolormap.qdoc b/src/widgets/util/qcolormap.qdoc
index 48fe1c7eec..ae337b511c 100644
--- a/src/widgets/util/qcolormap.qdoc
+++ b/src/widgets/util/qcolormap.qdoc
@@ -67,7 +67,7 @@
/*!
\fn QColormap::~QColormap()
-
+
Destroys the colormap.
*/
diff --git a/src/widgets/util/qcompleter.cpp b/src/widgets/util/qcompleter.cpp
index d8186d795d..64b7b12e90 100644
--- a/src/widgets/util/qcompleter.cpp
+++ b/src/widgets/util/qcompleter.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -45,7 +45,7 @@
\since 4.2
\inmodule QtWidgets
-
+
You can use QCompleter to provide auto completions in any Qt
widget, such as QLineEdit and QComboBox.
When the user starts typing a word, QCompleter suggests possible ways of
diff --git a/src/widgets/util/qcompleter.h b/src/widgets/util/qcompleter.h
index ba43e4470a..737d9f5fba 100644
--- a/src/widgets/util/qcompleter.h
+++ b/src/widgets/util/qcompleter.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -48,8 +48,6 @@
#include <QtCore/qabstractitemmodel.h>
#include <QtCore/qrect.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -165,6 +163,4 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QCOMPLETER_H
diff --git a/src/widgets/util/qcompleter_p.h b/src/widgets/util/qcompleter_p.h
index 1eb2002319..26d539a57b 100644
--- a/src/widgets/util/qcompleter_p.h
+++ b/src/widgets/util/qcompleter_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/util/qflickgesture.cpp b/src/widgets/util/qflickgesture.cpp
index 980f144a0f..b0cd4a9540 100644
--- a/src/widgets/util/qflickgesture.cpp
+++ b/src/widgets/util/qflickgesture.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/util/qflickgesture_p.h b/src/widgets/util/qflickgesture_p.h
index 04cf847860..49a8049d44 100644
--- a/src/widgets/util/qflickgesture_p.h
+++ b/src/widgets/util/qflickgesture_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/util/qscroller.cpp b/src/widgets/util/qscroller.cpp
index 1670d0ab57..0a58711b92 100644
--- a/src/widgets/util/qscroller.cpp
+++ b/src/widgets/util/qscroller.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -237,7 +237,7 @@ private:
\since 5.0
\inmodule QtWidgets
-
+
With kinetic scrolling, the user can push the widget in a given
direction and it will continue to scroll in this direction until it is
stopped either by the user or by friction. Aspects of inertia, friction
diff --git a/src/widgets/util/qscroller.h b/src/widgets/util/qscroller.h
index b0ff9dc5c5..1b382f3d31 100644
--- a/src/widgets/util/qscroller.h
+++ b/src/widgets/util/qscroller.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -46,8 +46,6 @@
#include <QtCore/QPointF>
#include <QtWidgets/QScrollerProperties>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -149,6 +147,4 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QSCROLLER_H
diff --git a/src/widgets/util/qscroller_mac.mm b/src/widgets/util/qscroller_mac.mm
index 4bde960ecd..0f9f2a028c 100644
--- a/src/widgets/util/qscroller_mac.mm
+++ b/src/widgets/util/qscroller_mac.mm
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/util/qscroller_p.h b/src/widgets/util/qscroller_p.h
index 73f5814291..a12c364960 100644
--- a/src/widgets/util/qscroller_p.h
+++ b/src/widgets/util/qscroller_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/util/qscrollerproperties.cpp b/src/widgets/util/qscrollerproperties.cpp
index ed593ea2cb..cebb054a53 100644
--- a/src/widgets/util/qscrollerproperties.cpp
+++ b/src/widgets/util/qscrollerproperties.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -94,7 +94,7 @@ QScrollerPropertiesPrivate *QScrollerPropertiesPrivate::defaults()
\since 4.8
\inmodule QtWidgets
-
+
The QScrollerProperties class stores the parameters used by QScroller.
The default settings are platform dependent so that Qt emulates the
diff --git a/src/widgets/util/qscrollerproperties.h b/src/widgets/util/qscrollerproperties.h
index 58bce74bca..eb34c9701e 100644
--- a/src/widgets/util/qscrollerproperties.h
+++ b/src/widgets/util/qscrollerproperties.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -46,8 +46,6 @@
#include <QtCore/QMetaType>
#include <QtCore/QVariant>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -134,6 +132,4 @@ QT_END_NAMESPACE
Q_DECLARE_METATYPE(QScrollerProperties::OvershootPolicy)
Q_DECLARE_METATYPE(QScrollerProperties::FrameRates)
-QT_END_HEADER
-
#endif // QSCROLLERPROPERTIES_H
diff --git a/src/widgets/util/qscrollerproperties_p.h b/src/widgets/util/qscrollerproperties_p.h
index 8abe7c7a2e..4d962b6b78 100644
--- a/src/widgets/util/qscrollerproperties_p.h
+++ b/src/widgets/util/qscrollerproperties_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/util/qsystemtrayicon.cpp b/src/widgets/util/qsystemtrayicon.cpp
index a5d3aedf76..f74d88f6a0 100644
--- a/src/widgets/util/qsystemtrayicon.cpp
+++ b/src/widgets/util/qsystemtrayicon.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -81,7 +81,7 @@ QT_BEGIN_NAMESPACE
tray specification, including recent versions of KDE and GNOME.
\li All supported versions of Mac OS X. Note that the Growl
notification system must be installed for
- QSystemTrayIcon::showMessage() to display messages.
+ QSystemTrayIcon::showMessage() to display messages on Mac OS X prior to 10.8 (Mountain Lion).
\endlist
To check whether a system tray is present on the user's desktop,
@@ -379,7 +379,7 @@ bool QSystemTrayIcon::supportsMessages()
On Mac OS X, the Growl notification system must be installed for this function to
display messages.
-
+
\sa show(), supportsMessages()
*/
void QSystemTrayIcon::showMessage(const QString& title, const QString& msg,
diff --git a/src/widgets/util/qsystemtrayicon.h b/src/widgets/util/qsystemtrayicon.h
index 201ea85253..278efae586 100644
--- a/src/widgets/util/qsystemtrayicon.h
+++ b/src/widgets/util/qsystemtrayicon.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -48,8 +48,6 @@
#include <QtGui/qicon.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -126,7 +124,5 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QT_NO_SYSTEMTRAYICON
#endif // QSYSTEMTRAYICON_H
diff --git a/src/widgets/util/qsystemtrayicon_p.h b/src/widgets/util/qsystemtrayicon_p.h
index c61ba733e9..211ef308f1 100644
--- a/src/widgets/util/qsystemtrayicon_p.h
+++ b/src/widgets/util/qsystemtrayicon_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/util/qsystemtrayicon_qpa.cpp b/src/widgets/util/qsystemtrayicon_qpa.cpp
index 113f0b68b2..3ce89e352d 100644
--- a/src/widgets/util/qsystemtrayicon_qpa.cpp
+++ b/src/widgets/util/qsystemtrayicon_qpa.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/util/qsystemtrayicon_win.cpp b/src/widgets/util/qsystemtrayicon_win.cpp
index 209fb206e1..d273060f7b 100644
--- a/src/widgets/util/qsystemtrayicon_win.cpp
+++ b/src/widgets/util/qsystemtrayicon_win.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -117,7 +117,7 @@ public:
bool trayMessage(DWORD msg);
void setIconContents(NOTIFYICONDATA &data);
bool showMessage(const QString &title, const QString &message, QSystemTrayIcon::MessageIcon type, uint uSecs);
- QRect findIconGeometry(const int a_iButtonID);
+ QRect findIconGeometry(UINT iconId);
HICON createIcon();
bool winEvent(MSG *m, long *result);
@@ -345,12 +345,12 @@ bool QSystemTrayIconSys::winEvent( MSG *m, long *result )
case NIN_KEYSELECT:
if (ignoreNextMouseRelease)
ignoreNextMouseRelease = false;
- else
+ else
emit q->activated(QSystemTrayIcon::Trigger);
break;
case WM_LBUTTONDBLCLK:
- ignoreNextMouseRelease = true; // Since DBLCLICK Generates a second mouse
+ ignoreNextMouseRelease = true; // Since DBLCLICK Generates a second mouse
// release we must ignore it
emit q->activated(QSystemTrayIcon::DoubleClick);
break;
@@ -413,8 +413,15 @@ void QSystemTrayIconPrivate::install_sys()
*
* If it fails an invalid rect is returned.
*/
-QRect QSystemTrayIconSys::findIconGeometry(const int iconId)
+
+QRect QSystemTrayIconSys::findIconGeometry(UINT iconId)
{
+ struct AppData
+ {
+ HWND hwnd;
+ UINT uID;
+ };
+
static PtrShell_NotifyIconGetRect Shell_NotifyIconGetRect =
(PtrShell_NotifyIconGetRect)QSystemLibrary::resolve(QLatin1String("shell32"),
"Shell_NotifyIconGetRect");
@@ -474,21 +481,18 @@ QRect QSystemTrayIconSys::findIconGeometry(const int iconId)
//search for our icon among all toolbar buttons
for (int toolbarButton = 0; toolbarButton < buttonCount; ++toolbarButton ) {
SIZE_T numBytes = 0;
- DWORD appData[2] = { 0, 0 };
+ AppData appData = { 0, 0 };
SendMessage(trayHandle, TB_GETBUTTON, toolbarButton , (LPARAM)data);
if (!ReadProcessMemory(trayProcess, data, &buttonData, sizeof(TBBUTTON), &numBytes))
continue;
- if (!ReadProcessMemory(trayProcess, (LPVOID) buttonData.dwData, appData, sizeof(appData), &numBytes))
+ if (!ReadProcessMemory(trayProcess, (LPVOID) buttonData.dwData, &appData, sizeof(AppData), &numBytes))
continue;
- int currentIconId = appData[1];
- HWND currentIconHandle = (HWND) appData[0];
bool isHidden = buttonData.fsState & TBSTATE_HIDDEN;
- if (currentIconHandle == m_hwnd &&
- currentIconId == iconId && !isHidden) {
+ if (m_hwnd == appData.hwnd && appData.uID == iconId && !isHidden) {
SendMessage(trayHandle, TB_GETITEMRECT, toolbarButton , (LPARAM)data);
RECT iconRect = {0, 0, 0, 0};
if(ReadProcessMemory(trayProcess, data, &iconRect, sizeof(RECT), &numBytes)) {
diff --git a/src/widgets/util/qsystemtrayicon_wince.cpp b/src/widgets/util/qsystemtrayicon_wince.cpp
index b6937aee2f..6347ee6c04 100644
--- a/src/widgets/util/qsystemtrayicon_wince.cpp
+++ b/src/widgets/util/qsystemtrayicon_wince.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -166,7 +166,7 @@ bool QSystemTrayIconSys::winEvent( MSG *m, long *result )
break;
case WM_LBUTTONDBLCLK:
- ignoreNextMouseRelease = true; // Since DBLCLICK Generates a second mouse
+ ignoreNextMouseRelease = true; // Since DBLCLICK Generates a second mouse
// release we must ignore it
emit q->activated(QSystemTrayIcon::DoubleClick);
break;
diff --git a/src/widgets/util/qsystemtrayicon_x11.cpp b/src/widgets/util/qsystemtrayicon_x11.cpp
index 7d2b94ef11..e04656974d 100644
--- a/src/widgets/util/qsystemtrayicon_x11.cpp
+++ b/src/widgets/util/qsystemtrayicon_x11.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/util/qundogroup.cpp b/src/widgets/util/qundogroup.cpp
index 7a524cf416..57563c434b 100644
--- a/src/widgets/util/qundogroup.cpp
+++ b/src/widgets/util/qundogroup.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/util/qundogroup.h b/src/widgets/util/qundogroup.h
index 8e888f993b..9a961d7eda 100644
--- a/src/widgets/util/qundogroup.h
+++ b/src/widgets/util/qundogroup.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -45,8 +45,6 @@
#include <QtCore/qobject.h>
#include <QtCore/qstring.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
class QUndoGroupPrivate;
@@ -104,6 +102,4 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QUNDOGROUP_H
diff --git a/src/widgets/util/qundostack.cpp b/src/widgets/util/qundostack.cpp
index 77726adf27..46730ef7bd 100644
--- a/src/widgets/util/qundostack.cpp
+++ b/src/widgets/util/qundostack.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -54,7 +54,7 @@ QT_BEGIN_NAMESPACE
\since 4.2
\inmodule QtWidgets
-
+
For an overview of Qt's Undo Framework, see the
\l{Overview of Qt's Undo Framework}{overview document}.
@@ -324,7 +324,7 @@ const QUndoCommand *QUndoCommand::child(int index) const
\since 4.2
\inmodule QtWidgets
-
+
For an overview of Qt's Undo Framework, see the
\l{Overview of Qt's Undo Framework}{overview document}.
@@ -1009,7 +1009,7 @@ void QUndoStack::endMacro()
This function returns a const pointer, because modifying a command,
once it has been pushed onto the stack and executed, almost always
- causes corruption of the state of the document, if the command is
+ causes corruption of the state of the document, if the command is
later undone or redone.
\sa QUndoCommand::child()
diff --git a/src/widgets/util/qundostack.h b/src/widgets/util/qundostack.h
index 44b8337f57..4756ca314f 100644
--- a/src/widgets/util/qundostack.h
+++ b/src/widgets/util/qundostack.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -45,8 +45,6 @@
#include <QtCore/qobject.h>
#include <QtCore/qstring.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -153,6 +151,4 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QUNDOSTACK_H
diff --git a/src/widgets/util/qundostack_p.h b/src/widgets/util/qundostack_p.h
index 7299a38b4d..039350ea90 100644
--- a/src/widgets/util/qundostack_p.h
+++ b/src/widgets/util/qundostack_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/util/qundoview.cpp b/src/widgets/util/qundoview.cpp
index 3b1b2e1117..a7d89e7749 100644
--- a/src/widgets/util/qundoview.cpp
+++ b/src/widgets/util/qundoview.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/util/qundoview.h b/src/widgets/util/qundoview.h
index bc262799d9..80a0548bce 100644
--- a/src/widgets/util/qundoview.h
+++ b/src/widgets/util/qundoview.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -47,8 +47,6 @@
#ifndef QT_NO_UNDOVIEW
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
class QUndoViewPrivate;
@@ -95,7 +93,5 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QT_NO_UNDOVIEW
#endif // QUNDOVIEW_H
diff --git a/src/widgets/util/util.pri b/src/widgets/util/util.pri
index 5847b12166..598a3082c0 100644
--- a/src/widgets/util/util.pri
+++ b/src/widgets/util/util.pri
@@ -36,6 +36,6 @@ win32:!wince* {
SOURCES += util/qsystemtrayicon_qpa.cpp
}
-macx {
+mac {
OBJECTIVE_SOURCES += util/qscroller_mac.mm
}
diff --git a/src/widgets/widgets/qabstractbutton.cpp b/src/widgets/widgets/qabstractbutton.cpp
index 5e9d100214..3f9b28a883 100644
--- a/src/widgets/widgets/qabstractbutton.cpp
+++ b/src/widgets/widgets/qabstractbutton.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -380,7 +380,7 @@ void QAbstractButtonPrivate::moveFocus(int key)
QAbstractButton *fb = qobject_cast<QAbstractButton *>(f);
if (!fb || !buttonList.contains(fb))
return;
-
+
QAbstractButton *candidate = 0;
int bestScore = -1;
QRect target = f->rect().translated(f->mapToGlobal(QPoint(0,0)));
diff --git a/src/widgets/widgets/qabstractbutton.h b/src/widgets/widgets/qabstractbutton.h
index 9c27e3523f..4732f461e4 100644
--- a/src/widgets/widgets/qabstractbutton.h
+++ b/src/widgets/widgets/qabstractbutton.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -46,8 +46,6 @@
#include <QtGui/qkeysequence.h>
#include <QtWidgets/qwidget.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -155,6 +153,4 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QABSTRACTBUTTON_H
diff --git a/src/widgets/widgets/qabstractbutton_p.h b/src/widgets/widgets/qabstractbutton_p.h
index 2e347ae933..4585728848 100644
--- a/src/widgets/widgets/qabstractbutton_p.h
+++ b/src/widgets/widgets/qabstractbutton_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/widgets/qabstractscrollarea.cpp b/src/widgets/widgets/qabstractscrollarea.cpp
index 391a06917c..900e95f4da 100644
--- a/src/widgets/widgets/qabstractscrollarea.cpp
+++ b/src/widgets/widgets/qabstractscrollarea.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -452,7 +452,7 @@ void QAbstractScrollAreaPrivate::layoutChildren()
// no corner widget. Also, on the Mac we paint if there is a native
// (transparent) sizegrip in the area where a corner widget would be.
if ((needv && needh && hasCornerWidget == false && scrollOverlap == 0)
- || ((needv || needh)
+ || ((needv || needh)
#ifdef Q_WS_MAC
&& hasMacSizeGrip
#endif
diff --git a/src/widgets/widgets/qabstractscrollarea.h b/src/widgets/widgets/qabstractscrollarea.h
index 79038e9fdd..ccf16b5e5c 100644
--- a/src/widgets/widgets/qabstractscrollarea.h
+++ b/src/widgets/widgets/qabstractscrollarea.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -44,8 +44,6 @@
#include <QtWidgets/qframe.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -140,6 +138,4 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QABSTRACTSCROLLAREA_H
diff --git a/src/widgets/widgets/qabstractscrollarea_p.h b/src/widgets/widgets/qabstractscrollarea_p.h
index 2766211732..34d767fe29 100644
--- a/src/widgets/widgets/qabstractscrollarea_p.h
+++ b/src/widgets/widgets/qabstractscrollarea_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/widgets/qabstractslider.cpp b/src/widgets/widgets/qabstractslider.cpp
index 5932e1be9b..8c3dedb84f 100644
--- a/src/widgets/widgets/qabstractslider.cpp
+++ b/src/widgets/widgets/qabstractslider.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -724,7 +724,7 @@ bool QAbstractSliderPrivate::scrollByDelta(Qt::Orientation orientation, Qt::Keyb
#else
// Native UI-elements on Mac can scroll hundreds of lines at a time as
// a result of acceleration. So keep the same behaviour in Qt, and
- // don't restrict stepsToScroll to certain maximum (pageStep):
+ // don't restrict stepsToScroll to certain maximum (pageStep):
stepsToScroll = int(offset_accumulated);
#endif
offset_accumulated -= int(offset_accumulated);
diff --git a/src/widgets/widgets/qabstractslider.h b/src/widgets/widgets/qabstractslider.h
index a49970a2d5..82c8f409a0 100644
--- a/src/widgets/widgets/qabstractslider.h
+++ b/src/widgets/widgets/qabstractslider.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -44,8 +44,6 @@
#include <QtWidgets/qwidget.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -163,6 +161,4 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QABSTRACTSLIDER_H
diff --git a/src/widgets/widgets/qabstractslider_p.h b/src/widgets/widgets/qabstractslider_p.h
index 42f25501b1..35ee934096 100644
--- a/src/widgets/widgets/qabstractslider_p.h
+++ b/src/widgets/widgets/qabstractslider_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -87,7 +87,7 @@ public:
QBasicTimer repeatActionTimer;
int repeatActionTime;
QAbstractSlider::SliderAction repeatAction;
-
+
#ifdef QT_KEYPAD_NAVIGATION
int origValue;
diff --git a/src/widgets/widgets/qabstractspinbox.cpp b/src/widgets/widgets/qabstractspinbox.cpp
index 14d22c458b..765dcb8981 100644
--- a/src/widgets/widgets/qabstractspinbox.cpp
+++ b/src/widgets/widgets/qabstractspinbox.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -825,14 +825,13 @@ QSize QAbstractSpinBox::sizeHint() const
ensurePolished();
const QFontMetrics fm(fontMetrics());
- int h = d->edit->sizeHint().height() + 4;
+ int h = d->edit->sizeHint().height();
int w = 0;
QString s;
- s = d->prefix + d->textFromValue(d->minimum) + d->suffix + QLatin1Char(' ');
- s.truncate(18);
+ QString fixedContent = d->prefix + d->suffix + QLatin1Char(' ');
+ s = d->textFromValue(d->minimum) + fixedContent;
w = qMax(w, fm.width(s));
- s = d->prefix + d->textFromValue(d->maximum) + d->suffix + QLatin1Char(' ');
- s.truncate(18);
+ s = d->textFromValue(d->maximum) + fixedContent;
w = qMax(w, fm.width(s));
if (d->specialValueText.size()) {
s = d->specialValueText;
@@ -857,27 +856,29 @@ QSize QAbstractSpinBox::minimumSizeHint() const
{
Q_D(const QAbstractSpinBox);
if (d->cachedMinimumSizeHint.isEmpty()) {
+ //Use the prefix and range to calculate the minimumSizeHint
ensurePolished();
const QFontMetrics fm(fontMetrics());
int h = d->edit->minimumSizeHint().height();
- int w = fm.width(QLatin1String("1000"));
+ int w = 0;
+
+ QString s;
+ QString fixedContent = d->prefix + QLatin1Char(' ');
+ s = d->textFromValue(d->minimum) + fixedContent;
+ w = qMax(w, fm.width(s));
+ s = d->textFromValue(d->maximum) + fixedContent;
+ w = qMax(w, fm.width(s));
+
+ if (d->specialValueText.size()) {
+ s = d->specialValueText;
+ w = qMax(w, fm.width(s));
+ }
w += 2; // cursor blinking space
QStyleOptionSpinBox opt;
initStyleOption(&opt);
QSize hint(w, h);
- QSize extra(35, 6);
- opt.rect.setSize(hint + extra);
- extra += hint - style()->subControlRect(QStyle::CC_SpinBox, &opt,
- QStyle::SC_SpinBoxEditField, this).size();
- // get closer to final result by repeating the calculation
- opt.rect.setSize(hint + extra);
- extra += hint - style()->subControlRect(QStyle::CC_SpinBox, &opt,
- QStyle::SC_SpinBoxEditField, this).size();
- hint += extra;
-
- opt.rect = rect();
d->cachedMinimumSizeHint = style()->sizeFromContents(QStyle::CT_SpinBox, &opt, hint, this)
.expandedTo(QApplication::globalStrut());
@@ -1724,7 +1725,8 @@ void QAbstractSpinBoxPrivate::setRange(const QVariant &min, const QVariant &max)
clearCache();
minimum = min;
maximum = (variantCompare(min, max) < 0 ? max : min);
- cachedSizeHint = QSize(); // minimumSizeHint doesn't care about min/max
+ cachedSizeHint = QSize();
+ cachedMinimumSizeHint = QSize(); // minimumSizeHint cares about min/max
reset();
if (!(bound(value) == value)) {
diff --git a/src/widgets/widgets/qabstractspinbox.h b/src/widgets/widgets/qabstractspinbox.h
index 49cd8f38f1..4f6aad0cde 100644
--- a/src/widgets/widgets/qabstractspinbox.h
+++ b/src/widgets/widgets/qabstractspinbox.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -45,8 +45,6 @@
#include <QtWidgets/qwidget.h>
#include <QtGui/qvalidator.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -175,6 +173,4 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(QAbstractSpinBox::StepEnabled)
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QABSTRACTSPINBOX_H
diff --git a/src/widgets/widgets/qabstractspinbox_p.h b/src/widgets/widgets/qabstractspinbox_p.h
index d4484b7a56..0eeec02abc 100644
--- a/src/widgets/widgets/qabstractspinbox_p.h
+++ b/src/widgets/widgets/qabstractspinbox_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/widgets/qbuttongroup.cpp b/src/widgets/widgets/qbuttongroup.cpp
index 3da81f8360..f22910007f 100644
--- a/src/widgets/widgets/qbuttongroup.cpp
+++ b/src/widgets/widgets/qbuttongroup.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -139,7 +139,7 @@
\fn void QButtonGroup::buttonPressed(QAbstractButton *button)
\since 4.2
- This signal is emitted when the given \a button is pressed down.
+ This signal is emitted when the given \a button is pressed down.
\sa QAbstractButton::pressed()
*/
@@ -158,7 +158,7 @@
\fn void QButtonGroup::buttonReleased(QAbstractButton *button)
\since 4.2
- This signal is emitted when the given \a button is released.
+ This signal is emitted when the given \a button is released.
\sa QAbstractButton::released()
*/
diff --git a/src/widgets/widgets/qbuttongroup.h b/src/widgets/widgets/qbuttongroup.h
index 76ce549d95..84fe26e0df 100644
--- a/src/widgets/widgets/qbuttongroup.h
+++ b/src/widgets/widgets/qbuttongroup.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -44,8 +44,6 @@
#include <QtCore/qobject.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -100,6 +98,4 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QBUTTONGROUP_H
diff --git a/src/widgets/widgets/qcalendartextnavigator_p.h b/src/widgets/widgets/qcalendartextnavigator_p.h
index b153e4a24e..88bd3c6a71 100644
--- a/src/widgets/widgets/qcalendartextnavigator_p.h
+++ b/src/widgets/widgets/qcalendartextnavigator_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/widgets/qcalendarwidget.cpp b/src/widgets/widgets/qcalendarwidget.cpp
index 0fdf039bc3..82c5a29497 100644
--- a/src/widgets/widgets/qcalendarwidget.cpp
+++ b/src/widgets/widgets/qcalendarwidget.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -2591,7 +2591,7 @@ QCalendarWidget::HorizontalHeaderFormat QCalendarWidget::horizontalHeaderFormat(
}
-/*!
+/*!
\enum QCalendarWidget::VerticalHeaderFormat
This enum type defines the various formats the vertical header can display.
diff --git a/src/widgets/widgets/qcalendarwidget.h b/src/widgets/widgets/qcalendarwidget.h
index 5d4c1722b4..4a4d21ebd6 100644
--- a/src/widgets/widgets/qcalendarwidget.h
+++ b/src/widgets/widgets/qcalendarwidget.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -45,8 +45,6 @@
#include <QtWidgets/qwidget.h>
#include <QtCore/qdatetime.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -191,7 +189,5 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QCALENDARWIDGET_H
diff --git a/src/widgets/widgets/qcheckbox.cpp b/src/widgets/widgets/qcheckbox.cpp
index fb8ed6c890..50d0ab8276 100644
--- a/src/widgets/widgets/qcheckbox.cpp
+++ b/src/widgets/widgets/qcheckbox.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/widgets/qcheckbox.h b/src/widgets/widgets/qcheckbox.h
index 1bf1bf56a0..9adf5f6567 100644
--- a/src/widgets/widgets/qcheckbox.h
+++ b/src/widgets/widgets/qcheckbox.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -44,8 +44,6 @@
#include <QtWidgets/qabstractbutton.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -92,6 +90,4 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QCHECKBOX_H
diff --git a/src/widgets/widgets/qcocoatoolbardelegate_mac.mm b/src/widgets/widgets/qcocoatoolbardelegate_mac.mm
index 2b637bc93c..2ea66b0d40 100644
--- a/src/widgets/widgets/qcocoatoolbardelegate_mac.mm
+++ b/src/widgets/widgets/qcocoatoolbardelegate_mac.mm
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/widgets/qcocoatoolbardelegate_mac_p.h b/src/widgets/widgets/qcocoatoolbardelegate_mac_p.h
index 94534beaac..f74f608660 100644
--- a/src/widgets/widgets/qcocoatoolbardelegate_mac_p.h
+++ b/src/widgets/widgets/qcocoatoolbardelegate_mac_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/widgets/qcombobox.cpp b/src/widgets/widgets/qcombobox.cpp
index bb57fa336b..6103b9b4c2 100644
--- a/src/widgets/widgets/qcombobox.cpp
+++ b/src/widgets/widgets/qcombobox.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/widgets/qcombobox.h b/src/widgets/widgets/qcombobox.h
index 0eb5881b93..d167ac7d11 100644
--- a/src/widgets/widgets/qcombobox.h
+++ b/src/widgets/widgets/qcombobox.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -47,8 +47,6 @@
#include <QtCore/qabstractitemmodel.h>
#include <QtCore/qvariant.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
#ifndef QT_NO_COMBOBOX
@@ -280,6 +278,4 @@ inline void QComboBox::insertItem(int aindex, const QString &atext,
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QCOMBOBOX_H
diff --git a/src/widgets/widgets/qcombobox_p.h b/src/widgets/widgets/qcombobox_p.h
index 0004e3d5ab..14cf9e7925 100644
--- a/src/widgets/widgets/qcombobox_p.h
+++ b/src/widgets/widgets/qcombobox_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -282,8 +282,8 @@ private:
QComboBox *mCombo;
};
-// Note that this class is intentionally not using QStyledItemDelegate
-// Vista does not use the new theme for combo boxes and there might
+// Note that this class is intentionally not using QStyledItemDelegate
+// Vista does not use the new theme for combo boxes and there might
// be other side effects from using the new class
class QComboBoxDelegate : public QItemDelegate
{ Q_OBJECT
diff --git a/src/widgets/widgets/qcommandlinkbutton.cpp b/src/widgets/widgets/qcommandlinkbutton.cpp
index f9be0053e8..18f7b1784e 100644
--- a/src/widgets/widgets/qcommandlinkbutton.cpp
+++ b/src/widgets/widgets/qcommandlinkbutton.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/widgets/qcommandlinkbutton.h b/src/widgets/widgets/qcommandlinkbutton.h
index a74d6a7b84..e18fb0a4f0 100644
--- a/src/widgets/widgets/qcommandlinkbutton.h
+++ b/src/widgets/widgets/qcommandlinkbutton.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -44,8 +44,6 @@
#include <QtWidgets/qpushbutton.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -81,6 +79,4 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QCOMMANDLINKBUTTON
diff --git a/src/widgets/widgets/qdatetimeedit.cpp b/src/widgets/widgets/qdatetimeedit.cpp
index fb64850923..a0bbbbf7c7 100644
--- a/src/widgets/widgets/qdatetimeedit.cpp
+++ b/src/widgets/widgets/qdatetimeedit.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -981,9 +981,9 @@ QSize QDateTimeEdit::sizeHint() const
int h = d->edit->sizeHint().height();
int w = 0;
QString s;
- s = d->textFromValue(d->minimum) + QLatin1String(" ");
+ s = d->textFromValue(d->minimum) + QLatin1Char(' ');
w = qMax<int>(w, fm.width(s));
- s = d->textFromValue(d->maximum) + QLatin1String(" ");
+ s = d->textFromValue(d->maximum) + QLatin1Char(' ');
w = qMax<int>(w, fm.width(s));
if (d->specialValueText.size()) {
s = d->specialValueText;
@@ -1000,19 +1000,8 @@ QSize QDateTimeEdit::sizeHint() const
} else
#endif
{
- QSize extra(35, 6);
QStyleOptionSpinBox opt;
initStyleOption(&opt);
- opt.rect.setSize(hint + extra);
- extra += hint - style()->subControlRect(QStyle::CC_SpinBox, &opt,
- QStyle::SC_SpinBoxEditField, this).size();
- // get closer to final result by repeating the calculation
- opt.rect.setSize(hint + extra);
- extra += hint - style()->subControlRect(QStyle::CC_SpinBox, &opt,
- QStyle::SC_SpinBoxEditField, this).size();
- hint += extra;
-
- opt.rect = rect();
d->cachedSizeHint = style()->sizeFromContents(QStyle::CT_SpinBox, &opt, hint, this)
.expandedTo(QApplication::globalStrut());
}
@@ -1023,6 +1012,7 @@ QSize QDateTimeEdit::sizeHint() const
return d->cachedSizeHint;
}
+
/*!
\reimp
*/
diff --git a/src/widgets/widgets/qdatetimeedit.h b/src/widgets/widgets/qdatetimeedit.h
index d3197632cf..0b6dfb6e28 100644
--- a/src/widgets/widgets/qdatetimeedit.h
+++ b/src/widgets/widgets/qdatetimeedit.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -46,8 +46,6 @@
#include <QtCore/qvariant.h>
#include <QtWidgets/qabstractspinbox.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -235,6 +233,4 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(QDateTimeEdit::Sections)
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QDATETIMEEDIT_H
diff --git a/src/widgets/widgets/qdatetimeedit_p.h b/src/widgets/widgets/qdatetimeedit_p.h
index c8c9cd0e23..143979d4bc 100644
--- a/src/widgets/widgets/qdatetimeedit_p.h
+++ b/src/widgets/widgets/qdatetimeedit_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/widgets/qdial.cpp b/src/widgets/widgets/qdial.cpp
index c7c6c51c53..b415b5254a 100644
--- a/src/widgets/widgets/qdial.cpp
+++ b/src/widgets/widgets/qdial.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/widgets/qdial.h b/src/widgets/widgets/qdial.h
index c7be201b96..16c4001517 100644
--- a/src/widgets/widgets/qdial.h
+++ b/src/widgets/widgets/qdial.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -45,8 +45,6 @@
#include <QtWidgets/qabstractslider.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -105,6 +103,4 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QDIAL_H
diff --git a/src/widgets/widgets/qdialogbuttonbox.cpp b/src/widgets/widgets/qdialogbuttonbox.cpp
index 3ebad888a4..bc5d84e259 100644
--- a/src/widgets/widgets/qdialogbuttonbox.cpp
+++ b/src/widgets/widgets/qdialogbuttonbox.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/widgets/qdialogbuttonbox.h b/src/widgets/widgets/qdialogbuttonbox.h
index 06776bbd93..6715c590e2 100644
--- a/src/widgets/widgets/qdialogbuttonbox.h
+++ b/src/widgets/widgets/qdialogbuttonbox.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -44,8 +44,6 @@
#include <QtWidgets/qwidget.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -162,6 +160,4 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(QDialogButtonBox::StandardButtons)
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QDIALOGBUTTONBOX_H
diff --git a/src/widgets/widgets/qdockarealayout.cpp b/src/widgets/widgets/qdockarealayout.cpp
index 7631014905..ca831f5a39 100644
--- a/src/widgets/widgets/qdockarealayout.cpp
+++ b/src/widgets/widgets/qdockarealayout.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -2004,7 +2004,7 @@ bool QDockAreaLayoutInfo::restoreState(QDataStream &stream, QList<QDockWidget*>
//we need to make sure the element is in the list so the dock widget can eventually be docked correctly
if (!testing)
item_list.append(item);
-
+
//here we need to make sure we change the item in the item_list
QDockAreaLayoutItem &lastItem = testing ? item : item_list.last();
diff --git a/src/widgets/widgets/qdockarealayout_p.h b/src/widgets/widgets/qdockarealayout_p.h
index 53e16911c1..86bf4d32e5 100644
--- a/src/widgets/widgets/qdockarealayout_p.h
+++ b/src/widgets/widgets/qdockarealayout_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/widgets/qdockwidget.cpp b/src/widgets/widgets/qdockwidget.cpp
index a2e363f991..7485644a08 100644
--- a/src/widgets/widgets/qdockwidget.cpp
+++ b/src/widgets/widgets/qdockwidget.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/widgets/qdockwidget.h b/src/widgets/widgets/qdockwidget.h
index 993ae6b914..ecf8c67e45 100644
--- a/src/widgets/widgets/qdockwidget.h
+++ b/src/widgets/widgets/qdockwidget.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -44,8 +44,6 @@
#include <QtWidgets/qwidget.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -140,6 +138,4 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(QDockWidget::DockWidgetFeatures)
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QDYNAMICDOCKWIDGET_H
diff --git a/src/widgets/widgets/qdockwidget_p.h b/src/widgets/widgets/qdockwidget_p.h
index 7b2e6f97d1..800f523825 100644
--- a/src/widgets/widgets/qdockwidget_p.h
+++ b/src/widgets/widgets/qdockwidget_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/widgets/qeffects.cpp b/src/widgets/widgets/qeffects.cpp
index 8cd944e133..83060bb571 100644
--- a/src/widgets/widgets/qeffects.cpp
+++ b/src/widgets/widgets/qeffects.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -276,7 +276,7 @@ void QAlphaWidget::render()
#endif // Q_OS_WIN
widget->hide();
} else {
- //Since we are faking the visibility of the widget
+ //Since we are faking the visibility of the widget
//we need to unset the hidden state on it before calling show
widget->setAttribute(Qt::WA_WState_Hidden, true);
widget->show();
@@ -541,7 +541,7 @@ void QRollEffect::scroll()
#endif
widget->hide();
} else {
- //Since we are faking the visibility of the widget
+ //Since we are faking the visibility of the widget
//we need to unset the hidden state on it before calling show
widget->setAttribute(Qt::WA_WState_Hidden, true);
widget->show();
diff --git a/src/widgets/widgets/qeffects_p.h b/src/widgets/widgets/qeffects_p.h
index bbf11face4..a96a60a956 100644
--- a/src/widgets/widgets/qeffects_p.h
+++ b/src/widgets/widgets/qeffects_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/widgets/qfocusframe.cpp b/src/widgets/widgets/qfocusframe.cpp
index 02d8d5aae9..70b335bfb1 100644
--- a/src/widgets/widgets/qfocusframe.cpp
+++ b/src/widgets/widgets/qfocusframe.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/widgets/qfocusframe.h b/src/widgets/widgets/qfocusframe.h
index 2993ed5c7f..e1b0004ffc 100644
--- a/src/widgets/widgets/qfocusframe.h
+++ b/src/widgets/widgets/qfocusframe.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -44,8 +44,6 @@
#include <QtWidgets/qwidget.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -76,6 +74,4 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QFOCUSFRAME_H
diff --git a/src/widgets/widgets/qfontcombobox.cpp b/src/widgets/widgets/qfontcombobox.cpp
index 1b9a08b0d2..5f929caf03 100644
--- a/src/widgets/widgets/qfontcombobox.cpp
+++ b/src/widgets/widgets/qfontcombobox.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -56,46 +56,33 @@ QT_BEGIN_NAMESPACE
static QFontDatabase::WritingSystem writingSystemForFont(const QFont &font, bool *hasLatin)
{
- *hasLatin = true;
-
QList<QFontDatabase::WritingSystem> writingSystems = QFontDatabase().writingSystems(font.family());
// qDebug() << font.family() << writingSystems;
// this just confuses the algorithm below. Vietnamese is Latin with lots of special chars
- writingSystems.removeAll(QFontDatabase::Vietnamese);
+ writingSystems.removeOne(QFontDatabase::Vietnamese);
+ *hasLatin = writingSystems.removeOne(QFontDatabase::Latin);
+
+ if (writingSystems.isEmpty())
+ return QFontDatabase::Any;
- QFontDatabase::WritingSystem system = QFontDatabase::Any;
+ QFontDatabase::WritingSystem system = writingSystems.last();
- if (!writingSystems.contains(QFontDatabase::Latin)) {
- *hasLatin = false;
+ if (!*hasLatin) {
// we need to show something
- if (writingSystems.count())
- system = writingSystems.last();
- } else {
- writingSystems.removeAll(QFontDatabase::Latin);
+ return system;
}
- if (writingSystems.isEmpty())
+ if (writingSystems.count() == 1 && system > QFontDatabase::Cyrillic)
return system;
- if (writingSystems.count() == 1 && writingSystems.at(0) > QFontDatabase::Cyrillic) {
- system = writingSystems.at(0);
+ if (writingSystems.count() <= 2 && system > QFontDatabase::Armenian && system < QFontDatabase::Vietnamese)
return system;
- }
- if (writingSystems.count() <= 2
- && writingSystems.last() > QFontDatabase::Armenian
- && writingSystems.last() < QFontDatabase::Vietnamese) {
- system = writingSystems.last();
+ if (writingSystems.count() <= 5 && system >= QFontDatabase::SimplifiedChinese && system <= QFontDatabase::Korean)
return system;
- }
- if (writingSystems.count() <= 5
- && writingSystems.last() >= QFontDatabase::SimplifiedChinese
- && writingSystems.last() <= QFontDatabase::Korean)
- system = writingSystems.last();
-
- return system;
+ return QFontDatabase::Any;
}
class QFontFamilyDelegate : public QAbstractItemDelegate
diff --git a/src/widgets/widgets/qfontcombobox.h b/src/widgets/widgets/qfontcombobox.h
index e5e1580cdb..66fc9b4581 100644
--- a/src/widgets/widgets/qfontcombobox.h
+++ b/src/widgets/widgets/qfontcombobox.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -47,8 +47,6 @@
#ifndef QT_NO_FONTCOMBOBOX
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -105,7 +103,5 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(QFontComboBox::FontFilters)
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QT_NO_FONTCOMBOBOX
#endif
diff --git a/src/widgets/widgets/qframe.cpp b/src/widgets/widgets/qframe.cpp
index 3dc30674e2..b7ef2ed3b1 100644
--- a/src/widgets/widgets/qframe.cpp
+++ b/src/widgets/widgets/qframe.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/widgets/qframe.h b/src/widgets/widgets/qframe.h
index 021d7f5ab0..f121c0d725 100644
--- a/src/widgets/widgets/qframe.h
+++ b/src/widgets/widgets/qframe.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -44,8 +44,6 @@
#include <QtWidgets/qwidget.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -125,6 +123,4 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QFRAME_H
diff --git a/src/widgets/widgets/qframe_p.h b/src/widgets/widgets/qframe_p.h
index faa170ae94..377f6f942e 100644
--- a/src/widgets/widgets/qframe_p.h
+++ b/src/widgets/widgets/qframe_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/widgets/qgroupbox.cpp b/src/widgets/widgets/qgroupbox.cpp
index 6c8da10b8e..d82f151165 100644
--- a/src/widgets/widgets/qgroupbox.cpp
+++ b/src/widgets/widgets/qgroupbox.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -121,7 +121,7 @@ void QGroupBox::initStyleOption(QStyleOptionGroupBox *option) const
option->state |= QStyle::State_Sunken;
}
- if (!option->palette.isBrushSet(isEnabled() ? QPalette::Active :
+ if (!option->palette.isBrushSet(isEnabled() ? QPalette::Active :
QPalette::Disabled, QPalette::WindowText))
option->textColor = QColor(style()->styleHint(QStyle::SH_GroupBox_TextLabelColor,
option, this));
@@ -229,7 +229,7 @@ void QGroupBoxPrivate::init()
overCheckBox = false;
pressedControl = QStyle::SC_None;
calculateFrame();
- q->setSizePolicy(QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred,
+ q->setSizePolicy(QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred,
QSizePolicy::GroupBox));
}
diff --git a/src/widgets/widgets/qgroupbox.h b/src/widgets/widgets/qgroupbox.h
index d462a574fd..6c18cf8c0f 100644
--- a/src/widgets/widgets/qgroupbox.h
+++ b/src/widgets/widgets/qgroupbox.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -44,8 +44,6 @@
#include <QtWidgets/qframe.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -97,7 +95,7 @@ protected:
void changeEvent(QEvent *event);
void mousePressEvent(QMouseEvent *event);
void mouseMoveEvent(QMouseEvent *event);
- void mouseReleaseEvent(QMouseEvent *event);
+ void mouseReleaseEvent(QMouseEvent *event);
void initStyleOption(QStyleOptionGroupBox *option) const;
@@ -111,6 +109,4 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QGROUPBOX_H
diff --git a/src/widgets/widgets/qlabel.cpp b/src/widgets/widgets/qlabel.cpp
index a9a9c0cea5..7f2a7684eb 100644
--- a/src/widgets/widgets/qlabel.cpp
+++ b/src/widgets/widgets/qlabel.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -1032,20 +1032,6 @@ void QLabel::paintEvent(QPaintEvent *)
d->ensureTextLayouted();
QAbstractTextDocumentLayout::PaintContext context;
- if (!isEnabled() && !d->control &&
- // We cannot support etched for rich text controls because custom
- // colors and links will override the light palette
- style->styleHint(QStyle::SH_EtchDisabledText, &opt, this)) {
- context.palette = opt.palette;
- context.palette.setColor(QPalette::Text, context.palette.light().color());
- painter.save();
- painter.translate(lr.x() + 1, lr.y() + 1);
- painter.setClipRect(lr.translated(-lr.x() - 1, -lr.y() - 1));
- QAbstractTextDocumentLayout *layout = d->control->document()->documentLayout();
- layout->draw(&painter, context);
- painter.restore();
- }
-
// Adjust the palette
context.palette = opt.palette;
diff --git a/src/widgets/widgets/qlabel.h b/src/widgets/widgets/qlabel.h
index 114d239918..8edb099560 100644
--- a/src/widgets/widgets/qlabel.h
+++ b/src/widgets/widgets/qlabel.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -44,8 +44,6 @@
#include <QtWidgets/qframe.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -164,6 +162,4 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QLABEL_H
diff --git a/src/widgets/widgets/qlabel_p.h b/src/widgets/widgets/qlabel_p.h
index 2a8958099b..a82ae0653b 100644
--- a/src/widgets/widgets/qlabel_p.h
+++ b/src/widgets/widgets/qlabel_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/widgets/qlcdnumber.cpp b/src/widgets/widgets/qlcdnumber.cpp
index 876acf4c0c..3ba9ad9ba3 100644
--- a/src/widgets/widgets/qlcdnumber.cpp
+++ b/src/widgets/widgets/qlcdnumber.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/widgets/qlcdnumber.h b/src/widgets/widgets/qlcdnumber.h
index 4495f40f7f..3dde1527f2 100644
--- a/src/widgets/widgets/qlcdnumber.h
+++ b/src/widgets/widgets/qlcdnumber.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -45,8 +45,6 @@
#include <QtWidgets/qframe.h>
#include <QtCore/qbitarray.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -122,6 +120,4 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QLCDNUMBER_H
diff --git a/src/widgets/widgets/qlineedit.cpp b/src/widgets/widgets/qlineedit.cpp
index 65969a7ebb..ea58ec1429 100644
--- a/src/widgets/widgets/qlineedit.cpp
+++ b/src/widgets/widgets/qlineedit.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -139,9 +139,9 @@ void QLineEdit::initStyleOption(QStyleOptionFrame *option) const
The length of the text can be constrained to maxLength(). The text
can be arbitrarily constrained using a validator() or an
- inputMask(), or both. When switching between a validator and an input mask
- on the same line edit, it is best to clear the validator or input mask to
- prevent undefined behavior.
+ inputMask(), or both. When switching between a validator and an input mask
+ on the same line edit, it is best to clear the validator or input mask to
+ prevent undefined behavior.
A related class is QTextEdit which allows multi-line, rich text
@@ -1758,7 +1758,7 @@ void QLineEdit::focusOutEvent(QFocusEvent *e)
QObject::disconnect(d->control->completer(), 0, this, 0);
}
#endif
- update();
+ QWidget::focusOutEvent(e);
}
/*!\reimp
@@ -1801,7 +1801,7 @@ void QLineEdit::paintEvent(QPaintEvent *)
int minRB = qMax(0, -fm.minRightBearing());
if (d->control->text().isEmpty()) {
- if (!hasFocus() && !d->placeholderText.isEmpty()) {
+ if (!d->placeholderText.isEmpty()) {
QColor col = pal.text().color();
col.setAlpha(128);
QPen oldpen = p.pen();
@@ -1810,7 +1810,6 @@ void QLineEdit::paintEvent(QPaintEvent *)
QString elidedText = fm.elidedText(d->placeholderText, Qt::ElideRight, lineRect.width());
p.drawText(lineRect, va, elidedText);
p.setPen(oldpen);
- return;
}
}
diff --git a/src/widgets/widgets/qlineedit.h b/src/widgets/widgets/qlineedit.h
index af50170d3d..e2b944314b 100644
--- a/src/widgets/widgets/qlineedit.h
+++ b/src/widgets/widgets/qlineedit.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -47,8 +47,6 @@
#include <QtCore/qstring.h>
#include <QtCore/qmargins.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -248,6 +246,4 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QLINEEDIT_H
diff --git a/src/widgets/widgets/qlineedit_p.cpp b/src/widgets/widgets/qlineedit_p.cpp
index 7f800d831f..1999216e65 100644
--- a/src/widgets/widgets/qlineedit_p.cpp
+++ b/src/widgets/widgets/qlineedit_p.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -180,7 +180,7 @@ void QLineEditPrivate::init(const QString& txt)
#endif
QObject::connect(control, SIGNAL(cursorPositionChanged(int,int)),
q, SLOT(updateMicroFocus()));
-
+
QObject::connect(control, SIGNAL(textChanged(QString)),
q, SLOT(updateMicroFocus()));
diff --git a/src/widgets/widgets/qlineedit_p.h b/src/widgets/widgets/qlineedit_p.h
index 8f1ca48865..4eb35b7dc6 100644
--- a/src/widgets/widgets/qlineedit_p.h
+++ b/src/widgets/widgets/qlineedit_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/widgets/qmaccocoaviewcontainer_mac.h b/src/widgets/widgets/qmaccocoaviewcontainer_mac.h
index 1bb631d296..b89b796819 100644
--- a/src/widgets/widgets/qmaccocoaviewcontainer_mac.h
+++ b/src/widgets/widgets/qmaccocoaviewcontainer_mac.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -44,8 +44,6 @@
#include <QtWidgets/QWidget>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -67,6 +65,4 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QCOCOAVIEWCONTAINER_H
diff --git a/src/widgets/widgets/qmaccocoaviewcontainer_mac.mm b/src/widgets/widgets/qmaccocoaviewcontainer_mac.mm
index 1eadb62d5c..2be11f34d5 100644
--- a/src/widgets/widgets/qmaccocoaviewcontainer_mac.mm
+++ b/src/widgets/widgets/qmaccocoaviewcontainer_mac.mm
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -112,7 +112,7 @@ QMacCocoaViewContainerPrivate::~QMacCocoaViewContainerPrivate()
/*!
\fn QMacCocoaViewContainer::QMacCocoaViewContainer(void *cocoaViewToWrap, QWidget *parent)
-
+
Create a new QMacCocoaViewContainer using the NSView pointer in \a
cocoaViewToWrap with parent, \a parent. QMacCocoaViewContainer will
retain \a cocoaViewToWrap.
diff --git a/src/widgets/widgets/qmacnativewidget_mac.h b/src/widgets/widgets/qmacnativewidget_mac.h
index 0a227f1756..796d7b38d4 100644
--- a/src/widgets/widgets/qmacnativewidget_mac.h
+++ b/src/widgets/widgets/qmacnativewidget_mac.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -44,8 +44,6 @@
#include <QtWidgets/QWidget>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -68,6 +66,4 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QMACNATIVEWIDGET_H
diff --git a/src/widgets/widgets/qmacnativewidget_mac.mm b/src/widgets/widgets/qmacnativewidget_mac.mm
index 240bd6d92e..50907b8dfc 100644
--- a/src/widgets/widgets/qmacnativewidget_mac.mm
+++ b/src/widgets/widgets/qmacnativewidget_mac.mm
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/widgets/qmainwindow.cpp b/src/widgets/widgets/qmainwindow.cpp
index 5bb331a99a..436fb65dd2 100644
--- a/src/widgets/widgets/qmainwindow.cpp
+++ b/src/widgets/widgets/qmainwindow.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/widgets/qmainwindow.h b/src/widgets/widgets/qmainwindow.h
index d00e75d7ae..d9edf711e0 100644
--- a/src/widgets/widgets/qmainwindow.h
+++ b/src/widgets/widgets/qmainwindow.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -45,8 +45,6 @@
#include <QtWidgets/qwidget.h>
#include <QtWidgets/qtabwidget.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -210,6 +208,4 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(QMainWindow::DockOptions)
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QDYNAMICMAINWINDOW_H
diff --git a/src/widgets/widgets/qmainwindowlayout.cpp b/src/widgets/widgets/qmainwindowlayout.cpp
index 17a3f06e79..cfeb0e2c67 100644
--- a/src/widgets/widgets/qmainwindowlayout.cpp
+++ b/src/widgets/widgets/qmainwindowlayout.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/widgets/qmainwindowlayout_mac.mm b/src/widgets/widgets/qmainwindowlayout_mac.mm
index 4fea391339..38605c2e09 100644
--- a/src/widgets/widgets/qmainwindowlayout_mac.mm
+++ b/src/widgets/widgets/qmainwindowlayout_mac.mm
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/widgets/qmainwindowlayout_p.h b/src/widgets/widgets/qmainwindowlayout_p.h
index 50fcf8a15f..f866a554dc 100644
--- a/src/widgets/widgets/qmainwindowlayout_p.h
+++ b/src/widgets/widgets/qmainwindowlayout_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/widgets/qmdiarea.cpp b/src/widgets/widgets/qmdiarea.cpp
index 5135cf6962..b2409e300c 100644
--- a/src/widgets/widgets/qmdiarea.cpp
+++ b/src/widgets/widgets/qmdiarea.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/widgets/qmdiarea.h b/src/widgets/widgets/qmdiarea.h
index 52278e35aa..87ecd432dc 100644
--- a/src/widgets/widgets/qmdiarea.h
+++ b/src/widgets/widgets/qmdiarea.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -45,8 +45,6 @@
#include <QtWidgets/qabstractscrollarea.h>
#include <QtWidgets/qtabwidget.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -172,7 +170,5 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(QMdiArea::AreaOptions)
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QT_NO_MDIAREA
#endif // QMDIAREA_H
diff --git a/src/widgets/widgets/qmdiarea_p.h b/src/widgets/widgets/qmdiarea_p.h
index 4c953b80ef..90db55438a 100644
--- a/src/widgets/widgets/qmdiarea_p.h
+++ b/src/widgets/widgets/qmdiarea_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/widgets/qmdisubwindow.cpp b/src/widgets/widgets/qmdisubwindow.cpp
index 01ee2528f3..4259f75097 100644
--- a/src/widgets/widgets/qmdisubwindow.cpp
+++ b/src/widgets/widgets/qmdisubwindow.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -183,14 +183,6 @@ static const QStyle::SubControl SubControls[] =
};
static const int NumSubControls = sizeof(SubControls) / sizeof(SubControls[0]);
-static const QStyle::StandardPixmap ButtonPixmaps[] =
-{
- QStyle::SP_TitleBarMinButton,
- QStyle::SP_TitleBarNormalButton,
- QStyle::SP_TitleBarCloseButton
-};
-static const int NumButtonPixmaps = sizeof(ButtonPixmaps) / sizeof(ButtonPixmaps[0]);
-
static const Qt::WindowFlags CustomizeWindowFlags =
Qt::FramelessWindowHint
| Qt::CustomizeWindowHint
diff --git a/src/widgets/widgets/qmdisubwindow.h b/src/widgets/widgets/qmdisubwindow.h
index 9dac7e1ee0..915fef758b 100644
--- a/src/widgets/widgets/qmdisubwindow.h
+++ b/src/widgets/widgets/qmdisubwindow.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -44,8 +44,6 @@
#include <QtWidgets/qwidget.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -151,8 +149,6 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(QMdiSubWindow::SubWindowOptions)
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QT_NO_MDIAREA
#endif // QMDISUBWINDOW_H
diff --git a/src/widgets/widgets/qmdisubwindow_p.h b/src/widgets/widgets/qmdisubwindow_p.h
index 810fd3d27d..90369ff526 100644
--- a/src/widgets/widgets/qmdisubwindow_p.h
+++ b/src/widgets/widgets/qmdisubwindow_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/widgets/qmenu.cpp b/src/widgets/widgets/qmenu.cpp
index 922a38b324..dfa906d2ea 100644
--- a/src/widgets/widgets/qmenu.cpp
+++ b/src/widgets/widgets/qmenu.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -67,6 +67,7 @@
#include "qwidgetaction.h"
#include "qtoolbutton.h"
#include "qpushbutton.h"
+#include "qtooltip.h"
#include <private/qpushbutton_p.h>
#include <private/qaction_p.h>
#include <private/qguiapplication_p.h>
@@ -259,12 +260,15 @@ void QMenuPrivate::updateActionRects(const QRect &screen) const
bool previousWasSeparator = true; // this is true to allow removing the leading separators
for(int i = 0; i <= lastVisibleAction; i++) {
QAction *action = actions.at(i);
+ const bool isSection = action->isSeparator() && (!action->text().isEmpty() || !action->icon().isNull());
+ const bool isPlainSeparator = (isSection && !q->style()->styleHint(QStyle::SH_Menu_SupportsSections))
+ || (action->isSeparator() && !isSection);
if (!action->isVisible() ||
- (collapsibleSeparators && previousWasSeparator && action->isSeparator()))
+ (collapsibleSeparators && previousWasSeparator && isPlainSeparator))
continue; // we continue, this action will get an empty QRect
- previousWasSeparator = action->isSeparator();
+ previousWasSeparator = isPlainSeparator;
//let the style modify the above size..
QStyleOptionMenuItem opt;
@@ -1510,6 +1514,54 @@ QAction *QMenu::addSeparator()
}
/*!
+ \since 5.1
+
+ This convenience function creates a new section action, i.e. an
+ action with QAction::isSeparator() returning true but also
+ having \a text hint, and adds the new action to this menu's list
+ of actions. It returns the newly created action.
+
+ The rendering of the hint is style and platform dependent. Widget
+ styles can use the text information in the rendering for sections,
+ or can choose to ignore it and render sections like simple separators.
+
+ QMenu takes ownership of the returned QAction.
+
+ \sa QWidget::addAction()
+*/
+QAction *QMenu::addSection(const QString &text)
+{
+ QAction *action = new QAction(text, this);
+ action->setSeparator(true);
+ addAction(action);
+ return action;
+}
+
+/*!
+ \since 5.1
+
+ This convenience function creates a new section action, i.e. an
+ action with QAction::isSeparator() returning true but also
+ having \a text and \a icon hints, and adds the new action to this menu's
+ list of actions. It returns the newly created action.
+
+ The rendering of the hints is style and platform dependent. Widget
+ styles can use the text and icon information in the rendering for sections,
+ or can choose to ignore them and render sections like simple separators.
+
+ QMenu takes ownership of the returned QAction.
+
+ \sa QWidget::addAction()
+*/
+QAction *QMenu::addSection(const QIcon &icon, const QString &text)
+{
+ QAction *action = new QAction(icon, text, this);
+ action->setSeparator(true);
+ addAction(action);
+ return action;
+}
+
+/*!
This convenience function inserts \a menu before action \a before
and returns the menus menuAction().
@@ -1541,6 +1593,55 @@ QAction *QMenu::insertSeparator(QAction *before)
}
/*!
+ \since 5.1
+
+ This convenience function creates a new title action, i.e. an
+ action with QAction::isSeparator() returning true but also having
+ \a text hint. The function inserts the newly created action
+ into this menu's list of actions before action \a before and
+ returns it.
+
+ The rendering of the hint is style and platform dependent. Widget
+ styles can use the text information in the rendering for sections,
+ or can choose to ignore it and render sections like simple separators.
+
+ QMenu takes ownership of the returned QAction.
+
+ \sa QWidget::insertAction(), addSection()
+*/
+QAction *QMenu::insertSection(QAction *before, const QString &text)
+{
+ QAction *action = new QAction(text, this);
+ action->setSeparator(true);
+ insertAction(before, action);
+ return action;
+}
+
+/*!
+ \since 5.1
+
+ This convenience function creates a new title action, i.e. an
+ action with QAction::isSeparator() returning true but also having
+ \a text and \a icon hints. The function inserts the newly created action
+ into this menu's list of actions before action \a before and returns it.
+
+ The rendering of the hints is style and platform dependent. Widget
+ styles can use the text and icon information in the rendering for sections,
+ or can choose to ignore them and render sections like simple separators.
+
+ QMenu takes ownership of the returned QAction.
+
+ \sa QWidget::insertAction(), addSection()
+*/
+QAction *QMenu::insertSection(QAction *before, const QIcon &icon, const QString &text)
+{
+ QAction *action = new QAction(icon, text, this);
+ action->setSeparator(true);
+ insertAction(before, action);
+ return action;
+}
+
+/*!
This sets the default action to \a act. The default action may have
a visual cue, depending on the current QStyle. A default action
usually indicates what will happen by default when a drop occurs.
@@ -2368,6 +2469,19 @@ QMenu::event(QEvent *e)
if (d->currentAction)
d->popupAction(d->currentAction, 0, false);
break;
+#ifndef QT_NO_TOOLTIP
+ case QEvent::ToolTip:
+ if (d->toolTipsVisible) {
+ const QHelpEvent *ev = static_cast<const QHelpEvent*>(e);
+ if (const QAction *action = actionAt(ev->pos())) {
+ const QString toolTip = action->d_func()->tooltip;
+ if (!toolTip.isEmpty())
+ QToolTip::showText(ev->globalPos(), toolTip, this);
+ return true;
+ }
+ }
+ break;
+#endif // QT_NO_TOOLTIP
#ifndef QT_NO_WHATSTHIS
case QEvent::QueryWhatsThis:
e->setAccepted(d->whatsThis.size());
@@ -2826,7 +2940,7 @@ QMenu::timerEvent(QTimerEvent *e)
}
}
-void copyActionToPlatformItem(const QAction *action, QPlatformMenuItem* item)
+static void copyActionToPlatformItem(const QAction *action, QPlatformMenuItem* item)
{
item->setText(action->text());
item->setIsSeparator(action->isSeparator());
@@ -2834,6 +2948,7 @@ void copyActionToPlatformItem(const QAction *action, QPlatformMenuItem* item)
item->setIcon(action->icon());
item->setVisible(action->isVisible());
item->setShortcut(action->shortcut());
+ item->setCheckable(action->isCheckable());
item->setChecked(action->isChecked());
item->setFont(action->font());
item->setRole((QPlatformMenuItem::MenuRole) action->menuRole());
@@ -3089,6 +3204,32 @@ void QMenu::setSeparatorsCollapsible(bool collapse)
d->platformMenu->syncSeparatorsCollapsible(collapse);
}
+/*!
+ \property QMenu::toolTipsVisible
+ \since 5.1
+
+ \brief whether tooltips of menu actions should be visible
+
+ This property specifies whether action menu entries show
+ their tooltip.
+
+ By default, this property is false.
+*/
+bool QMenu::toolTipsVisible() const
+{
+ Q_D(const QMenu);
+ return d->toolTipsVisible;
+}
+
+void QMenu::setToolTipsVisible(bool visible)
+{
+ Q_D(QMenu);
+ if (d->toolTipsVisible == visible)
+ return;
+
+ d->toolTipsVisible = visible;
+}
+
QT_END_NAMESPACE
// for private slots
diff --git a/src/widgets/widgets/qmenu.h b/src/widgets/widgets/qmenu.h
index e58e7a231f..518771d846 100644
--- a/src/widgets/widgets/qmenu.h
+++ b/src/widgets/widgets/qmenu.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -51,8 +51,6 @@
#include <windef.h> // for HMENU
#endif
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -72,6 +70,7 @@ private:
Q_PROPERTY(QString title READ title WRITE setTitle)
Q_PROPERTY(QIcon icon READ icon WRITE setIcon)
Q_PROPERTY(bool separatorsCollapsible READ separatorsCollapsible WRITE setSeparatorsCollapsible)
+ Q_PROPERTY(bool toolTipsVisible READ toolTipsVisible WRITE setToolTipsVisible)
public:
explicit QMenu(QWidget *parent = 0);
@@ -94,8 +93,13 @@ public:
QAction *addSeparator();
+ QAction *addSection(const QString &text);
+ QAction *addSection(const QIcon &icon, const QString &text);
+
QAction *insertMenu(QAction *before, QMenu *menu);
QAction *insertSeparator(QAction *before);
+ QAction *insertSection(QAction *before, const QString &text);
+ QAction *insertSection(QAction *before, const QIcon &icon, const QString &text);
bool isEmpty() const;
void clear();
@@ -141,6 +145,9 @@ public:
bool separatorsCollapsible() const;
void setSeparatorsCollapsible(bool collapse);
+ bool toolTipsVisible() const;
+ void setToolTipsVisible(bool visible);
+
Q_SIGNALS:
void aboutToShow();
void aboutToHide();
@@ -201,6 +208,4 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QMENU_H
diff --git a/src/widgets/widgets/qmenu_p.h b/src/widgets/widgets/qmenu_p.h
index 0b8137cff3..6cc88c56e2 100644
--- a/src/widgets/widgets/qmenu_p.h
+++ b/src/widgets/widgets/qmenu_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -84,7 +84,8 @@ class QMenuPrivate : public QWidgetPrivate
Q_DECLARE_PUBLIC(QMenu)
public:
QMenuPrivate() : itemsDirty(0), maxIconWidth(0), tabWidth(0), ncols(0),
- collapsibleSeparators(true), activationRecursionGuard(false), hasHadMouse(0), aboutToHide(0), motions(0),
+ collapsibleSeparators(true), toolTipsVisible(false),
+ activationRecursionGuard(false), hasHadMouse(0), aboutToHide(0), motions(0),
currentAction(0),
#ifdef QT_KEYPAD_NAVIGATION
selectAction(0),
@@ -123,6 +124,7 @@ public:
QRect popupGeometry(int screen = -1) const;
mutable uint ncols : 4; //4 bits is probably plenty
uint collapsibleSeparators : 1;
+ uint toolTipsVisible : 1;
QSize adjustMenuSizeForScreen(const QRect & screen);
int getLastVisibleAction() const;
diff --git a/src/widgets/widgets/qmenu_wince.cpp b/src/widgets/widgets/qmenu_wince.cpp
index 68a2022e97..a82cc4abb9 100644
--- a/src/widgets/widgets/qmenu_wince.cpp
+++ b/src/widgets/widgets/qmenu_wince.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -116,14 +116,14 @@ static void resolveAygLibs()
}
}
-static void qt_wce_enable_soft_key(HWND handle, uint command)
+static void qt_wce_enable_soft_key(HWND handle, uint command)
{
resolveAygLibs();
if (ptrEnableSoftKey)
ptrEnableSoftKey(handle, command, false, true);
}
-static void qt_wce_disable_soft_key(HWND handle, uint command)
+static void qt_wce_disable_soft_key(HWND handle, uint command)
{
resolveAygLibs();
if (ptrEnableSoftKey)
@@ -148,7 +148,7 @@ static QAction* qt_wce_get_quit_action(QList<QAction *> actionItems)
QAction *action = actionItems.at(i);
if (action->menuRole() == QAction::QuitRole)
returnAction = action;
- else
+ else
if (action->menu())
returnAction = qt_wce_get_quit_action(action->menu()->actions());
if (returnAction)
@@ -252,7 +252,7 @@ static void qt_wce_insert_action(HMENU menu, QWceMenuAction *action)
if (action->action->isCheckable())
if (action->action->isChecked())
CheckMenuItem(menu, action->command, MF_BYCOMMAND | MF_CHECKED);
- else
+ else
CheckMenuItem(menu, action->command, MF_BYCOMMAND | MF_UNCHECKED);
}
}
@@ -264,8 +264,8 @@ static void qt_wce_clear_menu(HMENU hMenu)
}
/*!
- \internal
-
+ \internal
+
This function refreshes the native Windows CE menu.
*/
@@ -281,8 +281,8 @@ void QMenuBarPrivate::wceRefresh()
}
/*!
- \internal
-
+ \internal
+
This function sends native Windows CE commands to Qt menus.
*/
@@ -293,8 +293,8 @@ QAction* QMenu::wceCommands(uint command)
}
/*!
- \internal
-
+ \internal
+
This function sends native Windows CE commands to Qt menu bars
and all their child menus.
*/
@@ -457,7 +457,7 @@ void QMenuPrivate::QWceMenuPrivate::addAction(QWceMenuAction *action, QWceMenuAc
/*!
\internal
-
+
This function will return the HMENU used to create the native
Windows CE menu bar bindings.
*/
@@ -642,7 +642,7 @@ void QMenuBarPrivate::QWceMenuBarPrivate::rebuild()
qt_wce_rename_menu_item(menubarHandle, leftButtonCommand, leftButtonAction->text());
qt_wce_enable_soft_key(menubarHandle, leftButtonCommand);
} else {
- qt_wce_rename_menu_item(menubarHandle, leftButtonCommand, QLatin1String(""));
+ qt_wce_rename_menu_item(menubarHandle, leftButtonCommand, QLatin1String(""));
qt_wce_disable_soft_key(menubarHandle, leftButtonCommand);
}
} else {
diff --git a/src/widgets/widgets/qmenu_wince.rc b/src/widgets/widgets/qmenu_wince.rc
index 631cd9d47a..0bcd32c7e5 100644
--- a/src/widgets/widgets/qmenu_wince.rc
+++ b/src/widgets/widgets/qmenu_wince.rc
@@ -14,19 +14,19 @@
#define I_IMAGENONE (-2)
#define NOMENU 0xFFFF
-IDR_MAIN_MENU MENU DISCARDABLE
+IDR_MAIN_MENU MENU DISCARDABLE
BEGIN
POPUP "Menu"
BEGIN
- MENUITEM "About", IDM_ABOUT
+ MENUITEM "About", IDM_ABOUT
END
END
-IDR_MAIN_MENU2 MENU DISCARDABLE
+IDR_MAIN_MENU2 MENU DISCARDABLE
BEGIN
POPUP "Menu"
BEGIN
- MENUITEM "About", IDM_ABOUT
+ MENUITEM "About", IDM_ABOUT
END
POPUP "Display"
BEGIN
@@ -35,7 +35,7 @@ BEGIN
END
-IDR_MAIN_MENU3 MENU DISCARDABLE
+IDR_MAIN_MENU3 MENU DISCARDABLE
BEGIN
POPUP "Menu1"
BEGIN
@@ -55,7 +55,7 @@ BEGIN
END
END
-IDR_MAIN_MENU4 MENU DISCARDABLE
+IDR_MAIN_MENU4 MENU DISCARDABLE
BEGIN
POPUP "Menu1"
BEGIN
@@ -83,7 +83,7 @@ BEGIN
END
END
-IDR_MAIN_MENU5 MENU DISCARDABLE
+IDR_MAIN_MENU5 MENU DISCARDABLE
BEGIN
POPUP "Menu1"
BEGIN
@@ -119,8 +119,8 @@ BEGIN
END
END
-STRINGTABLE
-BEGIN
+STRINGTABLE
+BEGIN
IDS_EXIT "Exit"
IDS_MENU "Menu"
IDS_LEFTMENU "Display"
@@ -136,31 +136,31 @@ END
IDR_MAIN_MENU SHMENUBAR DISCARDABLE
BEGIN
- IDR_MAIN_MENU,
+ IDR_MAIN_MENU,
2,
I_IMAGENONE, IDM_EXIT, TBSTATE_ENABLED, TBSTYLE_BUTTON | TBSTYLE_AUTOSIZE,
IDS_EXIT, 0, NOMENU,
-
+
I_IMAGENONE, IDM_MENU, TBSTATE_ENABLED, TBSTYLE_DROPDOWN | TBSTYLE_AUTOSIZE,
IDS_MENU, 0, 0,
END
IDR_MAIN_MENU2 SHMENUBAR DISCARDABLE
BEGIN
- IDR_MAIN_MENU2,
+ IDR_MAIN_MENU2,
2,
I_IMAGENONE, IDM_LEFTMENU, TBSTATE_ENABLED, TBSTYLE_DROPDOWN | TBSTYLE_AUTOSIZE,
IDS_LEFTMENU, 0, 1,
-
+
I_IMAGENONE, IDM_MENU, TBSTATE_ENABLED, TBSTYLE_DROPDOWN | TBSTYLE_AUTOSIZE,
IDS_MENU, 0, 0,
END
IDR_MAIN_MENU3 SHMENUBAR DISCARDABLE
BEGIN
- IDR_MAIN_MENU3,
+ IDR_MAIN_MENU3,
4,
I_IMAGENONE, IDM_MENU1, TBSTATE_ENABLED, TBSTYLE_DROPDOWN | TBSTYLE_AUTOSIZE,
@@ -178,7 +178,7 @@ END
IDR_MAIN_MENU4 SHMENUBAR DISCARDABLE
BEGIN
- IDR_MAIN_MENU4,
+ IDR_MAIN_MENU4,
6,
I_IMAGENONE, IDM_MENU1, TBSTATE_ENABLED, TBSTYLE_DROPDOWN | TBSTYLE_AUTOSIZE,
@@ -202,7 +202,7 @@ END
IDR_MAIN_MENU5 SHMENUBAR DISCARDABLE
BEGIN
- IDR_MAIN_MENU5,
+ IDR_MAIN_MENU5,
8,
I_IMAGENONE, IDM_MENU1, TBSTATE_ENABLED, TBSTYLE_DROPDOWN | TBSTYLE_AUTOSIZE,
diff --git a/src/widgets/widgets/qmenu_wince_resource_p.h b/src/widgets/widgets/qmenu_wince_resource_p.h
index c3ec386780..3ecf05a02a 100644
--- a/src/widgets/widgets/qmenu_wince_resource_p.h
+++ b/src/widgets/widgets/qmenu_wince_resource_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -50,7 +50,6 @@
// We mean it.
//
-QT_BEGIN_HEADER
#define IDR_MAIN_MENU 102
#define IDR_MAIN_MENU2 103
@@ -90,5 +89,3 @@ QT_BEGIN_HEADER
#define IDM_MENU7 40009
#define IDM_MENU8 40010
-QT_END_HEADER
-
diff --git a/src/widgets/widgets/qmenubar.cpp b/src/widgets/widgets/qmenubar.cpp
index 5fdd505f16..f22c48b26f 100644
--- a/src/widgets/widgets/qmenubar.cpp
+++ b/src/widgets/widgets/qmenubar.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/widgets/qmenubar.h b/src/widgets/widgets/qmenubar.h
index 4b850ca3fe..e88a0c07c0 100644
--- a/src/widgets/widgets/qmenubar.h
+++ b/src/widgets/widgets/qmenubar.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -44,8 +44,6 @@
#include <QtWidgets/qmenu.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -159,6 +157,4 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QMENUBAR_H
diff --git a/src/widgets/widgets/qmenubar_p.h b/src/widgets/widgets/qmenubar_p.h
index b39d370c76..817df945c5 100644
--- a/src/widgets/widgets/qmenubar_p.h
+++ b/src/widgets/widgets/qmenubar_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/widgets/qplaintextedit.cpp b/src/widgets/widgets/qplaintextedit.cpp
index 8f00201e70..95271adeb0 100644
--- a/src/widgets/widgets/qplaintextedit.cpp
+++ b/src/widgets/widgets/qplaintextedit.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/widgets/qplaintextedit.h b/src/widgets/widgets/qplaintextedit.h
index 1e9fc373bb..42e8288cf3 100644
--- a/src/widgets/widgets/qplaintextedit.h
+++ b/src/widgets/widgets/qplaintextedit.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -53,8 +53,6 @@
#ifndef QT_NO_TEXTEDIT
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -319,8 +317,6 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QT_NO_TEXTEDIT
diff --git a/src/widgets/widgets/qplaintextedit_p.h b/src/widgets/widgets/qplaintextedit_p.h
index 6173234f5a..ab464676e5 100644
--- a/src/widgets/widgets/qplaintextedit_p.h
+++ b/src/widgets/widgets/qplaintextedit_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/widgets/qprogressbar.cpp b/src/widgets/widgets/qprogressbar.cpp
index 72e937b604..e317933e4d 100644
--- a/src/widgets/widgets/qprogressbar.cpp
+++ b/src/widgets/widgets/qprogressbar.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -41,6 +41,7 @@
#include "qprogressbar.h"
#ifndef QT_NO_PROGRESSBAR
+#include <qlocale.h>
#include <qevent.h>
#include <qpainter.h>
#include <qstylepainter.h>
@@ -61,6 +62,7 @@ public:
QProgressBarPrivate();
void init();
+ void initDefaultFormat();
inline void resetLayoutItemMargins();
int minimum;
@@ -68,6 +70,7 @@ public:
int value;
Qt::Alignment alignment;
uint textVisible : 1;
+ uint defaultFormat: 1;
int lastPaintedValue;
Qt::Orientation orientation;
bool invertedAppearance;
@@ -79,9 +82,16 @@ public:
QProgressBarPrivate::QProgressBarPrivate()
: minimum(0), maximum(100), value(-1), alignment(Qt::AlignLeft), textVisible(true),
- lastPaintedValue(-1), orientation(Qt::Horizontal), invertedAppearance(false),
- textDirection(QProgressBar::TopToBottom), format(QLatin1String("%p%"))
+ defaultFormat(true), lastPaintedValue(-1), orientation(Qt::Horizontal), invertedAppearance(false),
+ textDirection(QProgressBar::TopToBottom)
{
+ initDefaultFormat();
+}
+
+void QProgressBarPrivate::initDefaultFormat()
+{
+ if (defaultFormat)
+ format = QLatin1String("%p") + locale.percent();
}
void QProgressBarPrivate::init()
@@ -466,19 +476,21 @@ QString QProgressBar::text() const
qint64 totalSteps = qint64(d->maximum) - d->minimum;
QString result = d->format;
- result.replace(QLatin1String("%m"), QString::number(totalSteps));
- result.replace(QLatin1String("%v"), QString::number(d->value));
+ QLocale locale = d->locale; // Omit group separators for compatibility with previous versions that were non-localized.
+ locale.setNumberOptions(locale.numberOptions() | QLocale::OmitGroupSeparator);
+ result.replace(QLatin1String("%m"), locale.toString(totalSteps));
+ result.replace(QLatin1String("%v"), locale.toString(d->value));
// If max and min are equal and we get this far, it means that the
// progress bar has one step and that we are on that step. Return
// 100% here in order to avoid division by zero further down.
if (totalSteps == 0) {
- result.replace(QLatin1String("%p"), QString::number(100));
+ result.replace(QLatin1String("%p"), locale.toString(int(100)));
return result;
}
int progress = (qreal(d->value) - d->minimum) * 100.0 / totalSteps;
- result.replace(QLatin1String("%p"), QString::number(progress));
+ result.replace(QLatin1String("%p"), locale.toString(progress));
return result;
}
@@ -568,12 +580,19 @@ QProgressBar::Direction QProgressBar::textDirection() const
bool QProgressBar::event(QEvent *e)
{
Q_D(QProgressBar);
- if (e->type() == QEvent::StyleChange
+ switch (e->type()) {
+ case QEvent::StyleChange:
#ifdef Q_OS_MAC
- || e->type() == QEvent::MacSizeChange
+ case QEvent::MacSizeChange:
#endif
- )
d->resetLayoutItemMargins();
+ break;
+ case QEvent::LocaleChange:
+ d->initDefaultFormat();
+ break;
+ default:
+ break;
+ }
return QWidget::event(e);
}
@@ -596,6 +615,15 @@ void QProgressBar::setFormat(const QString &format)
if (d->format == format)
return;
d->format = format;
+ d->defaultFormat = false;
+ update();
+}
+
+void QProgressBar::resetFormat()
+{
+ Q_D(QProgressBar);
+ d->defaultFormat = true;
+ d->initDefaultFormat();
update();
}
diff --git a/src/widgets/widgets/qprogressbar.h b/src/widgets/widgets/qprogressbar.h
index a1b0fcee1d..2f66aaad9e 100644
--- a/src/widgets/widgets/qprogressbar.h
+++ b/src/widgets/widgets/qprogressbar.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -44,8 +44,6 @@
#include <QtWidgets/qframe.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -67,7 +65,7 @@ class Q_WIDGETS_EXPORT QProgressBar : public QWidget
Q_PROPERTY(Qt::Orientation orientation READ orientation WRITE setOrientation)
Q_PROPERTY(bool invertedAppearance READ invertedAppearance WRITE setInvertedAppearance)
Q_PROPERTY(Direction textDirection READ textDirection WRITE setTextDirection)
- Q_PROPERTY(QString format READ format WRITE setFormat)
+ Q_PROPERTY(QString format READ format WRITE setFormat RESET resetFormat)
public:
enum Direction { TopToBottom, BottomToTop };
@@ -98,6 +96,7 @@ public:
QProgressBar::Direction textDirection() const;
void setFormat(const QString &format);
+ void resetFormat();
QString format() const;
public Q_SLOTS:
@@ -125,6 +124,4 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QPROGRESSBAR_H
diff --git a/src/widgets/widgets/qpushbutton.cpp b/src/widgets/widgets/qpushbutton.cpp
index 139e3949d1..a10d726e36 100644
--- a/src/widgets/widgets/qpushbutton.cpp
+++ b/src/widgets/widgets/qpushbutton.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/widgets/qpushbutton.h b/src/widgets/widgets/qpushbutton.h
index 3aa3673478..7806e96763 100644
--- a/src/widgets/widgets/qpushbutton.h
+++ b/src/widgets/widgets/qpushbutton.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -44,8 +44,6 @@
#include <QtWidgets/qabstractbutton.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -105,13 +103,11 @@ public:
private:
Q_DISABLE_COPY(QPushButton)
Q_DECLARE_PRIVATE(QPushButton)
-#ifndef QT_NO_MENU
+#ifndef QT_NO_MENU
Q_PRIVATE_SLOT(d_func(), void _q_popupPressed())
#endif
};
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QPUSHBUTTON_H
diff --git a/src/widgets/widgets/qpushbutton_p.h b/src/widgets/widgets/qpushbutton_p.h
index 803bb0c4ac..93069d295f 100644
--- a/src/widgets/widgets/qpushbutton_p.h
+++ b/src/widgets/widgets/qpushbutton_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/widgets/qradiobutton.cpp b/src/widgets/widgets/qradiobutton.cpp
index 1195b5fad4..7bc57df12b 100644
--- a/src/widgets/widgets/qradiobutton.cpp
+++ b/src/widgets/widgets/qradiobutton.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/widgets/qradiobutton.h b/src/widgets/widgets/qradiobutton.h
index 13a73ba3c9..104d4a12e0 100644
--- a/src/widgets/widgets/qradiobutton.h
+++ b/src/widgets/widgets/qradiobutton.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -44,8 +44,6 @@
#include <QtWidgets/qabstractbutton.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -79,6 +77,4 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QRADIOBUTTON_H
diff --git a/src/widgets/widgets/qrubberband.cpp b/src/widgets/widgets/qrubberband.cpp
index 2adc81fd3e..112a9b66cd 100644
--- a/src/widgets/widgets/qrubberband.cpp
+++ b/src/widgets/widgets/qrubberband.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/widgets/qrubberband.h b/src/widgets/widgets/qrubberband.h
index 34962e52cc..b603415d1a 100644
--- a/src/widgets/widgets/qrubberband.h
+++ b/src/widgets/widgets/qrubberband.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -44,8 +44,6 @@
#include <QtWidgets/qwidget.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -98,6 +96,4 @@ inline void QRubberBand::move(int ax, int ay)
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QRUBBERBAND_H
diff --git a/src/widgets/widgets/qscrollarea.cpp b/src/widgets/widgets/qscrollarea.cpp
index 590225e850..93c335c56b 100644
--- a/src/widgets/widgets/qscrollarea.cpp
+++ b/src/widgets/widgets/qscrollarea.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -240,7 +240,7 @@ QWidget *QScrollArea::widget() const
The \a widget becomes a child of the scroll area, and will be
destroyed when the scroll area is deleted or when a new widget is
set.
-
+
The widget's \l{QWidget::setAutoFillBackground()}{autoFillBackground}
property will be set to \c{true}.
diff --git a/src/widgets/widgets/qscrollarea.h b/src/widgets/widgets/qscrollarea.h
index 18a9fac598..576c9bc9e0 100644
--- a/src/widgets/widgets/qscrollarea.h
+++ b/src/widgets/widgets/qscrollarea.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -44,8 +44,6 @@
#include <QtWidgets/qabstractscrollarea.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -95,6 +93,4 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QSCROLLAREA_H
diff --git a/src/widgets/widgets/qscrollarea_p.h b/src/widgets/widgets/qscrollarea_p.h
index ee38221877..919d1c8df2 100644
--- a/src/widgets/widgets/qscrollarea_p.h
+++ b/src/widgets/widgets/qscrollarea_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -53,6 +53,8 @@
// We mean it.
//
+#include <QtCore/qglobal.h>
+
#ifndef QT_NO_SCROLLAREA
#include "private/qabstractscrollarea_p.h"
diff --git a/src/widgets/widgets/qscrollbar.cpp b/src/widgets/widgets/qscrollbar.cpp
index bddef57f5d..e1e2723a2d 100644
--- a/src/widgets/widgets/qscrollbar.cpp
+++ b/src/widgets/widgets/qscrollbar.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/widgets/qscrollbar.h b/src/widgets/widgets/qscrollbar.h
index e9514c59a9..27d0169b40 100644
--- a/src/widgets/widgets/qscrollbar.h
+++ b/src/widgets/widgets/qscrollbar.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -45,8 +45,6 @@
#include <QtWidgets/qwidget.h>
#include <QtWidgets/qabstractslider.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -94,6 +92,4 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QSCROLLBAR_H
diff --git a/src/widgets/widgets/qscrollbar_p.h b/src/widgets/widgets/qscrollbar_p.h
index 75fea46e04..c62c337a40 100644
--- a/src/widgets/widgets/qscrollbar_p.h
+++ b/src/widgets/widgets/qscrollbar_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/widgets/qsizegrip.cpp b/src/widgets/widgets/qsizegrip.cpp
index 0b9341de58..106a8d770a 100644
--- a/src/widgets/widgets/qsizegrip.cpp
+++ b/src/widgets/widgets/qsizegrip.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/widgets/qsizegrip.h b/src/widgets/widgets/qsizegrip.h
index c79e4716da..11dadfa306 100644
--- a/src/widgets/widgets/qsizegrip.h
+++ b/src/widgets/widgets/qsizegrip.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -44,8 +44,6 @@
#include <QtWidgets/qwidget.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -83,6 +81,4 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QSIZEGRIP_H
diff --git a/src/widgets/widgets/qslider.cpp b/src/widgets/widgets/qslider.cpp
index f10a693117..2d91cd07e6 100644
--- a/src/widgets/widgets/qslider.cpp
+++ b/src/widgets/widgets/qslider.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/widgets/qslider.h b/src/widgets/widgets/qslider.h
index 460d52e57c..a8d7019c1f 100644
--- a/src/widgets/widgets/qslider.h
+++ b/src/widgets/widgets/qslider.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -44,8 +44,6 @@
#include <QtWidgets/qabstractslider.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -106,6 +104,4 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QSLIDER_H
diff --git a/src/widgets/widgets/qspinbox.cpp b/src/widgets/widgets/qspinbox.cpp
index e61c1c877a..0ce5473ad8 100644
--- a/src/widgets/widgets/qspinbox.cpp
+++ b/src/widgets/widgets/qspinbox.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -268,6 +268,7 @@ void QSpinBox::setPrefix(const QString &prefix)
d->updateEdit();
d->cachedSizeHint = QSize();
+ d->cachedMinimumSizeHint = QSize(); // minimumSizeHint cares about the prefix
updateGeometry();
}
diff --git a/src/widgets/widgets/qspinbox.h b/src/widgets/widgets/qspinbox.h
index 7be16f460b..4963f87a1a 100644
--- a/src/widgets/widgets/qspinbox.h
+++ b/src/widgets/widgets/qspinbox.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -44,8 +44,6 @@
#include <QtWidgets/qabstractspinbox.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -172,6 +170,4 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QSPINBOX_H
diff --git a/src/widgets/widgets/qsplashscreen.cpp b/src/widgets/widgets/qsplashscreen.cpp
index 3711b2f43e..746c02e4e2 100644
--- a/src/widgets/widgets/qsplashscreen.cpp
+++ b/src/widgets/widgets/qsplashscreen.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -80,7 +80,7 @@ public:
be shown during application startup.
\inmodule QtWidgets
-
+
A splash screen is a widget that is usually displayed when an
application is being started. Splash screens are often used for
applications that have long start up times (e.g. database or
diff --git a/src/widgets/widgets/qsplashscreen.h b/src/widgets/widgets/qsplashscreen.h
index af97a38cf8..a1af8e45ef 100644
--- a/src/widgets/widgets/qsplashscreen.h
+++ b/src/widgets/widgets/qsplashscreen.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -45,8 +45,6 @@
#include <QtGui/qpixmap.h>
#include <QtWidgets/qwidget.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -88,6 +86,4 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QSPLASHSCREEN_H
diff --git a/src/widgets/widgets/qsplitter.cpp b/src/widgets/widgets/qsplitter.cpp
index a8399ed8d5..031763b80c 100644
--- a/src/widgets/widgets/qsplitter.cpp
+++ b/src/widgets/widgets/qsplitter.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -1665,7 +1665,7 @@ bool QSplitter::restoreState(const QByteArray &state)
have a stretch factor of \a stretch.
\a stretch is not the effective stretch factor; the effective
- stretch factor is calculated by taking the initial size of the
+ stretch factor is calculated by taking the initial size of the
widget and multiplying it with \a stretch.
This function is provided for convenience. It is equivalent to
diff --git a/src/widgets/widgets/qsplitter.h b/src/widgets/widgets/qsplitter.h
index 79785b257e..ed4102d31e 100644
--- a/src/widgets/widgets/qsplitter.h
+++ b/src/widgets/widgets/qsplitter.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -45,8 +45,6 @@
#include <QtWidgets/qframe.h>
#include <QtWidgets/qsizepolicy.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -170,6 +168,4 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QSPLITTER_H
diff --git a/src/widgets/widgets/qsplitter_p.h b/src/widgets/widgets/qsplitter_p.h
index e829fd2f69..f1e050b8f6 100644
--- a/src/widgets/widgets/qsplitter_p.h
+++ b/src/widgets/widgets/qsplitter_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/widgets/qstackedwidget.cpp b/src/widgets/widgets/qstackedwidget.cpp
index 4dd11a00b8..4b7170a596 100644
--- a/src/widgets/widgets/qstackedwidget.cpp
+++ b/src/widgets/widgets/qstackedwidget.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/widgets/qstackedwidget.h b/src/widgets/widgets/qstackedwidget.h
index 451de7fe40..a147577ba6 100644
--- a/src/widgets/widgets/qstackedwidget.h
+++ b/src/widgets/widgets/qstackedwidget.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -44,8 +44,6 @@
#include <QtWidgets/qframe.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -94,6 +92,4 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QSTACKEDWIDGET_H
diff --git a/src/widgets/widgets/qstatusbar.cpp b/src/widgets/widgets/qstatusbar.cpp
index 880ddfaf35..86fd10699c 100644
--- a/src/widgets/widgets/qstatusbar.cpp
+++ b/src/widgets/widgets/qstatusbar.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -534,7 +534,7 @@ void QStatusBar::reformat()
}
/*!
-
+
Hides the normal status indications and displays the given \a
message for the specified number of milli-seconds (\a{timeout}). If
\a{timeout} is 0 (default), the \a {message} remains displayed until
@@ -744,7 +744,7 @@ bool QStatusBar::event(QEvent *e)
}
}
}
-
+
// On Mac OS X Leopard it is possible to drag the window by clicking
// on the tool bar on most applications.
#ifndef Q_WS_MAC
@@ -755,7 +755,7 @@ bool QStatusBar::event(QEvent *e)
// Enable drag-click only if the status bar is the status bar for a
// QMainWindow with a unifed toolbar.
- if (parent() == 0 || qobject_cast<QMainWindow *>(parent()) == 0 ||
+ if (parent() == 0 || qobject_cast<QMainWindow *>(parent()) == 0 ||
qobject_cast<QMainWindow *>(parent())->unifiedTitleAndToolBarOnMac() == false )
return QWidget::event(e);
diff --git a/src/widgets/widgets/qstatusbar.h b/src/widgets/widgets/qstatusbar.h
index de3982cffd..4a5b1ee494 100644
--- a/src/widgets/widgets/qstatusbar.h
+++ b/src/widgets/widgets/qstatusbar.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -44,8 +44,6 @@
#include <QtWidgets/qwidget.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -101,6 +99,4 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QSTATUSBAR_H
diff --git a/src/widgets/widgets/qtabbar.cpp b/src/widgets/widgets/qtabbar.cpp
index e0ea3e798d..b975035dcf 100644
--- a/src/widgets/widgets/qtabbar.cpp
+++ b/src/widgets/widgets/qtabbar.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -80,7 +80,7 @@ inline static bool verticalTabs(QTabBar::Shape shape)
void QTabBarPrivate::updateMacBorderMetrics()
{
-#if (defined Q_WS_MAC) && (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5)
+#if defined(Q_WS_MAC)
if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_5) {
Q_Q(QTabBar);
::HIContentBorderMetrics metrics;
diff --git a/src/widgets/widgets/qtabbar.h b/src/widgets/widgets/qtabbar.h
index 0bb10c2aa9..72c19ab520 100644
--- a/src/widgets/widgets/qtabbar.h
+++ b/src/widgets/widgets/qtabbar.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -44,8 +44,6 @@
#include <QtWidgets/qwidget.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -212,6 +210,4 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QTABBAR_H
diff --git a/src/widgets/widgets/qtabbar_p.h b/src/widgets/widgets/qtabbar_p.h
index 2dc7569d27..7468144146 100644
--- a/src/widgets/widgets/qtabbar_p.h
+++ b/src/widgets/widgets/qtabbar_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/widgets/qtabwidget.cpp b/src/widgets/widgets/qtabwidget.cpp
index 2f0acc3ea4..4df55e2537 100644
--- a/src/widgets/widgets/qtabwidget.cpp
+++ b/src/widgets/widgets/qtabwidget.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/widgets/qtabwidget.h b/src/widgets/widgets/qtabwidget.h
index 54bf1e638d..1a1eb2ef2b 100644
--- a/src/widgets/widgets/qtabwidget.h
+++ b/src/widgets/widgets/qtabwidget.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -45,8 +45,6 @@
#include <QtWidgets/qwidget.h>
#include <QtGui/qicon.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -181,6 +179,4 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QTABWIDGET_H
diff --git a/src/widgets/widgets/qtextbrowser.cpp b/src/widgets/widgets/qtextbrowser.cpp
index 61e7a5fbfb..e05da51207 100644
--- a/src/widgets/widgets/qtextbrowser.cpp
+++ b/src/widgets/widgets/qtextbrowser.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -151,12 +151,18 @@ public:
QString QTextBrowserPrivate::findFile(const QUrl &name) const
{
QString fileName;
- if (name.scheme() == QLatin1String("qrc"))
+ if (name.scheme() == QLatin1String("qrc")) {
fileName = QLatin1String(":/") + name.path();
- else if (name.scheme().isEmpty())
+ } else if (name.scheme().isEmpty()) {
fileName = name.path();
- else
- fileName = name.toLocalFile();
+ } else {
+#if defined(Q_OS_ANDROID)
+ if (name.scheme() == QLatin1String("assets"))
+ fileName = QLatin1String("assets:") + name.path();
+ else
+#endif
+ fileName = name.toLocalFile();
+ }
if (QFileInfo(fileName).isAbsolute())
return fileName;
@@ -217,13 +223,14 @@ void QTextBrowserPrivate::_q_activateAnchor(const QString &href)
textOrSourceChanged = false;
#ifndef QT_NO_DESKTOPSERVICES
- if ((openExternalLinks
- && url.scheme() != QLatin1String("file")
- && url.scheme() != QLatin1String("qrc")
- && !url.isRelative())
- || (url.isRelative() && !currentURL.isRelative()
- && currentURL.scheme() != QLatin1String("file")
- && currentURL.scheme() != QLatin1String("qrc"))) {
+ bool isFileScheme =
+ url.scheme() == QLatin1String("file")
+#if defined(Q_OS_ANDROID)
+ || url.scheme() == QLatin1String("assets")
+#endif
+ || url.scheme() == QLatin1String("qrc");
+ if ((openExternalLinks && !isFileScheme && !url.isRelative())
+ || (url.isRelative() && !currentURL.isRelative() && !isFileScheme)) {
QDesktopServices::openUrl(url);
return;
}
diff --git a/src/widgets/widgets/qtextbrowser.h b/src/widgets/widgets/qtextbrowser.h
index 900dd27211..244d8a32df 100644
--- a/src/widgets/widgets/qtextbrowser.h
+++ b/src/widgets/widgets/qtextbrowser.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -45,8 +45,6 @@
#include <QtWidgets/qtextedit.h>
#include <QtCore/qurl.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -129,6 +127,4 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QTEXTBROWSER_H
diff --git a/src/widgets/widgets/qtextedit.cpp b/src/widgets/widgets/qtextedit.cpp
index f033b6544c..bf2c8a4495 100644
--- a/src/widgets/widgets/qtextedit.cpp
+++ b/src/widgets/widgets/qtextedit.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -182,7 +182,7 @@ void QTextEditPrivate::init(const QString &html)
q->setFocusPolicy(Qt::WheelFocus);
q->setAttribute(Qt::WA_KeyCompression);
q->setAttribute(Qt::WA_InputMethodEnabled);
-
+ q->setInputMethodHints(Qt::ImhMultiLine);
#ifndef QT_NO_CURSOR
viewport->setCursor(Qt::IBeamCursor);
#endif
diff --git a/src/widgets/widgets/qtextedit.h b/src/widgets/widgets/qtextedit.h
index b44083a502..e1471848e7 100644
--- a/src/widgets/widgets/qtextedit.h
+++ b/src/widgets/widgets/qtextedit.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -51,8 +51,6 @@
#ifndef QT_NO_TEXTEDIT
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -314,8 +312,6 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(QTextEdit::AutoFormatting)
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QT_NO_TEXTEDIT
#endif // QTEXTEDIT_H
diff --git a/src/widgets/widgets/qtextedit_p.h b/src/widgets/widgets/qtextedit_p.h
index a2ca2dc6f4..1ce68dc23e 100644
--- a/src/widgets/widgets/qtextedit_p.h
+++ b/src/widgets/widgets/qtextedit_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/widgets/qtoolbar.cpp b/src/widgets/widgets/qtoolbar.cpp
index 907874fc0e..0c2dd20d77 100644
--- a/src/widgets/widgets/qtoolbar.cpp
+++ b/src/widgets/widgets/qtoolbar.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/widgets/qtoolbar.h b/src/widgets/widgets/qtoolbar.h
index a706ccf46e..663497493f 100644
--- a/src/widgets/widgets/qtoolbar.h
+++ b/src/widgets/widgets/qtoolbar.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -44,8 +44,6 @@
#include <QtWidgets/qwidget.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -172,6 +170,4 @@ inline QAction *QToolBar::actionAt(int ax, int ay) const
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QDYNAMICTOOLBAR_H
diff --git a/src/widgets/widgets/qtoolbar_p.h b/src/widgets/widgets/qtoolbar_p.h
index 464f653059..9ff0b9d61c 100644
--- a/src/widgets/widgets/qtoolbar_p.h
+++ b/src/widgets/widgets/qtoolbar_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/widgets/qtoolbararealayout.cpp b/src/widgets/widgets/qtoolbararealayout.cpp
index 02279ad014..94a1148ded 100644
--- a/src/widgets/widgets/qtoolbararealayout.cpp
+++ b/src/widgets/widgets/qtoolbararealayout.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -810,7 +810,7 @@ QLayoutItem *QToolBarAreaLayout::insertToolBar(QToolBar *before, QToolBar *toolB
QInternal::DockPosition pos = findToolBar(before);
if (pos == QInternal::DockCount)
return 0;
-
+
return docks[pos].insertToolBar(before, toolBar);
}
@@ -869,7 +869,7 @@ void QToolBarAreaLayout::insertItem(QToolBar *before, QLayoutItem *item)
QInternal::DockPosition pos = findToolBar(before);
if (pos == QInternal::DockCount)
return;
-
+
docks[pos].insertItem(before, item);
}
diff --git a/src/widgets/widgets/qtoolbararealayout_p.h b/src/widgets/widgets/qtoolbararealayout_p.h
index 5cbb4a4756..ec7d1f26f1 100644
--- a/src/widgets/widgets/qtoolbararealayout_p.h
+++ b/src/widgets/widgets/qtoolbararealayout_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -169,7 +169,7 @@ public:
void removeToolBar(QToolBar *toolBar);
void insertToolBarBreak(QToolBar *before);
void removeToolBarBreak(QToolBar *before);
- void moveToolBar(QToolBar *toolbar, int pos);
+ void moveToolBar(QToolBar *toolbar, int pos);
QList<int> gapIndex(const QPoint &pos, int *maxDistance) const;
bool insertGap(const QList<int> &path, QLayoutItem *item);
@@ -215,7 +215,7 @@ public:
void insertToolBarBreak(QToolBar *before);
void removeToolBarBreak(QToolBar *before);
void addToolBarBreak(QInternal::DockPosition pos);
- void moveToolBar(QToolBar *toolbar, int pos);
+ void moveToolBar(QToolBar *toolbar, int pos);
void insertItem(QInternal::DockPosition pos, QLayoutItem *item);
void insertItem(QToolBar *before, QLayoutItem *item);
diff --git a/src/widgets/widgets/qtoolbarextension.cpp b/src/widgets/widgets/qtoolbarextension.cpp
index 682ababc33..1e1999d4f3 100644
--- a/src/widgets/widgets/qtoolbarextension.cpp
+++ b/src/widgets/widgets/qtoolbarextension.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/widgets/qtoolbarextension_p.h b/src/widgets/widgets/qtoolbarextension_p.h
index 5175d7bc2d..ccb2e411b0 100644
--- a/src/widgets/widgets/qtoolbarextension_p.h
+++ b/src/widgets/widgets/qtoolbarextension_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/widgets/qtoolbarlayout.cpp b/src/widgets/widgets/qtoolbarlayout.cpp
index 1dde9c0a1d..3c0c84ee2f 100644
--- a/src/widgets/widgets/qtoolbarlayout.cpp
+++ b/src/widgets/widgets/qtoolbarlayout.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -409,7 +409,7 @@ void QToolBarLayout::setGeometry(const QRect &rect)
}
}
#endif
-
+
}
bool QToolBarLayout::layoutActions(const QSize &size)
diff --git a/src/widgets/widgets/qtoolbarlayout_p.h b/src/widgets/widgets/qtoolbarlayout_p.h
index 5796c21861..8605a9a6ac 100644
--- a/src/widgets/widgets/qtoolbarlayout_p.h
+++ b/src/widgets/widgets/qtoolbarlayout_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/widgets/qtoolbarseparator.cpp b/src/widgets/widgets/qtoolbarseparator.cpp
index a5b5bb9569..140f26eaed 100644
--- a/src/widgets/widgets/qtoolbarseparator.cpp
+++ b/src/widgets/widgets/qtoolbarseparator.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/widgets/qtoolbarseparator_p.h b/src/widgets/widgets/qtoolbarseparator_p.h
index bea892c6fb..8db7205b4f 100644
--- a/src/widgets/widgets/qtoolbarseparator_p.h
+++ b/src/widgets/widgets/qtoolbarseparator_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/widgets/qtoolbox.cpp b/src/widgets/widgets/qtoolbox.cpp
index 52ab5465ae..1264a5b6f2 100644
--- a/src/widgets/widgets/qtoolbox.cpp
+++ b/src/widgets/widgets/qtoolbox.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/widgets/qtoolbox.h b/src/widgets/widgets/qtoolbox.h
index 6d7166f2ac..3a15ca1850 100644
--- a/src/widgets/widgets/qtoolbox.h
+++ b/src/widgets/widgets/qtoolbox.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -45,8 +45,6 @@
#include <QtWidgets/qframe.h>
#include <QtGui/qicon.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -126,6 +124,4 @@ inline int QToolBox::insertItem(int index, QWidget *item, const QString &text)
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QTOOLBOX_H
diff --git a/src/widgets/widgets/qtoolbutton.cpp b/src/widgets/widgets/qtoolbutton.cpp
index 54c73588f7..88690f8bff 100644
--- a/src/widgets/widgets/qtoolbutton.cpp
+++ b/src/widgets/widgets/qtoolbutton.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/widgets/qtoolbutton.h b/src/widgets/widgets/qtoolbutton.h
index 778f2d8f15..3310476b44 100644
--- a/src/widgets/widgets/qtoolbutton.h
+++ b/src/widgets/widgets/qtoolbutton.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -44,8 +44,6 @@
#include <QtWidgets/qabstractbutton.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -139,6 +137,4 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QTOOLBUTTON_H
diff --git a/src/widgets/widgets/qwidgetanimator.cpp b/src/widgets/widgets/qwidgetanimator.cpp
index c6520a010e..bbd96ca29a 100644
--- a/src/widgets/widgets/qwidgetanimator.cpp
+++ b/src/widgets/widgets/qwidgetanimator.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/widgets/qwidgetanimator_p.h b/src/widgets/widgets/qwidgetanimator_p.h
index fa2421c1fa..776ca74b1f 100644
--- a/src/widgets/widgets/qwidgetanimator_p.h
+++ b/src/widgets/widgets/qwidgetanimator_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/widgets/qwidgetlinecontrol.cpp b/src/widgets/widgets/qwidgetlinecontrol.cpp
index 579c1713aa..9212f942c5 100644
--- a/src/widgets/widgets/qwidgetlinecontrol.cpp
+++ b/src/widgets/widgets/qwidgetlinecontrol.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/widgets/qwidgetlinecontrol_p.h b/src/widgets/widgets/qwidgetlinecontrol_p.h
index f5fd900681..1cee67bfd2 100644
--- a/src/widgets/widgets/qwidgetlinecontrol_p.h
+++ b/src/widgets/widgets/qwidgetlinecontrol_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -69,8 +69,6 @@
#include "qplatformdefs.h"
-QT_BEGIN_HEADER
-
#ifdef DrawText
# undef DrawText
#endif
@@ -533,8 +531,6 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QT_NO_LINEEDIT
#endif // QWidgetLineControl_P_H
diff --git a/src/widgets/widgets/qwidgetresizehandler.cpp b/src/widgets/widgets/qwidgetresizehandler.cpp
index 362f46ac6a..ba4e69126a 100644
--- a/src/widgets/widgets/qwidgetresizehandler.cpp
+++ b/src/widgets/widgets/qwidgetresizehandler.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/widgets/qwidgetresizehandler_p.h b/src/widgets/widgets/qwidgetresizehandler_p.h
index 8c6b8cd669..6ace370e9d 100644
--- a/src/widgets/widgets/qwidgetresizehandler_p.h
+++ b/src/widgets/widgets/qwidgetresizehandler_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/widgets/qwidgettextcontrol.cpp b/src/widgets/widgets/qwidgettextcontrol.cpp
index 9a2a83503b..99493704b5 100644
--- a/src/widgets/widgets/qwidgettextcontrol.cpp
+++ b/src/widgets/widgets/qwidgettextcontrol.cpp
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -1726,12 +1726,13 @@ void QWidgetTextControlPrivate::mouseReleaseEvent(QEvent *e, Qt::MouseButton but
{
Q_Q(QWidgetTextControl);
+ const QTextCursor oldSelection = cursor;
if (sendMouseEventToInputContext(
e, QEvent::MouseButtonRelease, button, pos, modifiers, buttons, globalPos)) {
+ repaintOldAndNewSelection(oldSelection);
return;
}
- const QTextCursor oldSelection = cursor;
const int oldCursorPos = cursor.position();
#ifndef QT_NO_DRAGANDDROP
diff --git a/src/widgets/widgets/qwidgettextcontrol_p.h b/src/widgets/widgets/qwidgettextcontrol_p.h
index 070dc660c6..e857fffba5 100644
--- a/src/widgets/widgets/qwidgettextcontrol_p.h
+++ b/src/widgets/widgets/qwidgettextcontrol_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
@@ -65,8 +65,6 @@
#include <QtGui/qclipboard.h>
#include <QtCore/qmimedata.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -297,6 +295,4 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QWidgetTextControl_H
diff --git a/src/widgets/widgets/qwidgettextcontrol_p_p.h b/src/widgets/widgets/qwidgettextcontrol_p_p.h
index 86a7f1e48e..727821015e 100644
--- a/src/widgets/widgets/qwidgettextcontrol_p_p.h
+++ b/src/widgets/widgets/qwidgettextcontrol_p_p.h
@@ -3,7 +3,7 @@
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
-** This file is part of the QtGui module of the Qt Toolkit.
+** This file is part of the QtWidgets module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
diff --git a/src/widgets/widgets/widgets.pri b/src/widgets/widgets/widgets.pri
index 797f3e9b76..9780d3c24c 100644
--- a/src/widgets/widgets/widgets.pri
+++ b/src/widgets/widgets/widgets.pri
@@ -145,7 +145,7 @@ SOURCES += \
false:mac {
HEADERS += widgets/qmacnativewidget_mac.h \
widgets/qmaccocoaviewcontainer_mac.h
- OBJECTIVE_HEADERS += widgets/qcocoatoolbardelegate_mac_p.h \
+ OBJECTIVE_HEADERS += widgets/qcocoatoolbardelegate_mac_p.h \
widgets/qcocoamenu_mac_p.h
OBJECTIVE_SOURCES += widgets/qmaccocoaviewcontainer_mac.mm \
widgets/qcocoatoolbardelegate_mac.mm \