summaryrefslogtreecommitdiffstats
path: root/src/widgets
diff options
context:
space:
mode:
Diffstat (limited to 'src/widgets')
-rw-r--r--src/widgets/.prev_CMakeLists.txt841
-rw-r--r--src/widgets/CMakeLists.txt843
-rw-r--r--src/widgets/Qt5WidgetsConfigExtras.cmake.in30
-rw-r--r--src/widgets/Qt6WidgetsMacros.cmake (renamed from src/widgets/Qt5WidgetsMacros.cmake)7
-rw-r--r--src/widgets/accessible/qaccessiblewidget.cpp1
-rw-r--r--src/widgets/accessible/rangecontrols.cpp2
-rw-r--r--src/widgets/configure.cmake563
-rw-r--r--src/widgets/configure.json10
-rw-r--r--src/widgets/dialogs/qfiledialog.cpp15
-rw-r--r--src/widgets/dialogs/qinputdialog.cpp2
-rw-r--r--src/widgets/dialogs/qprogressdialog.cpp4
-rw-r--r--src/widgets/doc/snippets/javastyle.cpp2
-rw-r--r--src/widgets/doc/snippets/qstackedlayout/main.cpp2
-rw-r--r--src/widgets/doc/snippets/qstackedwidget/main.cpp2
-rw-r--r--src/widgets/doc/src/graphicsview.qdoc6
-rw-r--r--src/widgets/doc/src/widgets-and-layouts/styles.qdoc2
-rw-r--r--src/widgets/effects/qpixmapfilter.cpp18
-rw-r--r--src/widgets/graphicsview/qgraphicsanchorlayout_p.cpp1
-rw-r--r--src/widgets/graphicsview/qgraphicsgridlayoutengine.cpp30
-rw-r--r--src/widgets/graphicsview/qgraphicsgridlayoutengine_p.h6
-rw-r--r--src/widgets/graphicsview/qgraphicsitem.cpp9
-rw-r--r--src/widgets/graphicsview/qgraphicslayoutitem.cpp17
-rw-r--r--src/widgets/graphicsview/qgraphicslayoutitem.h1
-rw-r--r--src/widgets/graphicsview/qgraphicsscene.h1
-rw-r--r--src/widgets/graphicsview/qgraphicssceneindex_p.h1
-rw-r--r--src/widgets/graphicsview/qgraphicswidget.h3
-rw-r--r--src/widgets/itemviews/qdatawidgetmapper.cpp3
-rw-r--r--src/widgets/itemviews/qlistwidget.cpp4
-rw-r--r--src/widgets/itemviews/qtreewidget.cpp2
-rw-r--r--src/widgets/kernel/kernel.pri29
-rw-r--r--src/widgets/kernel/qaction.cpp1071
-rw-r--r--src/widgets/kernel/qaction.h132
-rw-r--r--src/widgets/kernel/qaction_p.h49
-rw-r--r--src/widgets/kernel/qactiongroup.cpp309
-rw-r--r--src/widgets/kernel/qactiongroup.h44
-rw-r--r--src/widgets/kernel/qapplication.h1
-rw-r--r--src/widgets/kernel/qopenglwidget.cpp1471
-rw-r--r--src/widgets/kernel/qopenglwidget.h115
-rw-r--r--src/widgets/kernel/qshortcut.cpp320
-rw-r--r--src/widgets/kernel/qshortcut.h46
-rw-r--r--src/widgets/kernel/qt_widgets_pch.h4
-rw-r--r--src/widgets/kernel/qwidget.cpp28
-rw-r--r--src/widgets/kernel/qwidget.h4
-rw-r--r--src/widgets/kernel/qwidget_p.h4
-rw-r--r--src/widgets/kernel/qwidgetaction.cpp3
-rw-r--r--src/widgets/kernel/qwidgetaction.h7
-rw-r--r--src/widgets/kernel/qwidgetaction_p.h2
-rw-r--r--src/widgets/kernel/qwidgetsvariant.cpp73
-rw-r--r--src/widgets/styles/qfusionstyle.cpp2
-rw-r--r--src/widgets/styles/qstyle.cpp1
-rw-r--r--src/widgets/styles/qstyle.h6
-rw-r--r--src/widgets/styles/qstyleanimation.cpp2
-rw-r--r--src/widgets/styles/qstyleoption.cpp2
-rw-r--r--src/widgets/styles/qstylesheetstyle_p.h4
-rw-r--r--src/widgets/util/qundostack.cpp4
-rw-r--r--src/widgets/util/qundostack_p.h4
-rw-r--r--src/widgets/widgets/qabstractbutton.cpp49
-rw-r--r--src/widgets/widgets/qabstractbutton.h4
-rw-r--r--src/widgets/widgets/qbuttongroup.cpp43
-rw-r--r--src/widgets/widgets/qbuttongroup.h10
-rw-r--r--src/widgets/widgets/qcombobox.cpp65
-rw-r--r--src/widgets/widgets/qcombobox.h14
-rw-r--r--src/widgets/widgets/qdatetimeedit.cpp60
-rw-r--r--src/widgets/widgets/qdatetimeedit_p.h2
-rw-r--r--src/widgets/widgets/qeffects.cpp2
-rw-r--r--src/widgets/widgets/qfontcombobox.cpp2
-rw-r--r--src/widgets/widgets/qlabel.cpp1
-rw-r--r--src/widgets/widgets/qlineedit.cpp6
-rw-r--r--src/widgets/widgets/qlineedit_p.cpp18
-rw-r--r--src/widgets/widgets/qlineedit_p.h8
-rw-r--r--src/widgets/widgets/qmainwindow.cpp2
-rw-r--r--src/widgets/widgets/qmdisubwindow.cpp8
-rw-r--r--src/widgets/widgets/qmenu.cpp38
-rw-r--r--src/widgets/widgets/qmenu.h54
-rw-r--r--src/widgets/widgets/qmenubar.cpp17
-rw-r--r--src/widgets/widgets/qspinbox.cpp34
-rw-r--r--src/widgets/widgets/qspinbox.h8
-rw-r--r--src/widgets/widgets/qsplitter.h1
-rw-r--r--src/widgets/widgets/qtextbrowser.cpp15
-rw-r--r--src/widgets/widgets/qtextbrowser.h4
-rw-r--r--src/widgets/widgets/qtoolbar.cpp2
-rw-r--r--src/widgets/widgets/qtoolbarlayout.cpp2
-rw-r--r--src/widgets/widgets/qtoolbarlayout_p.h2
-rw-r--r--src/widgets/widgets/qtoolbutton.cpp2
-rw-r--r--src/widgets/widgets/qwidgettextcontrol.cpp4
85 files changed, 2697 insertions, 3945 deletions
diff --git a/src/widgets/.prev_CMakeLists.txt b/src/widgets/.prev_CMakeLists.txt
new file mode 100644
index 0000000000..51e8f8064d
--- /dev/null
+++ b/src/widgets/.prev_CMakeLists.txt
@@ -0,0 +1,841 @@
+# Generated from widgets.pro.
+
+#####################################################################
+## Widgets Module:
+#####################################################################
+
+qt_add_module(Widgets
+ GENERATE_METATYPES
+ QMAKE_MODULE_CONFIG uic
+ PLUGIN_TYPES styles
+ SOURCES
+ itemviews/qfileiconprovider.cpp itemviews/qfileiconprovider.h itemviews/qfileiconprovider_p.h
+ kernel/qapplication.cpp kernel/qapplication.h kernel/qapplication_p.h
+ kernel/qboxlayout.cpp kernel/qboxlayout.h
+ kernel/qdesktopwidget.cpp kernel/qdesktopwidget.h kernel/qdesktopwidget_p.h
+ kernel/qgesture.cpp kernel/qgesture.h kernel/qgesture_p.h
+ kernel/qgesturemanager.cpp kernel/qgesturemanager_p.h
+ kernel/qgesturerecognizer.cpp kernel/qgesturerecognizer.h
+ kernel/qgridlayout.cpp kernel/qgridlayout.h
+ kernel/qlayout.cpp kernel/qlayout.h kernel/qlayout_p.h
+ kernel/qlayoutengine.cpp kernel/qlayoutengine_p.h
+ kernel/qlayoutitem.cpp kernel/qlayoutitem.h
+ kernel/qsizepolicy.cpp kernel/qsizepolicy.h
+ kernel/qstackedlayout.cpp kernel/qstackedlayout.h
+ kernel/qstandardgestures.cpp kernel/qstandardgestures_p.h
+ kernel/qtestsupport_widgets.cpp kernel/qtestsupport_widgets.h
+ kernel/qtwidgetsglobal.h kernel/qtwidgetsglobal_p.h
+ kernel/qwidget.cpp kernel/qwidget.h kernel/qwidget_p.h
+ kernel/qwidgetrepaintmanager.cpp kernel/qwidgetrepaintmanager_p.h
+ kernel/qwidgetsvariant.cpp
+ kernel/qwidgetwindow.cpp kernel/qwidgetwindow_p.h
+ kernel/qwindowcontainer.cpp kernel/qwindowcontainer_p.h
+ styles/qcommonstyle.cpp styles/qcommonstyle.h styles/qcommonstyle_p.h
+ styles/qcommonstylepixmaps_p.h
+ styles/qdrawutil.cpp styles/qdrawutil.h
+ styles/qpixmapstyle.cpp styles/qpixmapstyle_p.h
+ styles/qpixmapstyle_p_p.h
+ styles/qproxystyle.cpp styles/qproxystyle.h styles/qproxystyle_p.h
+ styles/qstyle.cpp styles/qstyle.h
+ styles/qstylefactory.cpp styles/qstylefactory.h
+ styles/qstylehelper.cpp styles/qstylehelper_p.h
+ styles/qstyleoption.cpp styles/qstyleoption.h
+ styles/qstylepainter.cpp styles/qstylepainter.h
+ styles/qstyleplugin.cpp styles/qstyleplugin.h
+ styles/qstylesheetstyle.cpp styles/qstylesheetstyle_p.h
+ styles/qstylesheetstyle_default.cpp
+ util/qcolormap.cpp util/qcolormap.h
+ util/qsystemtrayicon.cpp util/qsystemtrayicon.h util/qsystemtrayicon_p.h
+ widgets/qabstractscrollarea.cpp widgets/qabstractscrollarea.h widgets/qabstractscrollarea_p.h
+ widgets/qfocusframe.cpp widgets/qfocusframe.h
+ widgets/qframe.cpp widgets/qframe.h widgets/qframe_p.h
+ widgets/qwidgetanimator.cpp widgets/qwidgetanimator_p.h
+ DEFINES
+ QT_NO_USING_NAMESPACE
+ INCLUDE_DIRECTORIES
+ dialogs
+ LIBRARIES
+ Qt::CorePrivate
+ Qt::GuiPrivate
+ PUBLIC_LIBRARIES
+ Qt::Core
+ Qt::Gui
+ PRIVATE_MODULE_INTERFACE
+ Qt::CorePrivate
+ Qt::GuiPrivate
+ PRECOMPILED_HEADER
+ "kernel/qt_widgets_pch.h"
+)
+
+# Resources:
+set(qstyle_resource_files
+ "images/cdr-128.png"
+ "images/cdr-16.png"
+ "images/cdr-32.png"
+ "images/cleartext-16.png"
+ "images/cleartext-32.png"
+ "images/closedock-10.png"
+ "images/closedock-16.png"
+ "images/closedock-20.png"
+ "images/closedock-32.png"
+ "images/closedock-48.png"
+ "images/closedock-64.png"
+ "images/computer-16.png"
+ "images/computer-32.png"
+ "images/desktop-16.png"
+ "images/desktop-32.png"
+ "images/dirclosed-128.png"
+ "images/dirclosed-16.png"
+ "images/dirclosed-32.png"
+ "images/dirlink-128.png"
+ "images/dirlink-16.png"
+ "images/dirlink-32.png"
+ "images/diropen-128.png"
+ "images/diropen-16.png"
+ "images/diropen-32.png"
+ "images/down-128.png"
+ "images/down-16.png"
+ "images/down-32.png"
+ "images/dvd-128.png"
+ "images/dvd-16.png"
+ "images/dvd-32.png"
+ "images/file-128.png"
+ "images/file-16.png"
+ "images/file-32.png"
+ "images/filecontents-128.png"
+ "images/filecontents-16.png"
+ "images/filecontents-32.png"
+ "images/fileinfo-128.png"
+ "images/fileinfo-16.png"
+ "images/fileinfo-32.png"
+ "images/filelink-128.png"
+ "images/filelink-16.png"
+ "images/filelink-32.png"
+ "images/floppy-128.png"
+ "images/floppy-16.png"
+ "images/floppy-32.png"
+ "images/fontbitmap-16.png"
+ "images/fonttruetype-16.png"
+ "images/fusion_groupbox.png"
+ "images/harddrive-128.png"
+ "images/harddrive-16.png"
+ "images/harddrive-32.png"
+ "images/left-128.png"
+ "images/left-16.png"
+ "images/left-32.png"
+ "images/media-pause-16.png"
+ "images/media-pause-32.png"
+ "images/media-play-16.png"
+ "images/media-play-32.png"
+ "images/media-seek-backward-16.png"
+ "images/media-seek-backward-32.png"
+ "images/media-seek-forward-16.png"
+ "images/media-seek-forward-32.png"
+ "images/media-skip-backward-16.png"
+ "images/media-skip-backward-32.png"
+ "images/media-skip-forward-16.png"
+ "images/media-skip-forward-32.png"
+ "images/media-stop-16.png"
+ "images/media-stop-32.png"
+ "images/media-volume-16.png"
+ "images/media-volume-muted-16.png"
+ "images/networkdrive-128.png"
+ "images/networkdrive-16.png"
+ "images/networkdrive-32.png"
+ "images/newdirectory-128.png"
+ "images/newdirectory-16.png"
+ "images/newdirectory-32.png"
+ "images/normalizedockup-10.png"
+ "images/normalizedockup-16.png"
+ "images/normalizedockup-20.png"
+ "images/normalizedockup-32.png"
+ "images/normalizedockup-48.png"
+ "images/normalizedockup-64.png"
+ "images/parentdir-128.png"
+ "images/parentdir-16.png"
+ "images/parentdir-32.png"
+ "images/refresh-24.png"
+ "images/refresh-32.png"
+ "images/right-128.png"
+ "images/right-16.png"
+ "images/right-32.png"
+ "images/standardbutton-apply-128.png"
+ "images/standardbutton-apply-16.png"
+ "images/standardbutton-apply-32.png"
+ "images/standardbutton-cancel-128.png"
+ "images/standardbutton-cancel-16.png"
+ "images/standardbutton-cancel-32.png"
+ "images/standardbutton-clear-128.png"
+ "images/standardbutton-clear-16.png"
+ "images/standardbutton-clear-32.png"
+ "images/standardbutton-close-128.png"
+ "images/standardbutton-close-16.png"
+ "images/standardbutton-close-32.png"
+ "images/standardbutton-closetab-16.png"
+ "images/standardbutton-closetab-down-16.png"
+ "images/standardbutton-closetab-hover-16.png"
+ "images/standardbutton-delete-128.png"
+ "images/standardbutton-delete-16.png"
+ "images/standardbutton-delete-32.png"
+ "images/standardbutton-help-128.png"
+ "images/standardbutton-help-16.png"
+ "images/standardbutton-help-32.png"
+ "images/standardbutton-no-128.png"
+ "images/standardbutton-no-16.png"
+ "images/standardbutton-no-32.png"
+ "images/standardbutton-ok-128.png"
+ "images/standardbutton-ok-16.png"
+ "images/standardbutton-ok-32.png"
+ "images/standardbutton-open-128.png"
+ "images/standardbutton-open-16.png"
+ "images/standardbutton-open-32.png"
+ "images/standardbutton-save-128.png"
+ "images/standardbutton-save-16.png"
+ "images/standardbutton-save-32.png"
+ "images/standardbutton-yes-128.png"
+ "images/standardbutton-yes-16.png"
+ "images/standardbutton-yes-32.png"
+ "images/stop-24.png"
+ "images/stop-32.png"
+ "images/titlebar-contexthelp-16.png"
+ "images/titlebar-contexthelp-32.png"
+ "images/titlebar-contexthelp-48.png"
+ "images/titlebar-max-16.png"
+ "images/titlebar-max-32.png"
+ "images/titlebar-max-48.png"
+ "images/titlebar-min-16.png"
+ "images/titlebar-min-32.png"
+ "images/titlebar-min-48.png"
+ "images/titlebar-shade-16.png"
+ "images/titlebar-shade-32.png"
+ "images/titlebar-shade-48.png"
+ "images/titlebar-unshade-16.png"
+ "images/titlebar-unshade-32.png"
+ "images/titlebar-unshade-48.png"
+ "images/toolbar-ext-h-16.png"
+ "images/toolbar-ext-h-32.png"
+ "images/toolbar-ext-h-8.png"
+ "images/toolbar-ext-h-rtl-16.png"
+ "images/toolbar-ext-h-rtl-32.png"
+ "images/toolbar-ext-h-rtl-8.png"
+ "images/toolbar-ext-v-10.png"
+ "images/toolbar-ext-v-20.png"
+ "images/toolbar-ext-v-5.png"
+ "images/trash-128.png"
+ "images/trash-16.png"
+ "images/trash-32.png"
+ "images/up-128.png"
+ "images/up-16.png"
+ "images/up-32.png"
+ "images/viewdetailed-128.png"
+ "images/viewdetailed-16.png"
+ "images/viewdetailed-32.png"
+ "images/viewlist-128.png"
+ "images/viewlist-16.png"
+ "images/viewlist-32.png"
+)
+
+qt_add_resource(Widgets "qstyle"
+ PREFIX
+ "/qt-project.org/styles/commonstyle"
+ BASE
+ "styles"
+ FILES
+ ${qstyle_resource_files}
+)
+set_source_files_properties("styles/images/closedock-down-macstyle-16.png"
+ PROPERTIES QT_RESOURCE_ALIAS "images/closedock-down-16.png"
+)
+set_source_files_properties("styles/images/closedock-macstyle-16.png"
+ PROPERTIES QT_RESOURCE_ALIAS "images/closedock-16.png"
+)
+set_source_files_properties("styles/images/dockdock-down-macstyle-16.png"
+ PROPERTIES QT_RESOURCE_ALIAS "images/dockdock-down-16.png"
+)
+set_source_files_properties("styles/images/dockdock-macstyle-16.png"
+ PROPERTIES QT_RESOURCE_ALIAS "images/dockdock-16.png"
+)
+set_source_files_properties("styles/images/toolbar-ext-macstyle.png"
+ PROPERTIES QT_RESOURCE_ALIAS "images/toolbar-ext.png"
+)
+set_source_files_properties("styles/images/toolbar-ext-macstyle@2x.png"
+ PROPERTIES QT_RESOURCE_ALIAS "images/toolbar-ext@2x.png"
+)
+set(qstyle1_resource_files
+ "images/closedock-down-macstyle-16.png"
+ "images/closedock-macstyle-16.png"
+ "images/dockdock-down-macstyle-16.png"
+ "images/dockdock-macstyle-16.png"
+ "images/toolbar-ext-macstyle.png"
+ "images/toolbar-ext-macstyle@2x.png"
+)
+
+qt_add_resource(Widgets "qstyle1"
+ PREFIX
+ "/qt-project.org/styles/macstyle"
+ BASE
+ "styles"
+ FILES
+ ${qstyle1_resource_files}
+)
+
+if(QT_FEATURE_reduce_relocations AND UNIX AND GCC)
+ target_link_options(Widgets PRIVATE
+ "LINKER:--dynamic-list=${CMAKE_CURRENT_LIST_DIR}/QtWidgets.dynlist")
+endif()
+
+#### Keys ignored in scope 1:.:.:widgets.pro:<TRUE>:
+# MODULE_CONFIG = "uic"
+# QMAKE_LIBS = "$$QMAKE_LIBS_GUI"
+
+## Scopes:
+#####################################################################
+
+qt_extend_target(Widgets CONDITION MSVC AND (TEST_architecture_arch STREQUAL "i386")
+ LINK_OPTIONS
+ "/BASE:0x65000000"
+)
+
+qt_extend_target(Widgets CONDITION APPLE_OSX
+ SOURCES
+ kernel/qmacgesturerecognizer.cpp kernel/qmacgesturerecognizer_p.h
+ widgets/qmaccocoaviewcontainer_mac.h widgets/qmaccocoaviewcontainer_mac.mm
+ widgets/qmacnativewidget_mac.h widgets/qmacnativewidget_mac.mm
+ LIBRARIES
+ ${FWAppKit}
+ z
+)
+
+qt_extend_target(Widgets CONDITION WIN32 AND NOT WINRT
+ LIBRARIES
+ dwmapi
+ shell32
+ uxtheme
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_graphicseffect
+ SOURCES
+ effects/qgraphicseffect.cpp effects/qgraphicseffect.h effects/qgraphicseffect_p.h
+ effects/qpixmapfilter.cpp effects/qpixmapfilter_p.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_action
+ SOURCES
+ kernel/qaction.cpp kernel/qaction.h kernel/qaction_p.h
+ kernel/qactiongroup.cpp kernel/qactiongroup.h
+ kernel/qwidgetaction.cpp kernel/qwidgetaction.h kernel/qwidgetaction_p.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_formlayout
+ SOURCES
+ kernel/qformlayout.cpp kernel/qformlayout.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_shortcut
+ SOURCES
+ kernel/qshortcut.cpp kernel/qshortcut.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_tooltip
+ SOURCES
+ kernel/qtooltip.cpp kernel/qtooltip.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_whatsthis
+ SOURCES
+ kernel/qwhatsthis.cpp kernel/qwhatsthis.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_animation
+ SOURCES
+ styles/qstyleanimation.cpp styles/qstyleanimation_p.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_style_windows
+ SOURCES
+ styles/qwindowsstyle.cpp styles/qwindowsstyle_p.h
+ styles/qwindowsstyle_p_p.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_style_fusion
+ SOURCES
+ styles/qfusionstyle.cpp styles/qfusionstyle_p.h
+ styles/qfusionstyle_p_p.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_abstractbutton
+ SOURCES
+ widgets/qabstractbutton.cpp widgets/qabstractbutton.h widgets/qabstractbutton_p.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_abstractslider
+ SOURCES
+ widgets/qabstractslider.cpp widgets/qabstractslider.h widgets/qabstractslider_p.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_buttongroup
+ SOURCES
+ widgets/qbuttongroup.cpp widgets/qbuttongroup.h widgets/qbuttongroup_p.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_calendarwidget
+ SOURCES
+ widgets/qcalendarwidget.cpp widgets/qcalendarwidget.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_checkbox
+ SOURCES
+ widgets/qcheckbox.cpp widgets/qcheckbox.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_combobox
+ SOURCES
+ widgets/qcombobox.cpp widgets/qcombobox.h widgets/qcombobox_p.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_commandlinkbutton
+ SOURCES
+ widgets/qcommandlinkbutton.cpp widgets/qcommandlinkbutton.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_datetimeedit
+ SOURCES
+ widgets/qdatetimeedit.cpp widgets/qdatetimeedit.h widgets/qdatetimeedit_p.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_dial
+ SOURCES
+ widgets/qdial.cpp widgets/qdial.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_dockwidget
+ SOURCES
+ widgets/qdockarealayout.cpp widgets/qdockarealayout_p.h
+ widgets/qdockwidget.cpp widgets/qdockwidget.h widgets/qdockwidget_p.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_effects
+ SOURCES
+ widgets/qeffects.cpp widgets/qeffects_p.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_fontcombobox
+ SOURCES
+ widgets/qfontcombobox.cpp widgets/qfontcombobox.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_groupbox
+ SOURCES
+ widgets/qgroupbox.cpp widgets/qgroupbox.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_keysequenceedit
+ SOURCES
+ widgets/qkeysequenceedit.cpp widgets/qkeysequenceedit.h widgets/qkeysequenceedit_p.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_label
+ SOURCES
+ widgets/qlabel.cpp widgets/qlabel.h widgets/qlabel_p.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_lcdnumber
+ SOURCES
+ widgets/qlcdnumber.cpp widgets/qlcdnumber.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_lineedit
+ SOURCES
+ widgets/qlineedit.cpp widgets/qlineedit.h widgets/qlineedit_p.cpp widgets/qlineedit_p.h
+ widgets/qwidgetlinecontrol.cpp widgets/qwidgetlinecontrol_p.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_mainwindow
+ SOURCES
+ widgets/qmainwindow.cpp widgets/qmainwindow.h
+ widgets/qmainwindowlayout.cpp widgets/qmainwindowlayout_p.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_mdiarea
+ SOURCES
+ widgets/qmdiarea.cpp widgets/qmdiarea.h widgets/qmdiarea_p.h
+ widgets/qmdisubwindow.cpp widgets/qmdisubwindow.h widgets/qmdisubwindow_p.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_menu
+ SOURCES
+ widgets/qmenu.cpp widgets/qmenu.h widgets/qmenu_p.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_menubar
+ SOURCES
+ widgets/qmenubar.cpp widgets/qmenubar.h widgets/qmenubar_p.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_progressbar
+ SOURCES
+ widgets/qprogressbar.cpp widgets/qprogressbar.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_pushbutton
+ SOURCES
+ widgets/qpushbutton.cpp widgets/qpushbutton.h widgets/qpushbutton_p.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_radiobutton
+ SOURCES
+ widgets/qradiobutton.cpp widgets/qradiobutton.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_resizehandler
+ SOURCES
+ widgets/qwidgetresizehandler.cpp widgets/qwidgetresizehandler_p.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_dialogbuttonbox
+ SOURCES
+ widgets/qdialogbuttonbox.cpp widgets/qdialogbuttonbox.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_rubberband
+ SOURCES
+ widgets/qrubberband.cpp widgets/qrubberband.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_scrollarea
+ SOURCES
+ widgets/qscrollarea.cpp widgets/qscrollarea.h widgets/qscrollarea_p.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_scrollbar
+ SOURCES
+ widgets/qscrollbar.cpp widgets/qscrollbar.h widgets/qscrollbar_p.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_sizegrip
+ SOURCES
+ widgets/qsizegrip.cpp widgets/qsizegrip.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_slider
+ SOURCES
+ widgets/qslider.cpp widgets/qslider.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_spinbox
+ SOURCES
+ widgets/qabstractspinbox.cpp widgets/qabstractspinbox.h widgets/qabstractspinbox_p.h
+ widgets/qspinbox.cpp widgets/qspinbox.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_splashscreen
+ SOURCES
+ widgets/qsplashscreen.cpp widgets/qsplashscreen.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_splitter
+ SOURCES
+ widgets/qsplitter.cpp widgets/qsplitter.h widgets/qsplitter_p.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_stackedwidget
+ SOURCES
+ widgets/qstackedwidget.cpp widgets/qstackedwidget.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_statusbar
+ SOURCES
+ widgets/qstatusbar.cpp widgets/qstatusbar.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_tabbar
+ SOURCES
+ widgets/qtabbar.cpp widgets/qtabbar.h widgets/qtabbar_p.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_textedit
+ SOURCES
+ widgets/qplaintextedit.cpp widgets/qplaintextedit.h widgets/qplaintextedit_p.h
+ widgets/qtextedit.cpp widgets/qtextedit.h widgets/qtextedit_p.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_textbrowser
+ SOURCES
+ widgets/qtextbrowser.cpp widgets/qtextbrowser.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_tabwidget
+ SOURCES
+ widgets/qtabwidget.cpp widgets/qtabwidget.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_toolbar
+ SOURCES
+ widgets/qtoolbar.cpp widgets/qtoolbar.h widgets/qtoolbar_p.h
+ widgets/qtoolbararealayout.cpp widgets/qtoolbararealayout_p.h
+ widgets/qtoolbarlayout.cpp widgets/qtoolbarlayout_p.h
+ widgets/qtoolbarseparator.cpp widgets/qtoolbarseparator_p.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_toolbox
+ SOURCES
+ widgets/qtoolbox.cpp widgets/qtoolbox.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_toolbutton
+ SOURCES
+ widgets/qtoolbarextension.cpp widgets/qtoolbarextension_p.h
+ widgets/qtoolbutton.cpp widgets/qtoolbutton.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_widgettextcontrol
+ SOURCES
+ widgets/qwidgettextcontrol.cpp widgets/qwidgettextcontrol_p.h
+ widgets/qwidgettextcontrol_p_p.h
+)
+
+qt_extend_target(Widgets CONDITION APPLE_OSX AND (QT_FEATURE_menu OR QT_FEATURE_menubar)
+ SOURCES
+ widgets/qmenu_mac.mm
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_colordialog
+ SOURCES
+ dialogs/qcolordialog.cpp dialogs/qcolordialog.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_dialog
+ SOURCES
+ dialogs/qdialog.cpp dialogs/qdialog.h dialogs/qdialog_p.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_errormessage
+ SOURCES
+ dialogs/qerrormessage.cpp dialogs/qerrormessage.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_filedialog
+ SOURCES
+ dialogs/qfiledialog.cpp dialogs/qfiledialog.h dialogs/qfiledialog.ui dialogs/qfiledialog_p.h
+ dialogs/qsidebar.cpp dialogs/qsidebar_p.h
+ ENABLE_AUTOGEN_TOOLS
+ uic
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_filesystemmodel
+ SOURCES
+ dialogs/qfileinfogatherer.cpp dialogs/qfileinfogatherer_p.h
+ dialogs/qfilesystemmodel.cpp dialogs/qfilesystemmodel.h dialogs/qfilesystemmodel_p.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_fontdialog
+ SOURCES
+ dialogs/qfontdialog.cpp dialogs/qfontdialog.h dialogs/qfontdialog_p.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_fscompleter
+ SOURCES
+ dialogs/qfscompleter_p.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_inputdialog
+ SOURCES
+ dialogs/qinputdialog.cpp dialogs/qinputdialog.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_messagebox
+ SOURCES
+ dialogs/qmessagebox.cpp dialogs/qmessagebox.h
+)
+
+if(QT_FEATURE_messagebox)
+ # Resources:
+ set(qmessagebox_resource_files
+ "images/qtlogo-64.png"
+ )
+
+ qt_add_resource(Widgets "qmessagebox"
+ PREFIX
+ "/qt-project.org/qmessagebox"
+ BASE
+ "dialogs"
+ FILES
+ ${qmessagebox_resource_files}
+ )
+endif()
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_progressdialog
+ SOURCES
+ dialogs/qprogressdialog.cpp dialogs/qprogressdialog.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_wizard
+ SOURCES
+ dialogs/qwizard.cpp dialogs/qwizard.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_wizard AND WIN32
+ SOURCES
+ dialogs/qwizard_win.cpp dialogs/qwizard_win_p.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_accessibility
+ SOURCES
+ accessible/complexwidgets.cpp accessible/complexwidgets_p.h
+ accessible/qaccessiblemenu.cpp accessible/qaccessiblemenu_p.h
+ accessible/qaccessiblewidget.cpp accessible/qaccessiblewidget.h
+ accessible/qaccessiblewidgetfactory.cpp accessible/qaccessiblewidgetfactory_p.h
+ accessible/qaccessiblewidgets.cpp accessible/qaccessiblewidgets_p.h
+ accessible/rangecontrols.cpp accessible/rangecontrols_p.h
+ accessible/simplewidgets.cpp accessible/simplewidgets_p.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_accessibility AND QT_FEATURE_itemviews
+ SOURCES
+ accessible/itemviews.cpp accessible/itemviews_p.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_itemviews
+ SOURCES
+ itemviews/qabstractitemdelegate.cpp itemviews/qabstractitemdelegate.h itemviews/qabstractitemdelegate_p.h
+ itemviews/qabstractitemview.cpp itemviews/qabstractitemview.h itemviews/qabstractitemview_p.h
+ itemviews/qbsptree.cpp itemviews/qbsptree_p.h
+ itemviews/qheaderview.cpp itemviews/qheaderview.h itemviews/qheaderview_p.h
+ itemviews/qitemdelegate.cpp itemviews/qitemdelegate.h
+ itemviews/qitemeditorfactory.cpp itemviews/qitemeditorfactory.h itemviews/qitemeditorfactory_p.h
+ itemviews/qstyleditemdelegate.cpp itemviews/qstyleditemdelegate.h
+ itemviews/qwidgetitemdata_p.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_columnview
+ SOURCES
+ itemviews/qcolumnview.cpp itemviews/qcolumnview.h itemviews/qcolumnview_p.h
+ itemviews/qcolumnviewgrip.cpp itemviews/qcolumnviewgrip_p.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_datawidgetmapper
+ SOURCES
+ itemviews/qdatawidgetmapper.cpp itemviews/qdatawidgetmapper.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_dirmodel
+ SOURCES
+ itemviews/qdirmodel.cpp itemviews/qdirmodel.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_listview
+ SOURCES
+ itemviews/qlistview.cpp itemviews/qlistview.h itemviews/qlistview_p.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_listwidget
+ SOURCES
+ itemviews/qlistwidget.cpp itemviews/qlistwidget.h itemviews/qlistwidget_p.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_tableview
+ SOURCES
+ itemviews/qtableview.cpp itemviews/qtableview.h itemviews/qtableview_p.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_tablewidget
+ SOURCES
+ itemviews/qtablewidget.cpp itemviews/qtablewidget.h itemviews/qtablewidget_p.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_treeview
+ SOURCES
+ itemviews/qtreeview.cpp itemviews/qtreeview.h itemviews/qtreeview_p.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_treewidget
+ SOURCES
+ itemviews/qtreewidget.cpp itemviews/qtreewidget.h itemviews/qtreewidget_p.h
+ itemviews/qtreewidgetitemiterator.cpp itemviews/qtreewidgetitemiterator.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_graphicsview
+ SOURCES
+ graphicsview/qgraph_p.h
+ graphicsview/qgraphicsanchorlayout.cpp graphicsview/qgraphicsanchorlayout.h graphicsview/qgraphicsanchorlayout_p.cpp graphicsview/qgraphicsanchorlayout_p.h
+ graphicsview/qgraphicsgridlayout.cpp graphicsview/qgraphicsgridlayout.h
+ graphicsview/qgraphicsgridlayoutengine.cpp graphicsview/qgraphicsgridlayoutengine_p.h
+ graphicsview/qgraphicsitem.cpp graphicsview/qgraphicsitem.h graphicsview/qgraphicsitem_p.h
+ graphicsview/qgraphicslayout.cpp graphicsview/qgraphicslayout.h graphicsview/qgraphicslayout_p.cpp graphicsview/qgraphicslayout_p.h
+ graphicsview/qgraphicslayoutitem.cpp graphicsview/qgraphicslayoutitem.h graphicsview/qgraphicslayoutitem_p.h
+ graphicsview/qgraphicslayoutstyleinfo.cpp graphicsview/qgraphicslayoutstyleinfo_p.h
+ graphicsview/qgraphicslinearlayout.cpp graphicsview/qgraphicslinearlayout.h
+ graphicsview/qgraphicsproxywidget.cpp graphicsview/qgraphicsproxywidget.h graphicsview/qgraphicsproxywidget_p.h
+ graphicsview/qgraphicsscene.cpp graphicsview/qgraphicsscene.h graphicsview/qgraphicsscene_p.h
+ graphicsview/qgraphicsscene_bsp.cpp graphicsview/qgraphicsscene_bsp_p.h
+ graphicsview/qgraphicsscenebsptreeindex.cpp graphicsview/qgraphicsscenebsptreeindex_p.h
+ graphicsview/qgraphicssceneevent.cpp graphicsview/qgraphicssceneevent.h
+ graphicsview/qgraphicssceneindex.cpp graphicsview/qgraphicssceneindex_p.h
+ graphicsview/qgraphicsscenelinearindex.cpp graphicsview/qgraphicsscenelinearindex_p.h
+ graphicsview/qgraphicstransform.cpp graphicsview/qgraphicstransform.h graphicsview/qgraphicstransform_p.h
+ graphicsview/qgraphicsview.cpp graphicsview/qgraphicsview.h graphicsview/qgraphicsview_p.h
+ graphicsview/qgraphicswidget.cpp graphicsview/qgraphicswidget.h graphicsview/qgraphicswidget_p.cpp graphicsview/qgraphicswidget_p.h
+ graphicsview/qsimplex_p.cpp graphicsview/qsimplex_p.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_easingcurve AND QT_FEATURE_graphicsview
+ SOURCES
+ graphicsview/qgraphicsitemanimation.cpp graphicsview/qgraphicsitemanimation.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_completer
+ SOURCES
+ util/qcompleter.cpp util/qcompleter.h util/qcompleter_p.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_scroller
+ SOURCES
+ util/qflickgesture.cpp util/qflickgesture_p.h
+ util/qscroller.cpp util/qscroller.h util/qscroller_p.h
+ util/qscrollerproperties.cpp util/qscrollerproperties.h util/qscrollerproperties_p.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_undocommand
+ SOURCES
+ util/qundostack.cpp util/qundostack.h util/qundostack_p.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_undogroup
+ SOURCES
+ util/qundogroup.cpp util/qundogroup.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_undoview
+ SOURCES
+ util/qundoview.cpp util/qundoview.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_xcb
+ SOURCES
+ util/qsystemtrayicon_x11.cpp
+)
+
+qt_extend_target(Widgets CONDITION NOT QT_FEATURE_xcb
+ SOURCES
+ util/qsystemtrayicon_qpa.cpp
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_statemachine
+ SOURCES
+ statemachine/qguistatemachine.cpp
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_qeventtransition
+ SOURCES
+ statemachine/qbasickeyeventtransition.cpp statemachine/qbasickeyeventtransition_p.h
+ statemachine/qbasicmouseeventtransition.cpp statemachine/qbasicmouseeventtransition_p.h
+ statemachine/qkeyeventtransition.cpp statemachine/qkeyeventtransition.h
+ statemachine/qmouseeventtransition.cpp statemachine/qmouseeventtransition.h
+)
+
+
+qt_create_tracepoints(Widgets qtwidgets.tracepoints)
+qt_add_docs(Widgets
+ doc/qtwidgets.qdocconf
+)
+
diff --git a/src/widgets/CMakeLists.txt b/src/widgets/CMakeLists.txt
new file mode 100644
index 0000000000..b3c015f3db
--- /dev/null
+++ b/src/widgets/CMakeLists.txt
@@ -0,0 +1,843 @@
+# Generated from widgets.pro.
+
+#####################################################################
+## Widgets Module:
+#####################################################################
+
+qt_add_module(Widgets
+ GENERATE_METATYPES
+ QMAKE_MODULE_CONFIG uic
+ PLUGIN_TYPES styles
+ SOURCES
+ itemviews/qfileiconprovider.cpp itemviews/qfileiconprovider.h itemviews/qfileiconprovider_p.h
+ kernel/qapplication.cpp kernel/qapplication.h kernel/qapplication_p.h
+ kernel/qboxlayout.cpp kernel/qboxlayout.h
+ kernel/qdesktopwidget.cpp kernel/qdesktopwidget.h kernel/qdesktopwidget_p.h
+ kernel/qgesture.cpp kernel/qgesture.h kernel/qgesture_p.h
+ kernel/qgesturemanager.cpp kernel/qgesturemanager_p.h
+ kernel/qgesturerecognizer.cpp kernel/qgesturerecognizer.h
+ kernel/qgridlayout.cpp kernel/qgridlayout.h
+ kernel/qlayout.cpp kernel/qlayout.h kernel/qlayout_p.h
+ kernel/qlayoutengine.cpp kernel/qlayoutengine_p.h
+ kernel/qlayoutitem.cpp kernel/qlayoutitem.h
+ kernel/qsizepolicy.cpp kernel/qsizepolicy.h
+ kernel/qstackedlayout.cpp kernel/qstackedlayout.h
+ kernel/qstandardgestures.cpp kernel/qstandardgestures_p.h
+ kernel/qtestsupport_widgets.cpp kernel/qtestsupport_widgets.h
+ kernel/qtwidgetsglobal.h kernel/qtwidgetsglobal_p.h
+ kernel/qwidget.cpp kernel/qwidget.h kernel/qwidget_p.h
+ kernel/qwidgetrepaintmanager.cpp kernel/qwidgetrepaintmanager_p.h
+ kernel/qwidgetsvariant.cpp
+ kernel/qwidgetwindow.cpp kernel/qwidgetwindow_p.h
+ kernel/qwindowcontainer.cpp kernel/qwindowcontainer_p.h
+ styles/qcommonstyle.cpp styles/qcommonstyle.h styles/qcommonstyle_p.h
+ styles/qcommonstylepixmaps_p.h
+ styles/qdrawutil.cpp styles/qdrawutil.h
+ styles/qpixmapstyle.cpp styles/qpixmapstyle_p.h
+ styles/qpixmapstyle_p_p.h
+ styles/qproxystyle.cpp styles/qproxystyle.h styles/qproxystyle_p.h
+ styles/qstyle.cpp styles/qstyle.h
+ styles/qstylefactory.cpp styles/qstylefactory.h
+ styles/qstylehelper.cpp styles/qstylehelper_p.h
+ styles/qstyleoption.cpp styles/qstyleoption.h
+ styles/qstylepainter.cpp styles/qstylepainter.h
+ styles/qstyleplugin.cpp styles/qstyleplugin.h
+ styles/qstylesheetstyle.cpp styles/qstylesheetstyle_p.h
+ styles/qstylesheetstyle_default.cpp
+ util/qcolormap.cpp util/qcolormap.h
+ util/qsystemtrayicon.cpp util/qsystemtrayicon.h util/qsystemtrayicon_p.h
+ widgets/qabstractscrollarea.cpp widgets/qabstractscrollarea.h widgets/qabstractscrollarea_p.h
+ widgets/qfocusframe.cpp widgets/qfocusframe.h
+ widgets/qframe.cpp widgets/qframe.h widgets/qframe_p.h
+ widgets/qwidgetanimator.cpp widgets/qwidgetanimator_p.h
+ DEFINES
+ QT_NO_USING_NAMESPACE
+ INCLUDE_DIRECTORIES
+ dialogs
+ LIBRARIES
+ Qt::CorePrivate
+ Qt::GuiPrivate
+ PUBLIC_LIBRARIES
+ Qt::Core
+ Qt::Gui
+ PRIVATE_MODULE_INTERFACE
+ Qt::CorePrivate
+ Qt::GuiPrivate
+ PRECOMPILED_HEADER
+ "kernel/qt_widgets_pch.h"
+)
+
+add_dependencies(Widgets ${QT_CMAKE_EXPORT_NAMESPACE}::uic) # special case
+
+# Resources:
+set(qstyle_resource_files
+ "images/cdr-128.png"
+ "images/cdr-16.png"
+ "images/cdr-32.png"
+ "images/cleartext-16.png"
+ "images/cleartext-32.png"
+ "images/closedock-10.png"
+ "images/closedock-16.png"
+ "images/closedock-20.png"
+ "images/closedock-32.png"
+ "images/closedock-48.png"
+ "images/closedock-64.png"
+ "images/computer-16.png"
+ "images/computer-32.png"
+ "images/desktop-16.png"
+ "images/desktop-32.png"
+ "images/dirclosed-128.png"
+ "images/dirclosed-16.png"
+ "images/dirclosed-32.png"
+ "images/dirlink-128.png"
+ "images/dirlink-16.png"
+ "images/dirlink-32.png"
+ "images/diropen-128.png"
+ "images/diropen-16.png"
+ "images/diropen-32.png"
+ "images/down-128.png"
+ "images/down-16.png"
+ "images/down-32.png"
+ "images/dvd-128.png"
+ "images/dvd-16.png"
+ "images/dvd-32.png"
+ "images/file-128.png"
+ "images/file-16.png"
+ "images/file-32.png"
+ "images/filecontents-128.png"
+ "images/filecontents-16.png"
+ "images/filecontents-32.png"
+ "images/fileinfo-128.png"
+ "images/fileinfo-16.png"
+ "images/fileinfo-32.png"
+ "images/filelink-128.png"
+ "images/filelink-16.png"
+ "images/filelink-32.png"
+ "images/floppy-128.png"
+ "images/floppy-16.png"
+ "images/floppy-32.png"
+ "images/fontbitmap-16.png"
+ "images/fonttruetype-16.png"
+ "images/fusion_groupbox.png"
+ "images/harddrive-128.png"
+ "images/harddrive-16.png"
+ "images/harddrive-32.png"
+ "images/left-128.png"
+ "images/left-16.png"
+ "images/left-32.png"
+ "images/media-pause-16.png"
+ "images/media-pause-32.png"
+ "images/media-play-16.png"
+ "images/media-play-32.png"
+ "images/media-seek-backward-16.png"
+ "images/media-seek-backward-32.png"
+ "images/media-seek-forward-16.png"
+ "images/media-seek-forward-32.png"
+ "images/media-skip-backward-16.png"
+ "images/media-skip-backward-32.png"
+ "images/media-skip-forward-16.png"
+ "images/media-skip-forward-32.png"
+ "images/media-stop-16.png"
+ "images/media-stop-32.png"
+ "images/media-volume-16.png"
+ "images/media-volume-muted-16.png"
+ "images/networkdrive-128.png"
+ "images/networkdrive-16.png"
+ "images/networkdrive-32.png"
+ "images/newdirectory-128.png"
+ "images/newdirectory-16.png"
+ "images/newdirectory-32.png"
+ "images/normalizedockup-10.png"
+ "images/normalizedockup-16.png"
+ "images/normalizedockup-20.png"
+ "images/normalizedockup-32.png"
+ "images/normalizedockup-48.png"
+ "images/normalizedockup-64.png"
+ "images/parentdir-128.png"
+ "images/parentdir-16.png"
+ "images/parentdir-32.png"
+ "images/refresh-24.png"
+ "images/refresh-32.png"
+ "images/right-128.png"
+ "images/right-16.png"
+ "images/right-32.png"
+ "images/standardbutton-apply-128.png"
+ "images/standardbutton-apply-16.png"
+ "images/standardbutton-apply-32.png"
+ "images/standardbutton-cancel-128.png"
+ "images/standardbutton-cancel-16.png"
+ "images/standardbutton-cancel-32.png"
+ "images/standardbutton-clear-128.png"
+ "images/standardbutton-clear-16.png"
+ "images/standardbutton-clear-32.png"
+ "images/standardbutton-close-128.png"
+ "images/standardbutton-close-16.png"
+ "images/standardbutton-close-32.png"
+ "images/standardbutton-closetab-16.png"
+ "images/standardbutton-closetab-down-16.png"
+ "images/standardbutton-closetab-hover-16.png"
+ "images/standardbutton-delete-128.png"
+ "images/standardbutton-delete-16.png"
+ "images/standardbutton-delete-32.png"
+ "images/standardbutton-help-128.png"
+ "images/standardbutton-help-16.png"
+ "images/standardbutton-help-32.png"
+ "images/standardbutton-no-128.png"
+ "images/standardbutton-no-16.png"
+ "images/standardbutton-no-32.png"
+ "images/standardbutton-ok-128.png"
+ "images/standardbutton-ok-16.png"
+ "images/standardbutton-ok-32.png"
+ "images/standardbutton-open-128.png"
+ "images/standardbutton-open-16.png"
+ "images/standardbutton-open-32.png"
+ "images/standardbutton-save-128.png"
+ "images/standardbutton-save-16.png"
+ "images/standardbutton-save-32.png"
+ "images/standardbutton-yes-128.png"
+ "images/standardbutton-yes-16.png"
+ "images/standardbutton-yes-32.png"
+ "images/stop-24.png"
+ "images/stop-32.png"
+ "images/titlebar-contexthelp-16.png"
+ "images/titlebar-contexthelp-32.png"
+ "images/titlebar-contexthelp-48.png"
+ "images/titlebar-max-16.png"
+ "images/titlebar-max-32.png"
+ "images/titlebar-max-48.png"
+ "images/titlebar-min-16.png"
+ "images/titlebar-min-32.png"
+ "images/titlebar-min-48.png"
+ "images/titlebar-shade-16.png"
+ "images/titlebar-shade-32.png"
+ "images/titlebar-shade-48.png"
+ "images/titlebar-unshade-16.png"
+ "images/titlebar-unshade-32.png"
+ "images/titlebar-unshade-48.png"
+ "images/toolbar-ext-h-16.png"
+ "images/toolbar-ext-h-32.png"
+ "images/toolbar-ext-h-8.png"
+ "images/toolbar-ext-h-rtl-16.png"
+ "images/toolbar-ext-h-rtl-32.png"
+ "images/toolbar-ext-h-rtl-8.png"
+ "images/toolbar-ext-v-10.png"
+ "images/toolbar-ext-v-20.png"
+ "images/toolbar-ext-v-5.png"
+ "images/trash-128.png"
+ "images/trash-16.png"
+ "images/trash-32.png"
+ "images/up-128.png"
+ "images/up-16.png"
+ "images/up-32.png"
+ "images/viewdetailed-128.png"
+ "images/viewdetailed-16.png"
+ "images/viewdetailed-32.png"
+ "images/viewlist-128.png"
+ "images/viewlist-16.png"
+ "images/viewlist-32.png"
+)
+
+qt_add_resource(Widgets "qstyle"
+ PREFIX
+ "/qt-project.org/styles/commonstyle"
+ BASE
+ "styles"
+ FILES
+ ${qstyle_resource_files}
+)
+set_source_files_properties("styles/images/closedock-down-macstyle-16.png"
+ PROPERTIES QT_RESOURCE_ALIAS "images/closedock-down-16.png"
+)
+set_source_files_properties("styles/images/closedock-macstyle-16.png"
+ PROPERTIES QT_RESOURCE_ALIAS "images/closedock-16.png"
+)
+set_source_files_properties("styles/images/dockdock-down-macstyle-16.png"
+ PROPERTIES QT_RESOURCE_ALIAS "images/dockdock-down-16.png"
+)
+set_source_files_properties("styles/images/dockdock-macstyle-16.png"
+ PROPERTIES QT_RESOURCE_ALIAS "images/dockdock-16.png"
+)
+set_source_files_properties("styles/images/toolbar-ext-macstyle.png"
+ PROPERTIES QT_RESOURCE_ALIAS "images/toolbar-ext.png"
+)
+set_source_files_properties("styles/images/toolbar-ext-macstyle@2x.png"
+ PROPERTIES QT_RESOURCE_ALIAS "images/toolbar-ext@2x.png"
+)
+set(qstyle1_resource_files
+ "images/closedock-down-macstyle-16.png"
+ "images/closedock-macstyle-16.png"
+ "images/dockdock-down-macstyle-16.png"
+ "images/dockdock-macstyle-16.png"
+ "images/toolbar-ext-macstyle.png"
+ "images/toolbar-ext-macstyle@2x.png"
+)
+
+qt_add_resource(Widgets "qstyle1"
+ PREFIX
+ "/qt-project.org/styles/macstyle"
+ BASE
+ "styles"
+ FILES
+ ${qstyle1_resource_files}
+)
+
+if(QT_FEATURE_reduce_relocations AND UNIX AND GCC)
+ target_link_options(Widgets PRIVATE
+ "LINKER:--dynamic-list=${CMAKE_CURRENT_LIST_DIR}/QtWidgets.dynlist")
+endif()
+
+#### Keys ignored in scope 1:.:.:widgets.pro:<TRUE>:
+# MODULE_CONFIG = "uic"
+# QMAKE_LIBS = "$$QMAKE_LIBS_GUI"
+
+## Scopes:
+#####################################################################
+
+qt_extend_target(Widgets CONDITION MSVC AND (TEST_architecture_arch STREQUAL "i386")
+ LINK_OPTIONS
+ "/BASE:0x65000000"
+)
+
+qt_extend_target(Widgets CONDITION APPLE_OSX
+ SOURCES
+ kernel/qmacgesturerecognizer.cpp kernel/qmacgesturerecognizer_p.h
+ widgets/qmaccocoaviewcontainer_mac.h widgets/qmaccocoaviewcontainer_mac.mm
+ widgets/qmacnativewidget_mac.h widgets/qmacnativewidget_mac.mm
+ LIBRARIES
+ ${FWAppKit}
+ z
+)
+
+qt_extend_target(Widgets CONDITION WIN32 AND NOT WINRT
+ LIBRARIES
+ dwmapi
+ shell32
+ uxtheme
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_graphicseffect
+ SOURCES
+ effects/qgraphicseffect.cpp effects/qgraphicseffect.h effects/qgraphicseffect_p.h
+ effects/qpixmapfilter.cpp effects/qpixmapfilter_p.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_action
+ SOURCES
+ kernel/qaction.cpp kernel/qaction.h kernel/qaction_p.h
+ kernel/qactiongroup.cpp kernel/qactiongroup.h
+ kernel/qwidgetaction.cpp kernel/qwidgetaction.h kernel/qwidgetaction_p.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_formlayout
+ SOURCES
+ kernel/qformlayout.cpp kernel/qformlayout.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_shortcut
+ SOURCES
+ kernel/qshortcut.cpp kernel/qshortcut.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_tooltip
+ SOURCES
+ kernel/qtooltip.cpp kernel/qtooltip.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_whatsthis
+ SOURCES
+ kernel/qwhatsthis.cpp kernel/qwhatsthis.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_animation
+ SOURCES
+ styles/qstyleanimation.cpp styles/qstyleanimation_p.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_style_windows
+ SOURCES
+ styles/qwindowsstyle.cpp styles/qwindowsstyle_p.h
+ styles/qwindowsstyle_p_p.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_style_fusion
+ SOURCES
+ styles/qfusionstyle.cpp styles/qfusionstyle_p.h
+ styles/qfusionstyle_p_p.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_abstractbutton
+ SOURCES
+ widgets/qabstractbutton.cpp widgets/qabstractbutton.h widgets/qabstractbutton_p.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_abstractslider
+ SOURCES
+ widgets/qabstractslider.cpp widgets/qabstractslider.h widgets/qabstractslider_p.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_buttongroup
+ SOURCES
+ widgets/qbuttongroup.cpp widgets/qbuttongroup.h widgets/qbuttongroup_p.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_calendarwidget
+ SOURCES
+ widgets/qcalendarwidget.cpp widgets/qcalendarwidget.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_checkbox
+ SOURCES
+ widgets/qcheckbox.cpp widgets/qcheckbox.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_combobox
+ SOURCES
+ widgets/qcombobox.cpp widgets/qcombobox.h widgets/qcombobox_p.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_commandlinkbutton
+ SOURCES
+ widgets/qcommandlinkbutton.cpp widgets/qcommandlinkbutton.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_datetimeedit
+ SOURCES
+ widgets/qdatetimeedit.cpp widgets/qdatetimeedit.h widgets/qdatetimeedit_p.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_dial
+ SOURCES
+ widgets/qdial.cpp widgets/qdial.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_dockwidget
+ SOURCES
+ widgets/qdockarealayout.cpp widgets/qdockarealayout_p.h
+ widgets/qdockwidget.cpp widgets/qdockwidget.h widgets/qdockwidget_p.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_effects
+ SOURCES
+ widgets/qeffects.cpp widgets/qeffects_p.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_fontcombobox
+ SOURCES
+ widgets/qfontcombobox.cpp widgets/qfontcombobox.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_groupbox
+ SOURCES
+ widgets/qgroupbox.cpp widgets/qgroupbox.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_keysequenceedit
+ SOURCES
+ widgets/qkeysequenceedit.cpp widgets/qkeysequenceedit.h widgets/qkeysequenceedit_p.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_label
+ SOURCES
+ widgets/qlabel.cpp widgets/qlabel.h widgets/qlabel_p.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_lcdnumber
+ SOURCES
+ widgets/qlcdnumber.cpp widgets/qlcdnumber.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_lineedit
+ SOURCES
+ widgets/qlineedit.cpp widgets/qlineedit.h widgets/qlineedit_p.cpp widgets/qlineedit_p.h
+ widgets/qwidgetlinecontrol.cpp widgets/qwidgetlinecontrol_p.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_mainwindow
+ SOURCES
+ widgets/qmainwindow.cpp widgets/qmainwindow.h
+ widgets/qmainwindowlayout.cpp widgets/qmainwindowlayout_p.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_mdiarea
+ SOURCES
+ widgets/qmdiarea.cpp widgets/qmdiarea.h widgets/qmdiarea_p.h
+ widgets/qmdisubwindow.cpp widgets/qmdisubwindow.h widgets/qmdisubwindow_p.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_menu
+ SOURCES
+ widgets/qmenu.cpp widgets/qmenu.h widgets/qmenu_p.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_menubar
+ SOURCES
+ widgets/qmenubar.cpp widgets/qmenubar.h widgets/qmenubar_p.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_progressbar
+ SOURCES
+ widgets/qprogressbar.cpp widgets/qprogressbar.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_pushbutton
+ SOURCES
+ widgets/qpushbutton.cpp widgets/qpushbutton.h widgets/qpushbutton_p.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_radiobutton
+ SOURCES
+ widgets/qradiobutton.cpp widgets/qradiobutton.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_resizehandler
+ SOURCES
+ widgets/qwidgetresizehandler.cpp widgets/qwidgetresizehandler_p.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_dialogbuttonbox
+ SOURCES
+ widgets/qdialogbuttonbox.cpp widgets/qdialogbuttonbox.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_rubberband
+ SOURCES
+ widgets/qrubberband.cpp widgets/qrubberband.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_scrollarea
+ SOURCES
+ widgets/qscrollarea.cpp widgets/qscrollarea.h widgets/qscrollarea_p.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_scrollbar
+ SOURCES
+ widgets/qscrollbar.cpp widgets/qscrollbar.h widgets/qscrollbar_p.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_sizegrip
+ SOURCES
+ widgets/qsizegrip.cpp widgets/qsizegrip.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_slider
+ SOURCES
+ widgets/qslider.cpp widgets/qslider.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_spinbox
+ SOURCES
+ widgets/qabstractspinbox.cpp widgets/qabstractspinbox.h widgets/qabstractspinbox_p.h
+ widgets/qspinbox.cpp widgets/qspinbox.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_splashscreen
+ SOURCES
+ widgets/qsplashscreen.cpp widgets/qsplashscreen.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_splitter
+ SOURCES
+ widgets/qsplitter.cpp widgets/qsplitter.h widgets/qsplitter_p.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_stackedwidget
+ SOURCES
+ widgets/qstackedwidget.cpp widgets/qstackedwidget.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_statusbar
+ SOURCES
+ widgets/qstatusbar.cpp widgets/qstatusbar.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_tabbar
+ SOURCES
+ widgets/qtabbar.cpp widgets/qtabbar.h widgets/qtabbar_p.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_textedit
+ SOURCES
+ widgets/qplaintextedit.cpp widgets/qplaintextedit.h widgets/qplaintextedit_p.h
+ widgets/qtextedit.cpp widgets/qtextedit.h widgets/qtextedit_p.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_textbrowser
+ SOURCES
+ widgets/qtextbrowser.cpp widgets/qtextbrowser.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_tabwidget
+ SOURCES
+ widgets/qtabwidget.cpp widgets/qtabwidget.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_toolbar
+ SOURCES
+ widgets/qtoolbar.cpp widgets/qtoolbar.h widgets/qtoolbar_p.h
+ widgets/qtoolbararealayout.cpp widgets/qtoolbararealayout_p.h
+ widgets/qtoolbarlayout.cpp widgets/qtoolbarlayout_p.h
+ widgets/qtoolbarseparator.cpp widgets/qtoolbarseparator_p.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_toolbox
+ SOURCES
+ widgets/qtoolbox.cpp widgets/qtoolbox.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_toolbutton
+ SOURCES
+ widgets/qtoolbarextension.cpp widgets/qtoolbarextension_p.h
+ widgets/qtoolbutton.cpp widgets/qtoolbutton.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_widgettextcontrol
+ SOURCES
+ widgets/qwidgettextcontrol.cpp widgets/qwidgettextcontrol_p.h
+ widgets/qwidgettextcontrol_p_p.h
+)
+
+qt_extend_target(Widgets CONDITION APPLE_OSX AND (QT_FEATURE_menu OR QT_FEATURE_menubar)
+ SOURCES
+ widgets/qmenu_mac.mm
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_colordialog
+ SOURCES
+ dialogs/qcolordialog.cpp dialogs/qcolordialog.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_dialog
+ SOURCES
+ dialogs/qdialog.cpp dialogs/qdialog.h dialogs/qdialog_p.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_errormessage
+ SOURCES
+ dialogs/qerrormessage.cpp dialogs/qerrormessage.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_filedialog
+ SOURCES
+ dialogs/qfiledialog.cpp dialogs/qfiledialog.h dialogs/qfiledialog.ui dialogs/qfiledialog_p.h
+ dialogs/qsidebar.cpp dialogs/qsidebar_p.h
+ ENABLE_AUTOGEN_TOOLS
+ uic
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_filesystemmodel
+ SOURCES
+ dialogs/qfileinfogatherer.cpp dialogs/qfileinfogatherer_p.h
+ dialogs/qfilesystemmodel.cpp dialogs/qfilesystemmodel.h dialogs/qfilesystemmodel_p.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_fontdialog
+ SOURCES
+ dialogs/qfontdialog.cpp dialogs/qfontdialog.h dialogs/qfontdialog_p.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_fscompleter
+ SOURCES
+ dialogs/qfscompleter_p.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_inputdialog
+ SOURCES
+ dialogs/qinputdialog.cpp dialogs/qinputdialog.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_messagebox
+ SOURCES
+ dialogs/qmessagebox.cpp dialogs/qmessagebox.h
+)
+
+if(QT_FEATURE_messagebox)
+ # Resources:
+ set(qmessagebox_resource_files
+ "images/qtlogo-64.png"
+ )
+
+ qt_add_resource(Widgets "qmessagebox"
+ PREFIX
+ "/qt-project.org/qmessagebox"
+ BASE
+ "dialogs"
+ FILES
+ ${qmessagebox_resource_files}
+ )
+endif()
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_progressdialog
+ SOURCES
+ dialogs/qprogressdialog.cpp dialogs/qprogressdialog.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_wizard
+ SOURCES
+ dialogs/qwizard.cpp dialogs/qwizard.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_wizard AND WIN32
+ SOURCES
+ dialogs/qwizard_win.cpp dialogs/qwizard_win_p.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_accessibility
+ SOURCES
+ accessible/complexwidgets.cpp accessible/complexwidgets_p.h
+ accessible/qaccessiblemenu.cpp accessible/qaccessiblemenu_p.h
+ accessible/qaccessiblewidget.cpp accessible/qaccessiblewidget.h
+ accessible/qaccessiblewidgetfactory.cpp accessible/qaccessiblewidgetfactory_p.h
+ accessible/qaccessiblewidgets.cpp accessible/qaccessiblewidgets_p.h
+ accessible/rangecontrols.cpp accessible/rangecontrols_p.h
+ accessible/simplewidgets.cpp accessible/simplewidgets_p.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_accessibility AND QT_FEATURE_itemviews
+ SOURCES
+ accessible/itemviews.cpp accessible/itemviews_p.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_itemviews
+ SOURCES
+ itemviews/qabstractitemdelegate.cpp itemviews/qabstractitemdelegate.h itemviews/qabstractitemdelegate_p.h
+ itemviews/qabstractitemview.cpp itemviews/qabstractitemview.h itemviews/qabstractitemview_p.h
+ itemviews/qbsptree.cpp itemviews/qbsptree_p.h
+ itemviews/qheaderview.cpp itemviews/qheaderview.h itemviews/qheaderview_p.h
+ itemviews/qitemdelegate.cpp itemviews/qitemdelegate.h
+ itemviews/qitemeditorfactory.cpp itemviews/qitemeditorfactory.h itemviews/qitemeditorfactory_p.h
+ itemviews/qstyleditemdelegate.cpp itemviews/qstyleditemdelegate.h
+ itemviews/qwidgetitemdata_p.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_columnview
+ SOURCES
+ itemviews/qcolumnview.cpp itemviews/qcolumnview.h itemviews/qcolumnview_p.h
+ itemviews/qcolumnviewgrip.cpp itemviews/qcolumnviewgrip_p.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_datawidgetmapper
+ SOURCES
+ itemviews/qdatawidgetmapper.cpp itemviews/qdatawidgetmapper.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_dirmodel
+ SOURCES
+ itemviews/qdirmodel.cpp itemviews/qdirmodel.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_listview
+ SOURCES
+ itemviews/qlistview.cpp itemviews/qlistview.h itemviews/qlistview_p.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_listwidget
+ SOURCES
+ itemviews/qlistwidget.cpp itemviews/qlistwidget.h itemviews/qlistwidget_p.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_tableview
+ SOURCES
+ itemviews/qtableview.cpp itemviews/qtableview.h itemviews/qtableview_p.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_tablewidget
+ SOURCES
+ itemviews/qtablewidget.cpp itemviews/qtablewidget.h itemviews/qtablewidget_p.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_treeview
+ SOURCES
+ itemviews/qtreeview.cpp itemviews/qtreeview.h itemviews/qtreeview_p.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_treewidget
+ SOURCES
+ itemviews/qtreewidget.cpp itemviews/qtreewidget.h itemviews/qtreewidget_p.h
+ itemviews/qtreewidgetitemiterator.cpp itemviews/qtreewidgetitemiterator.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_graphicsview
+ SOURCES
+ graphicsview/qgraph_p.h
+ graphicsview/qgraphicsanchorlayout.cpp graphicsview/qgraphicsanchorlayout.h graphicsview/qgraphicsanchorlayout_p.cpp graphicsview/qgraphicsanchorlayout_p.h
+ graphicsview/qgraphicsgridlayout.cpp graphicsview/qgraphicsgridlayout.h
+ graphicsview/qgraphicsgridlayoutengine.cpp graphicsview/qgraphicsgridlayoutengine_p.h
+ graphicsview/qgraphicsitem.cpp graphicsview/qgraphicsitem.h graphicsview/qgraphicsitem_p.h
+ graphicsview/qgraphicslayout.cpp graphicsview/qgraphicslayout.h graphicsview/qgraphicslayout_p.cpp graphicsview/qgraphicslayout_p.h
+ graphicsview/qgraphicslayoutitem.cpp graphicsview/qgraphicslayoutitem.h graphicsview/qgraphicslayoutitem_p.h
+ graphicsview/qgraphicslayoutstyleinfo.cpp graphicsview/qgraphicslayoutstyleinfo_p.h
+ graphicsview/qgraphicslinearlayout.cpp graphicsview/qgraphicslinearlayout.h
+ graphicsview/qgraphicsproxywidget.cpp graphicsview/qgraphicsproxywidget.h graphicsview/qgraphicsproxywidget_p.h
+ graphicsview/qgraphicsscene.cpp graphicsview/qgraphicsscene.h graphicsview/qgraphicsscene_p.h
+ graphicsview/qgraphicsscene_bsp.cpp graphicsview/qgraphicsscene_bsp_p.h
+ graphicsview/qgraphicsscenebsptreeindex.cpp graphicsview/qgraphicsscenebsptreeindex_p.h
+ graphicsview/qgraphicssceneevent.cpp graphicsview/qgraphicssceneevent.h
+ graphicsview/qgraphicssceneindex.cpp graphicsview/qgraphicssceneindex_p.h
+ graphicsview/qgraphicsscenelinearindex.cpp graphicsview/qgraphicsscenelinearindex_p.h
+ graphicsview/qgraphicstransform.cpp graphicsview/qgraphicstransform.h graphicsview/qgraphicstransform_p.h
+ graphicsview/qgraphicsview.cpp graphicsview/qgraphicsview.h graphicsview/qgraphicsview_p.h
+ graphicsview/qgraphicswidget.cpp graphicsview/qgraphicswidget.h graphicsview/qgraphicswidget_p.cpp graphicsview/qgraphicswidget_p.h
+ graphicsview/qsimplex_p.cpp graphicsview/qsimplex_p.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_easingcurve AND QT_FEATURE_graphicsview
+ SOURCES
+ graphicsview/qgraphicsitemanimation.cpp graphicsview/qgraphicsitemanimation.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_completer
+ SOURCES
+ util/qcompleter.cpp util/qcompleter.h util/qcompleter_p.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_scroller
+ SOURCES
+ util/qflickgesture.cpp util/qflickgesture_p.h
+ util/qscroller.cpp util/qscroller.h util/qscroller_p.h
+ util/qscrollerproperties.cpp util/qscrollerproperties.h util/qscrollerproperties_p.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_undocommand
+ SOURCES
+ util/qundostack.cpp util/qundostack.h util/qundostack_p.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_undogroup
+ SOURCES
+ util/qundogroup.cpp util/qundogroup.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_undoview
+ SOURCES
+ util/qundoview.cpp util/qundoview.h
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_xcb
+ SOURCES
+ util/qsystemtrayicon_x11.cpp
+)
+
+qt_extend_target(Widgets CONDITION NOT QT_FEATURE_xcb
+ SOURCES
+ util/qsystemtrayicon_qpa.cpp
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_statemachine
+ SOURCES
+ statemachine/qguistatemachine.cpp
+)
+
+qt_extend_target(Widgets CONDITION QT_FEATURE_qeventtransition
+ SOURCES
+ statemachine/qbasickeyeventtransition.cpp statemachine/qbasickeyeventtransition_p.h
+ statemachine/qbasicmouseeventtransition.cpp statemachine/qbasicmouseeventtransition_p.h
+ statemachine/qkeyeventtransition.cpp statemachine/qkeyeventtransition.h
+ statemachine/qmouseeventtransition.cpp statemachine/qmouseeventtransition.h
+)
+
+
+qt_create_tracepoints(Widgets qtwidgets.tracepoints)
+qt_add_docs(Widgets
+ doc/qtwidgets.qdocconf
+)
+
diff --git a/src/widgets/Qt5WidgetsConfigExtras.cmake.in b/src/widgets/Qt5WidgetsConfigExtras.cmake.in
deleted file mode 100644
index 236d1d4159..0000000000
--- a/src/widgets/Qt5WidgetsConfigExtras.cmake.in
+++ /dev/null
@@ -1,30 +0,0 @@
-
-if (NOT TARGET Qt5::uic)
- add_executable(Qt5::uic IMPORTED)
-
-!!IF isEmpty(CMAKE_BIN_DIR_IS_ABSOLUTE)
- set(imported_location \"${_qt5Widgets_install_prefix}/$${CMAKE_BIN_DIR}uic$$CMAKE_BIN_SUFFIX\")
-!!ELSE
- set(imported_location \"$${CMAKE_BIN_DIR}uic$$CMAKE_BIN_SUFFIX\")
-!!ENDIF
- _qt5_Widgets_check_file_exists(${imported_location})
-
- set_target_properties(Qt5::uic PROPERTIES
- IMPORTED_LOCATION ${imported_location}
- )
-endif()
-
-include(\"${CMAKE_CURRENT_LIST_DIR}/Qt5Widgets_AccessibleFactory.cmake\" OPTIONAL)
-
-set(Qt5Widgets_UIC_EXECUTABLE Qt5::uic)
-
-# Create versionless tool targets.
-foreach(__qt_tool uic)
- if(NOT \"${QT_NO_CREATE_VERSIONLESS_TARGETS}\" AND NOT TARGET Qt::${__qt_tool}
- AND TARGET Qt5::${__qt_tool})
- add_executable(Qt::${__qt_tool} IMPORTED)
- get_target_property(__qt_imported_location Qt5::${__qt_tool} IMPORTED_LOCATION)
- set_target_properties(Qt::${__qt_tool}
- PROPERTIES IMPORTED_LOCATION \"${__qt_imported_location}\")
- endif()
-endforeach()
diff --git a/src/widgets/Qt5WidgetsMacros.cmake b/src/widgets/Qt6WidgetsMacros.cmake
index 35d2a2dc54..aa8133ba47 100644
--- a/src/widgets/Qt5WidgetsMacros.cmake
+++ b/src/widgets/Qt6WidgetsMacros.cmake
@@ -39,9 +39,9 @@
include(CMakeParseArguments)
-# qt5_wrap_ui(outfiles inputfile ... )
+# qt6_wrap_ui(outfiles inputfile ... )
-function(qt5_wrap_ui outfiles )
+function(qt6_wrap_ui outfiles )
set(options)
set(oneValueArgs)
set(multiValueArgs OPTIONS)
@@ -56,7 +56,8 @@ function(qt5_wrap_ui outfiles )
get_filename_component(infile ${it} ABSOLUTE)
set(outfile ${CMAKE_CURRENT_BINARY_DIR}/ui_${outfile}.h)
add_custom_command(OUTPUT ${outfile}
- COMMAND ${Qt5Widgets_UIC_EXECUTABLE}
+ DEPENDS ${QT_CMAKE_EXPORT_NAMESPACE}::uic
+ COMMAND ${QT_CMAKE_EXPORT_NAMESPACE}::uic
ARGS ${ui_options} -o ${outfile} ${infile}
MAIN_DEPENDENCY ${infile} VERBATIM)
set_source_files_properties(${infile} PROPERTIES SKIP_AUTOUIC ON)
diff --git a/src/widgets/accessible/qaccessiblewidget.cpp b/src/widgets/accessible/qaccessiblewidget.cpp
index 68ad855c7c..1a7372728d 100644
--- a/src/widgets/accessible/qaccessiblewidget.cpp
+++ b/src/widgets/accessible/qaccessiblewidget.cpp
@@ -41,7 +41,6 @@
#ifndef QT_NO_ACCESSIBILITY
-#include "qaction.h"
#include "qapplication.h"
#if QT_CONFIG(groupbox)
#include "qgroupbox.h"
diff --git a/src/widgets/accessible/rangecontrols.cpp b/src/widgets/accessible/rangecontrols.cpp
index b5b8608418..6c12b553b4 100644
--- a/src/widgets/accessible/rangecontrols.cpp
+++ b/src/widgets/accessible/rangecontrols.cpp
@@ -254,7 +254,6 @@ QAccessibleSpinBox::QAccessibleSpinBox(QWidget *w)
{
Q_ASSERT(spinBox());
addControllingSignal(QLatin1String("valueChanged(int)"));
- addControllingSignal(QLatin1String("valueChanged(QString)"));
}
/*!
@@ -272,7 +271,6 @@ QAccessibleDoubleSpinBox::QAccessibleDoubleSpinBox(QWidget *widget)
{
Q_ASSERT(qobject_cast<QDoubleSpinBox *>(widget));
addControllingSignal(QLatin1String("valueChanged(double)"));
- addControllingSignal(QLatin1String("valueChanged(QString)"));
}
/*!
diff --git a/src/widgets/configure.cmake b/src/widgets/configure.cmake
new file mode 100644
index 0000000000..25af8aea8a
--- /dev/null
+++ b/src/widgets/configure.cmake
@@ -0,0 +1,563 @@
+
+
+#### Inputs
+
+
+
+#### Libraries
+
+qt_find_package(GTK3 PROVIDED_TARGETS PkgConfig::GTK3)
+
+
+#### Tests
+
+
+
+#### Features
+
+qt_feature("gtk3" PRIVATE
+ LABEL "GTK+"
+ AUTODETECT NOT APPLE
+ CONDITION QT_FEATURE_glib AND GTK3_FOUND
+)
+qt_feature("style-fusion" PRIVATE
+ LABEL "Fusion"
+)
+qt_feature("style-mac" PRIVATE
+ LABEL "macOS"
+ CONDITION APPLE_OSX AND QT_FEATURE_animation
+)
+qt_feature("style-windows" PRIVATE
+ LABEL "Windows"
+)
+qt_feature("style-windowsvista" PRIVATE
+ LABEL "WindowsVista"
+ CONDITION QT_FEATURE_style_windows AND QT_FEATURE_animation AND WIN32 AND NOT WINRT
+)
+qt_feature("style-android" PRIVATE
+ LABEL "Android"
+ AUTODETECT ANDROID
+)
+qt_feature("style-stylesheet" PUBLIC
+ SECTION "Styles"
+ LABEL "QStyleSheetStyle"
+ PURPOSE "Provides a widget style which is configurable via CSS."
+ CONDITION QT_FEATURE_style_windows AND QT_FEATURE_properties AND QT_FEATURE_cssparser
+)
+qt_feature_definition("style-stylesheet" "QT_NO_STYLE_STYLESHEET" NEGATE VALUE "1")
+qt_feature("effects" PRIVATE
+ SECTION "Kernel"
+ LABEL "Effects"
+ PURPOSE "Provides special widget effects (e.g. fading and scrolling)."
+)
+qt_feature("filesystemmodel" PUBLIC
+ SECTION "File I/O"
+ LABEL "QFileSystemModel"
+ PURPOSE "Provides a data model for the local filesystem."
+ CONDITION QT_FEATURE_itemmodel
+)
+qt_feature_definition("filesystemmodel" "QT_NO_FILESYSTEMMODEL" NEGATE VALUE "1")
+qt_feature("itemviews" PUBLIC
+ SECTION "ItemViews"
+ LABEL "The Model/View Framework"
+ PURPOSE "Provides the model/view architecture managing the relationship between data and the way it is presented to the user."
+ CONDITION QT_FEATURE_itemmodel AND QT_FEATURE_scrollarea
+)
+qt_feature_definition("itemviews" "QT_NO_ITEMVIEWS" NEGATE VALUE "1")
+qt_feature("treewidget" PUBLIC
+ SECTION "Widgets"
+ LABEL "QTreeWidget"
+ PURPOSE "Provides views using tree models."
+ CONDITION QT_FEATURE_treeview
+)
+qt_feature_definition("treewidget" "QT_NO_TREEWIDGET" NEGATE VALUE "1")
+qt_feature("listwidget" PUBLIC
+ SECTION "Widgets"
+ LABEL "QListWidget"
+ PURPOSE "Provides item-based list widgets."
+ CONDITION QT_FEATURE_listview
+)
+qt_feature_definition("listwidget" "QT_NO_LISTWIDGET" NEGATE VALUE "1")
+qt_feature("tablewidget" PUBLIC
+ SECTION "Widgets"
+ LABEL "QTableWidget"
+ PURPOSE "Provides item-based table views."
+ CONDITION QT_FEATURE_tableview
+)
+qt_feature_definition("tablewidget" "QT_NO_TABLEWIDGET" NEGATE VALUE "1")
+qt_feature("abstractbutton" PUBLIC
+ SECTION "Widgets"
+ LABEL "QAbstractButton"
+ PURPOSE "Abstract base class of button widgets, providing functionality common to buttons."
+)
+qt_feature("commandlinkbutton" PUBLIC
+ SECTION "Widgets"
+ LABEL "QCommandLinkButton"
+ PURPOSE "Provides a Vista style command link button."
+ CONDITION QT_FEATURE_pushbutton
+)
+qt_feature("datetimeedit" PUBLIC
+ SECTION "Widgets"
+ LABEL "QDateTimeEdit"
+ PURPOSE "Supports editing dates and times."
+ CONDITION QT_FEATURE_calendarwidget AND QT_FEATURE_datestring AND QT_FEATURE_textdate AND QT_FEATURE_datetimeparser
+)
+qt_feature_definition("datetimeedit" "QT_NO_DATETIMEEDIT" NEGATE VALUE "1")
+qt_feature("stackedwidget" PUBLIC
+ SECTION "Widgets"
+ LABEL "QStackedWidget"
+ PURPOSE "Provides stacked widgets."
+)
+qt_feature_definition("stackedwidget" "QT_NO_STACKEDWIDGET" NEGATE VALUE "1")
+qt_feature("textbrowser" PUBLIC
+ SECTION "Widgets"
+ LABEL "QTextBrowser"
+ PURPOSE "Supports HTML document browsing."
+ CONDITION QT_FEATURE_textedit
+)
+qt_feature_definition("textbrowser" "QT_NO_TEXTBROWSER" NEGATE VALUE "1")
+qt_feature("splashscreen" PUBLIC
+ SECTION "Widgets"
+ LABEL "QSplashScreen"
+ PURPOSE "Supports splash screens that can be shown during application startup."
+)
+qt_feature_definition("splashscreen" "QT_NO_SPLASHSCREEN" NEGATE VALUE "1")
+qt_feature("splitter" PUBLIC
+ SECTION "Widgets"
+ LABEL "QSplitter"
+ PURPOSE "Provides user controlled splitter widgets."
+)
+qt_feature_definition("splitter" "QT_NO_SPLITTER" NEGATE VALUE "1")
+qt_feature("widgettextcontrol" PRIVATE
+ SECTION "Widgets"
+ LABEL "QWidgetTextControl"
+ PURPOSE "Provides text control functionality to other widgets."
+)
+qt_feature("label" PUBLIC
+ SECTION "Widgets"
+ LABEL "QLabel"
+ PURPOSE "Provides a text or image display."
+ CONDITION QT_FEATURE_widgettextcontrol
+)
+qt_feature("formlayout" PUBLIC
+ SECTION "Widgets"
+ LABEL "QFormLayout"
+ PURPOSE "Manages forms of input widgets and their associated labels."
+ CONDITION QT_FEATURE_label
+)
+qt_feature("lcdnumber" PUBLIC
+ SECTION "Widgets"
+ LABEL "QLCDNumber"
+ PURPOSE "Provides LCD-like digits."
+)
+qt_feature_definition("lcdnumber" "QT_NO_LCDNUMBER" NEGATE VALUE "1")
+qt_feature("menu" PUBLIC
+ SECTION "Widgets"
+ LABEL "QMenu"
+ PURPOSE "Provides popup-menus."
+ CONDITION QT_FEATURE_action AND QT_FEATURE_pushbutton
+)
+qt_feature_definition("menu" "QT_NO_MENU" NEGATE VALUE "1")
+qt_feature("lineedit" PUBLIC
+ SECTION "Widgets"
+ LABEL "QLineEdit"
+ PURPOSE "Provides single-line edits."
+ CONDITION QT_FEATURE_widgettextcontrol
+)
+qt_feature_definition("lineedit" "QT_NO_LINEEDIT" NEGATE VALUE "1")
+qt_feature("radiobutton" PUBLIC
+ SECTION "Widgets"
+ LABEL "QRadioButton"
+ PURPOSE "Provides a radio button with a text label."
+ CONDITION QT_FEATURE_abstractbutton
+)
+qt_feature("spinbox" PUBLIC
+ SECTION "Widgets"
+ LABEL "QSpinBox"
+ PURPOSE "Provides spin boxes handling integers and discrete sets of values."
+ CONDITION QT_FEATURE_lineedit AND QT_FEATURE_validator
+)
+qt_feature_definition("spinbox" "QT_NO_SPINBOX" NEGATE VALUE "1")
+qt_feature("tabbar" PUBLIC
+ SECTION "Widgets"
+ LABEL "QTabBar"
+ PURPOSE "Provides tab bars, e.g., for use in tabbed dialogs."
+ CONDITION QT_FEATURE_toolbutton
+)
+qt_feature_definition("tabbar" "QT_NO_TABBAR" NEGATE VALUE "1")
+qt_feature("tabwidget" PUBLIC
+ SECTION "Widgets"
+ LABEL "QTabWidget"
+ PURPOSE "Supports stacking tabbed widgets."
+ CONDITION QT_FEATURE_tabbar AND QT_FEATURE_stackedwidget
+)
+qt_feature_definition("tabwidget" "QT_NO_TABWIDGET" NEGATE VALUE "1")
+qt_feature("combobox" PUBLIC
+ SECTION "Widgets"
+ LABEL "QComboBox"
+ PURPOSE "Provides drop-down boxes presenting a list of options to the user."
+ CONDITION QT_FEATURE_lineedit AND QT_FEATURE_standarditemmodel AND QT_FEATURE_listview
+)
+qt_feature_definition("combobox" "QT_NO_COMBOBOX" NEGATE VALUE "1")
+qt_feature("fontcombobox" PUBLIC
+ SECTION "Widgets"
+ LABEL "QFontComboBox"
+ PURPOSE "Provides a combobox that lets the user select a font family."
+ CONDITION QT_FEATURE_combobox AND QT_FEATURE_stringlistmodel
+)
+qt_feature_definition("fontcombobox" "QT_NO_FONTCOMBOBOX" NEGATE VALUE "1")
+qt_feature("checkbox" PUBLIC
+ SECTION "Widgets"
+ LABEL "QCheckBox("
+ PURPOSE "Provides a checkbox with a text label."
+ CONDITION QT_FEATURE_abstractbutton
+)
+qt_feature("pushbutton" PUBLIC
+ SECTION "Widgets"
+ LABEL "QPushButton"
+ PURPOSE "Provides a command button."
+ CONDITION QT_FEATURE_abstractbutton AND QT_FEATURE_action
+)
+qt_feature("toolbutton" PUBLIC
+ SECTION "Widgets"
+ LABEL "QToolButton"
+ PURPOSE "Provides quick-access buttons to commands and options."
+ CONDITION QT_FEATURE_abstractbutton AND QT_FEATURE_action
+)
+qt_feature_definition("toolbutton" "QT_NO_TOOLBUTTON" NEGATE VALUE "1")
+qt_feature("toolbar" PUBLIC
+ SECTION "Widgets"
+ LABEL "QToolBar"
+ PURPOSE "Provides movable panels containing a set of controls."
+ CONDITION QT_FEATURE_mainwindow
+)
+qt_feature_definition("toolbar" "QT_NO_TOOLBAR" NEGATE VALUE "1")
+qt_feature("toolbox" PUBLIC
+ SECTION "Widgets"
+ LABEL "QToolBox"
+ PURPOSE "Provides columns of tabbed widget items."
+ CONDITION QT_FEATURE_toolbutton AND QT_FEATURE_scrollarea
+)
+qt_feature_definition("toolbox" "QT_NO_TOOLBOX" NEGATE VALUE "1")
+qt_feature("groupbox" PUBLIC
+ SECTION "Widgets"
+ LABEL "QGroupBox"
+ PURPOSE "Provides widget grouping boxes with frames."
+)
+qt_feature_definition("groupbox" "QT_NO_GROUPBOX" NEGATE VALUE "1")
+qt_feature("buttongroup" PUBLIC
+ SECTION "Widgets"
+ LABEL "QButtonGroup"
+ PURPOSE "Supports organizing groups of button widgets."
+ CONDITION QT_FEATURE_abstractbutton AND QT_FEATURE_groupbox
+)
+qt_feature_definition("buttongroup" "QT_NO_BUTTONGROUP" NEGATE VALUE "1")
+qt_feature("mainwindow" PUBLIC
+ SECTION "Widgets"
+ LABEL "QMainWindow"
+ PURPOSE "Provides main application windows."
+ CONDITION QT_FEATURE_menu AND QT_FEATURE_resizehandler AND QT_FEATURE_toolbutton
+)
+qt_feature_definition("mainwindow" "QT_NO_MAINWINDOW" NEGATE VALUE "1")
+qt_feature("dockwidget" PUBLIC
+ SECTION "Widgets"
+ LABEL "QDockwidget"
+ PURPOSE "Supports docking widgets inside a QMainWindow or floated as a top-level window on the desktop."
+ CONDITION QT_FEATURE_mainwindow
+)
+qt_feature_definition("dockwidget" "QT_NO_DOCKWIDGET" NEGATE VALUE "1")
+qt_feature("mdiarea" PUBLIC
+ SECTION "Widgets"
+ LABEL "QMdiArea"
+ PURPOSE "Provides an area in which MDI windows are displayed."
+ CONDITION QT_FEATURE_scrollarea
+)
+qt_feature_definition("mdiarea" "QT_NO_MDIAREA" NEGATE VALUE "1")
+qt_feature("resizehandler" PUBLIC
+ SECTION "Widgets"
+ LABEL "QWidgetResizeHandler"
+ PURPOSE "Provides an internal resize handler for dock widgets."
+)
+qt_feature_definition("resizehandler" "QT_NO_RESIZEHANDLER" NEGATE VALUE "1")
+qt_feature("statusbar" PUBLIC
+ SECTION "Widgets"
+ LABEL "QStatusBar"
+ PURPOSE "Supports presentation of status information."
+)
+qt_feature_definition("statusbar" "QT_NO_STATUSBAR" NEGATE VALUE "1")
+qt_feature("menubar" PUBLIC
+ SECTION "Widgets"
+ LABEL "QMenuBar"
+ PURPOSE "Provides pull-down menu items."
+ CONDITION QT_FEATURE_menu AND QT_FEATURE_toolbutton
+)
+qt_feature_definition("menubar" "QT_NO_MENUBAR" NEGATE VALUE "1")
+qt_feature("contextmenu" PUBLIC
+ SECTION "Widgets"
+ LABEL "Context menus"
+ PURPOSE "Adds pop-up menus on right mouse click to numerous widgets."
+ CONDITION QT_FEATURE_menu
+)
+qt_feature_definition("contextmenu" "QT_NO_CONTEXTMENU" NEGATE VALUE "1")
+qt_feature("progressbar" PUBLIC
+ SECTION "Widgets"
+ LABEL "QProgressBar"
+ PURPOSE "Supports presentation of operation progress."
+)
+qt_feature_definition("progressbar" "QT_NO_PROGRESSBAR" NEGATE VALUE "1")
+qt_feature("abstractslider" PUBLIC
+ SECTION "Widgets"
+ LABEL "QAbstractSlider"
+ PURPOSE "Common super class for widgets like QScrollBar, QSlider and QDial."
+)
+qt_feature("slider" PUBLIC
+ SECTION "Widgets"
+ LABEL "QSlider"
+ PURPOSE "Provides sliders controlling a bounded value."
+ CONDITION QT_FEATURE_abstractslider
+)
+qt_feature_definition("slider" "QT_NO_SLIDER" NEGATE VALUE "1")
+qt_feature("scrollbar" PUBLIC
+ SECTION "Widgets"
+ LABEL "QScrollBar"
+ PURPOSE "Provides scrollbars allowing the user access parts of a document that is larger than the widget used to display it."
+ CONDITION QT_FEATURE_slider
+)
+qt_feature_definition("scrollbar" "QT_NO_SCROLLBAR" NEGATE VALUE "1")
+qt_feature("dial" PUBLIC
+ SECTION "Widgets"
+ LABEL "QDial"
+ PURPOSE "Provides a rounded range control, e.g., like a speedometer."
+ CONDITION QT_FEATURE_slider
+)
+qt_feature_definition("dial" "QT_NO_DIAL" NEGATE VALUE "1")
+qt_feature("scrollarea" PUBLIC
+ SECTION "Widgets"
+ LABEL "QScrollArea"
+ PURPOSE "Supports scrolling views onto widgets."
+ CONDITION QT_FEATURE_scrollbar
+)
+qt_feature_definition("scrollarea" "QT_NO_SCROLLAREA" NEGATE VALUE "1")
+qt_feature("scroller" PUBLIC
+ SECTION "Widgets"
+ LABEL "QScroller"
+ PURPOSE "Enables kinetic scrolling for any scrolling widget or graphics item."
+ CONDITION QT_FEATURE_easingcurve
+)
+qt_feature("graphicsview" PUBLIC
+ SECTION "Widgets"
+ LABEL "QGraphicsView"
+ PURPOSE "Provides a canvas/sprite framework."
+ CONDITION QT_FEATURE_scrollarea AND QT_FEATURE_widgettextcontrol
+)
+qt_feature_definition("graphicsview" "QT_NO_GRAPHICSVIEW" NEGATE VALUE "1")
+qt_feature("graphicseffect" PUBLIC
+ SECTION "Widgets"
+ LABEL "QGraphicsEffect"
+ PURPOSE "Provides various graphics effects."
+ CONDITION QT_FEATURE_graphicsview
+)
+qt_feature_definition("graphicseffect" "QT_NO_GRAPHICSEFFECT" NEGATE VALUE "1")
+qt_feature("textedit" PUBLIC
+ SECTION "Widgets"
+ LABEL "QTextEdit"
+ PURPOSE "Supports rich text editing."
+ CONDITION QT_FEATURE_scrollarea AND QT_FEATURE_properties AND QT_FEATURE_widgettextcontrol
+)
+qt_feature_definition("textedit" "QT_NO_TEXTEDIT" NEGATE VALUE "1")
+qt_feature("syntaxhighlighter" PUBLIC
+ SECTION "Widgets"
+ LABEL "QSyntaxHighlighter"
+ PURPOSE "Supports custom syntax highlighting."
+ CONDITION QT_FEATURE_textedit
+)
+qt_feature_definition("syntaxhighlighter" "QT_NO_SYNTAXHIGHLIGHTER" NEGATE VALUE "1")
+qt_feature("rubberband" PUBLIC
+ SECTION "Widgets"
+ LABEL "QRubberBand"
+ PURPOSE "Supports using rubberbands to indicate selections and boundaries."
+)
+qt_feature_definition("rubberband" "QT_NO_RUBBERBAND" NEGATE VALUE "1")
+qt_feature("tooltip" PUBLIC
+ SECTION "Widgets"
+ LABEL "QToolTip"
+ PURPOSE "Supports presentation of tooltips."
+ CONDITION QT_FEATURE_label
+)
+qt_feature_definition("tooltip" "QT_NO_TOOLTIP" NEGATE VALUE "1")
+qt_feature("statustip" PUBLIC
+ SECTION "Widgets"
+ LABEL "Status Tip"
+ PURPOSE "Supports status tip functionality and events."
+)
+qt_feature_definition("statustip" "QT_NO_STATUSTIP" NEGATE VALUE "1")
+qt_feature("sizegrip" PUBLIC
+ SECTION "Widgets"
+ LABEL "QSizeGrip"
+ PURPOSE "Provides corner-grips for resizing top-level windows."
+)
+qt_feature_definition("sizegrip" "QT_NO_SIZEGRIP" NEGATE VALUE "1")
+qt_feature("calendarwidget" PUBLIC
+ SECTION "Widgets"
+ LABEL "QCalendarWidget"
+ PURPOSE "Provides a monthly based calendar widget allowing the user to select a date."
+ CONDITION ( QT_FEATURE_label ) AND ( QT_FEATURE_menu ) AND ( QT_FEATURE_pushbutton ) AND ( QT_FEATURE_spinbox ) AND ( QT_FEATURE_tableview ) AND ( QT_FEATURE_textdate ) AND ( QT_FEATURE_toolbutton )
+)
+qt_feature_definition("calendarwidget" "QT_NO_CALENDARWIDGET" NEGATE VALUE "1")
+qt_feature("keysequenceedit" PUBLIC
+ SECTION "Widgets"
+ LABEL "QKeySequenceEdit"
+ PURPOSE "Provides a widget for editing QKeySequences."
+ CONDITION QT_FEATURE_lineedit AND QT_FEATURE_shortcut
+)
+qt_feature_definition("keysequenceedit" "QT_NO_KEYSEQUENCEEDIT" NEGATE VALUE "1")
+qt_feature("dialog" PUBLIC
+ SECTION "Dialogs"
+ LABEL "QDialog"
+ PURPOSE "Base class of dialog windows."
+)
+qt_feature("dialogbuttonbox" PUBLIC
+ SECTION "Dialogs"
+ LABEL "QDialogButtonBox"
+ PURPOSE "Presents buttons in a layout that is appropriate for the current widget style."
+ CONDITION QT_FEATURE_dialog AND QT_FEATURE_pushbutton
+)
+qt_feature("messagebox" PUBLIC
+ SECTION "Dialogs"
+ LABEL "QMessageBox"
+ PURPOSE "Provides message boxes displaying informative messages and simple questions."
+ CONDITION ( QT_FEATURE_checkbox ) AND ( QT_FEATURE_dialog ) AND ( QT_FEATURE_dialogbuttonbox ) AND ( QT_FEATURE_label ) AND ( QT_FEATURE_pushbutton )
+)
+qt_feature_definition("messagebox" "QT_NO_MESSAGEBOX" NEGATE VALUE "1")
+qt_feature("colordialog" PUBLIC
+ SECTION "Dialogs"
+ LABEL "QColorDialog"
+ PURPOSE "Provides a dialog widget for specifying colors."
+ CONDITION ( QT_FEATURE_dialog ) AND ( QT_FEATURE_dialogbuttonbox ) AND ( QT_FEATURE_label ) AND ( QT_FEATURE_pushbutton ) AND ( QT_FEATURE_spinbox )
+)
+qt_feature_definition("colordialog" "QT_NO_COLORDIALOG" NEGATE VALUE "1")
+qt_feature("filedialog" PUBLIC
+ SECTION "Dialogs"
+ LABEL "QFileDialog"
+ PURPOSE "Provides a dialog widget for selecting files or directories."
+ CONDITION ( QT_FEATURE_buttongroup ) AND ( QT_FEATURE_combobox ) AND ( QT_FEATURE_dialog ) AND ( QT_FEATURE_dialogbuttonbox ) AND ( QT_FEATURE_dirmodel ) AND ( QT_FEATURE_label ) AND ( QT_FEATURE_proxymodel ) AND ( QT_FEATURE_splitter ) AND ( QT_FEATURE_stackedwidget ) AND ( QT_FEATURE_treeview ) AND ( QT_FEATURE_toolbutton )
+)
+qt_feature_definition("filedialog" "QT_NO_FILEDIALOG" NEGATE VALUE "1")
+qt_feature("fontdialog" PUBLIC
+ SECTION "Dialogs"
+ LABEL "QFontDialog"
+ PURPOSE "Provides a dialog widget for selecting fonts."
+ CONDITION ( QT_FEATURE_checkbox ) AND ( QT_FEATURE_combobox ) AND ( QT_FEATURE_dialog ) AND ( QT_FEATURE_dialogbuttonbox ) AND ( QT_FEATURE_groupbox ) AND ( QT_FEATURE_label ) AND ( QT_FEATURE_pushbutton ) AND ( QT_FEATURE_stringlistmodel ) AND ( QT_FEATURE_validator )
+)
+qt_feature_definition("fontdialog" "QT_NO_FONTDIALOG" NEGATE VALUE "1")
+qt_feature("progressdialog" PUBLIC
+ SECTION "Dialogs"
+ LABEL "QProgressDialog"
+ PURPOSE "Provides feedback on the progress of a slow operation."
+ CONDITION ( QT_FEATURE_dialog ) AND ( QT_FEATURE_label ) AND ( QT_FEATURE_pushbutton ) AND ( QT_FEATURE_progressbar )
+)
+qt_feature_definition("progressdialog" "QT_NO_PROGRESSDIALOG" NEGATE VALUE "1")
+qt_feature("inputdialog" PUBLIC
+ SECTION "Dialogs"
+ LABEL "QInputDialog"
+ PURPOSE "Provides a simple convenience dialog to get a single value from the user."
+ CONDITION ( QT_FEATURE_combobox ) AND ( QT_FEATURE_dialog ) AND ( QT_FEATURE_dialogbuttonbox ) AND ( QT_FEATURE_label ) AND ( QT_FEATURE_pushbutton ) AND ( QT_FEATURE_spinbox ) AND ( QT_FEATURE_stackedwidget ) AND ( QT_FEATURE_textedit )
+)
+qt_feature_definition("inputdialog" "QT_NO_INPUTDIALOG" NEGATE VALUE "1")
+qt_feature("errormessage" PUBLIC
+ SECTION "Dialogs"
+ LABEL "QErrorMessage"
+ PURPOSE "Provides an error message display dialog."
+ CONDITION ( QT_FEATURE_checkbox ) AND ( QT_FEATURE_dialog ) AND ( QT_FEATURE_textedit ) AND ( QT_FEATURE_label ) AND ( QT_FEATURE_pushbutton ) AND ( QT_FEATURE_textedit )
+)
+qt_feature_definition("errormessage" "QT_NO_ERRORMESSAGE" NEGATE VALUE "1")
+qt_feature("wizard" PUBLIC
+ SECTION "Dialogs"
+ LABEL "QWizard"
+ PURPOSE "Provides a framework for multi-page click-through dialogs."
+ CONDITION ( QT_FEATURE_dialog ) AND ( QT_FEATURE_pushbutton ) AND ( QT_FEATURE_properties ) AND ( QT_FEATURE_label )
+)
+qt_feature_definition("wizard" "QT_NO_WIZARD" NEGATE VALUE "1")
+qt_feature("dirmodel" PUBLIC
+ SECTION "ItemViews"
+ LABEL "QDirModel"
+ PURPOSE "Provides a data model for the local filesystem."
+ CONDITION QT_FEATURE_itemviews AND QT_FEATURE_filesystemmodel
+)
+qt_feature_definition("dirmodel" "QT_NO_DIRMODEL" NEGATE VALUE "1")
+qt_feature("listview" PUBLIC
+ SECTION "ItemViews"
+ LABEL "QListView"
+ PURPOSE "Provides a list or icon view onto a model."
+ CONDITION QT_FEATURE_itemviews
+)
+qt_feature_definition("listview" "QT_NO_LISTVIEW" NEGATE VALUE "1")
+qt_feature("tableview" PUBLIC
+ SECTION "ItemViews"
+ LABEL "QTableView"
+ PURPOSE "Provides a default model/view implementation of a table view."
+ CONDITION QT_FEATURE_itemviews
+)
+qt_feature_definition("tableview" "QT_NO_TABLEVIEW" NEGATE VALUE "1")
+qt_feature("treeview" PUBLIC
+ SECTION "ItemViews"
+ LABEL "QTreeView"
+ PURPOSE "Provides a default model/view implementation of a tree view."
+ CONDITION QT_FEATURE_itemviews
+)
+qt_feature_definition("treeview" "QT_NO_TREEVIEW" NEGATE VALUE "1")
+qt_feature("datawidgetmapper" PUBLIC
+ SECTION "ItemViews"
+ LABEL "QDataWidgetMapper"
+ PURPOSE "Provides mapping between a section of a data model to widgets."
+ CONDITION QT_FEATURE_itemviews AND QT_FEATURE_properties
+)
+qt_feature_definition("datawidgetmapper" "QT_NO_DATAWIDGETMAPPER" NEGATE VALUE "1")
+qt_feature("columnview" PUBLIC
+ SECTION "ItemViews"
+ LABEL "QColumnView"
+ PURPOSE "Provides a model/view implementation of a column view."
+ CONDITION QT_FEATURE_listview
+)
+qt_feature_definition("columnview" "QT_NO_COLUMNVIEW" NEGATE VALUE "1")
+qt_feature("completer" PUBLIC
+ SECTION "Utilities"
+ LABEL "QCompleter"
+ PURPOSE "Provides completions based on an item model."
+ CONDITION QT_FEATURE_proxymodel AND QT_FEATURE_itemviews
+)
+qt_feature_definition("completer" "QT_NO_COMPLETER" NEGATE VALUE "1")
+qt_feature("fscompleter" PUBLIC
+ SECTION "Utilities"
+ LABEL "QFSCompleter"
+ PURPOSE "Provides file name completion in QFileDialog."
+ CONDITION QT_FEATURE_filesystemmodel AND QT_FEATURE_completer
+)
+qt_feature_definition("fscompleter" "QT_NO_FSCOMPLETER" NEGATE VALUE "1")
+qt_feature("undocommand" PUBLIC
+ SECTION "Utilities"
+ LABEL "QUndoCommand"
+ PURPOSE "Applies (redo or) undo of a single change in a document."
+)
+qt_feature_definition("undocommand" "QT_NO_UNDOCOMMAND" NEGATE VALUE "1")
+qt_feature("undostack" PUBLIC
+ SECTION "Utilities"
+ LABEL "QUndoStack"
+ PURPOSE "Provides the ability to (redo or) undo a list of changes in a document."
+ CONDITION QT_FEATURE_undocommand
+)
+qt_feature_definition("undostack" "QT_NO_UNDOSTACK" NEGATE VALUE "1")
+qt_feature("undogroup" PUBLIC
+ SECTION "Utilities"
+ LABEL "QUndoGroup"
+ PURPOSE "Provides the ability to cluster QUndoCommands."
+ CONDITION QT_FEATURE_undostack
+)
+qt_feature_definition("undogroup" "QT_NO_UNDOGROUP" NEGATE VALUE "1")
+qt_feature("undoview" PUBLIC
+ SECTION "Utilities"
+ LABEL "QUndoView"
+ PURPOSE "Provides a widget which shows the contents of an undo stack."
+ CONDITION QT_FEATURE_undostack AND QT_FEATURE_listview
+)
+qt_feature_definition("undoview" "QT_NO_UNDOVIEW" NEGATE VALUE "1")
diff --git a/src/widgets/configure.json b/src/widgets/configure.json
index 0a68f082a2..cab120098a 100644
--- a/src/widgets/configure.json
+++ b/src/widgets/configure.json
@@ -26,14 +26,6 @@
}
},
- "tests": {
- "uxtheme": {
- "label": "uxtheme.h",
- "type": "files",
- "files": [ "uxtheme.h" ]
- }
- },
-
"features": {
"gtk3": {
"label": "GTK+",
@@ -56,7 +48,7 @@
},
"style-windowsvista": {
"label": "WindowsVista",
- "condition": "features.style-windows && features.animation && config.win32 && !config.winrt && tests.uxtheme",
+ "condition": "features.style-windows && features.animation && config.win32 && !config.winrt",
"output": [ "privateFeature", "styles" ]
},
"style-android": {
diff --git a/src/widgets/dialogs/qfiledialog.cpp b/src/widgets/dialogs/qfiledialog.cpp
index af2007a4d1..437ce4a114 100644
--- a/src/widgets/dialogs/qfiledialog.cpp
+++ b/src/widgets/dialogs/qfiledialog.cpp
@@ -49,7 +49,9 @@
#include <qfontmetrics.h>
#include <qaction.h>
#include <qheaderview.h>
-#include <qshortcut.h>
+#if QT_CONFIG(shortcut)
+# include <qshortcut.h>
+#endif
#include <qgridlayout.h>
#if QT_CONFIG(menu)
#include <qmenu.h>
@@ -344,7 +346,9 @@ Q_GLOBAL_STATIC(QUrl, lastVisitedDir)
QT_BEGIN_INCLUDE_NAMESPACE
#include <QMetaEnum>
-#include <qshortcut.h>
+#if QT_CONFIG(shortcut)
+# include <qshortcut.h>
+#endif
QT_END_INCLUDE_NAMESPACE
/*!
@@ -2011,6 +2015,9 @@ QStringList QFileDialog::history() const
Sets the item delegate used to render items in the views in the
file dialog to the given \a delegate.
+ Any existing delegate will be removed, but not deleted. QFileDialog
+ does not take ownership of \a delegate.
+
\warning You should not share the same instance of a delegate between views.
Doing so can cause incorrect or unintuitive editing behavior since each
view connected to a given delegate may receive the \l{QAbstractItemDelegate::}{closeEditor()}
@@ -3118,7 +3125,7 @@ void QFileDialogPrivate::createWidgets()
QObject::connect(qFileDialogUi->buttonBox, SIGNAL(rejected()), q, SLOT(reject()));
qFileDialogUi->lookInCombo->setFileDialogPrivate(this);
- QObject::connect(qFileDialogUi->lookInCombo, SIGNAL(activated(QString)), q, SLOT(_q_goToDirectory(QString)));
+ QObject::connect(qFileDialogUi->lookInCombo, SIGNAL(textActivated(QString)), q, SLOT(_q_goToDirectory(QString)));
qFileDialogUi->lookInCombo->setInsertPolicy(QComboBox::NoInsert);
qFileDialogUi->lookInCombo->setDuplicatesEnabled(false);
@@ -3148,7 +3155,7 @@ void QFileDialogPrivate::createWidgets()
qFileDialogUi->fileTypeCombo->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
QObject::connect(qFileDialogUi->fileTypeCombo, SIGNAL(activated(int)),
q, SLOT(_q_useNameFilter(int)));
- QObject::connect(qFileDialogUi->fileTypeCombo, SIGNAL(activated(QString)),
+ QObject::connect(qFileDialogUi->fileTypeCombo, SIGNAL(textActivated(QString)),
q, SIGNAL(filterSelected(QString)));
qFileDialogUi->listView->setFileDialogPrivate(this);
diff --git a/src/widgets/dialogs/qinputdialog.cpp b/src/widgets/dialogs/qinputdialog.cpp
index eeb0613d79..479e45ff56 100644
--- a/src/widgets/dialogs/qinputdialog.cpp
+++ b/src/widgets/dialogs/qinputdialog.cpp
@@ -300,7 +300,7 @@ void QInputDialogPrivate::ensureComboBox()
comboBox->hide();
QObject::connect(comboBox, SIGNAL(editTextChanged(QString)),
q, SLOT(_q_textChanged(QString)));
- QObject::connect(comboBox, SIGNAL(currentIndexChanged(QString)),
+ QObject::connect(comboBox, SIGNAL(currentTextChanged(QString)),
q, SLOT(_q_textChanged(QString)));
}
}
diff --git a/src/widgets/dialogs/qprogressdialog.cpp b/src/widgets/dialogs/qprogressdialog.cpp
index 40548e22a5..aaa4430c39 100644
--- a/src/widgets/dialogs/qprogressdialog.cpp
+++ b/src/widgets/dialogs/qprogressdialog.cpp
@@ -39,7 +39,9 @@
#include "qprogressdialog.h"
-#include "qshortcut.h"
+#if QT_CONFIG(shortcut)
+# include "qshortcut.h"
+#endif
#include "qpainter.h"
#include "qdrawutil.h"
#include "qlabel.h"
diff --git a/src/widgets/doc/snippets/javastyle.cpp b/src/widgets/doc/snippets/javastyle.cpp
index ca6866376b..1d18b45c37 100644
--- a/src/widgets/doc/snippets/javastyle.cpp
+++ b/src/widgets/doc/snippets/javastyle.cpp
@@ -2130,7 +2130,7 @@ void JavaStyle::drawPrimitive(PrimitiveElement element,
painter->restore();
break;
}
- case PE_IndicatorViewItemCheck: {
+ case PE_IndicatorItemViewItemCheck: {
break;
}
case PE_FrameWindow: {
diff --git a/src/widgets/doc/snippets/qstackedlayout/main.cpp b/src/widgets/doc/snippets/qstackedlayout/main.cpp
index 9c61939dee..181eed87db 100644
--- a/src/widgets/doc/snippets/qstackedlayout/main.cpp
+++ b/src/widgets/doc/snippets/qstackedlayout/main.cpp
@@ -74,7 +74,7 @@ Widget::Widget(QWidget *parent)
pageComboBox->addItem(tr("Page 1"));
pageComboBox->addItem(tr("Page 2"));
pageComboBox->addItem(tr("Page 3"));
- connect(pageComboBox, QOverload<int>::of(&QComboBox::activated),
+ connect(pageComboBox, &QComboBox::activated,
stackedLayout, &QStackedLayout::setCurrentIndex);
//! [1]
diff --git a/src/widgets/doc/snippets/qstackedwidget/main.cpp b/src/widgets/doc/snippets/qstackedwidget/main.cpp
index 077c281830..c68a992332 100644
--- a/src/widgets/doc/snippets/qstackedwidget/main.cpp
+++ b/src/widgets/doc/snippets/qstackedwidget/main.cpp
@@ -74,7 +74,7 @@ Widget::Widget(QWidget *parent)
pageComboBox->addItem(tr("Page 1"));
pageComboBox->addItem(tr("Page 2"));
pageComboBox->addItem(tr("Page 3"));
- connect(pageComboBox, QOverload<int>::of(&QComboBox::activated),
+ connect(pageComboBox, &QComboBox::activated,
stackedWidget, &QStackedWidget::setCurrentIndex);
//! [1] //! [2]
diff --git a/src/widgets/doc/src/graphicsview.qdoc b/src/widgets/doc/src/graphicsview.qdoc
index 33f480b0bf..f1f848d6df 100644
--- a/src/widgets/doc/src/graphicsview.qdoc
+++ b/src/widgets/doc/src/graphicsview.qdoc
@@ -117,7 +117,7 @@
of a scene. You can attach several views to the same scene, to provide
several viewports into the same data set. The view widget is a scroll
area, and provides scroll bars for navigating through large scenes. To
- enable OpenGL support, you can set a QGLWidget as the viewport by
+ enable OpenGL support, you can set a QOpenGLWidget as the viewport by
calling QGraphicsView::setViewport().
\snippet graphicsview.cpp 1
@@ -436,10 +436,10 @@
\section2 OpenGL Rendering
- To enable OpenGL rendering, you simply set a new QGLWidget as the
+ To enable OpenGL rendering, you simply set a new QOpenGLWidget as the
viewport of QGraphicsView by calling QGraphicsView::setViewport(). If
you want OpenGL with antialiasing, you need OpenGL sample buffer
- support (see QGLFormat::sampleBuffers()).
+ support (see QSurfaceFormat::samples()).
Example:
diff --git a/src/widgets/doc/src/widgets-and-layouts/styles.qdoc b/src/widgets/doc/src/widgets-and-layouts/styles.qdoc
index 645da5bca2..faaf4e5479 100644
--- a/src/widgets/doc/src/widgets-and-layouts/styles.qdoc
+++ b/src/widgets/doc/src/widgets-and-layouts/styles.qdoc
@@ -1837,7 +1837,7 @@
item views keep the dimensions on individual sections. Also
note that the delegates may use the style to paint decorations
and frames around items. QItemDelegate, for instance, draws
- \c PE_FrameFocusRect and \c PE_IndicatorViewItemCheck.
+ \c PE_FrameFocusRect and \c PE_IndicatorItemViewItemCheck.
\image javastyle/header.png
diff --git a/src/widgets/effects/qpixmapfilter.cpp b/src/widgets/effects/qpixmapfilter.cpp
index 1f899c2660..705871719f 100644
--- a/src/widgets/effects/qpixmapfilter.cpp
+++ b/src/widgets/effects/qpixmapfilter.cpp
@@ -784,11 +784,11 @@ Q_WIDGETS_EXPORT QImage qt_halfScaled(const QImage &source)
dest.setDevicePixelRatio(source.devicePixelRatioF());
const uchar *src = reinterpret_cast<const uchar*>(const_cast<const QImage &>(srcImage).bits());
- int sx = srcImage.bytesPerLine();
- int sx2 = sx << 1;
+ qsizetype sx = srcImage.bytesPerLine();
+ qsizetype sx2 = sx << 1;
uchar *dst = reinterpret_cast<uchar*>(dest.bits());
- int dx = dest.bytesPerLine();
+ qsizetype dx = dest.bytesPerLine();
int ww = dest.width();
int hh = dest.height();
@@ -806,11 +806,11 @@ Q_WIDGETS_EXPORT QImage qt_halfScaled(const QImage &source)
dest.setDevicePixelRatio(source.devicePixelRatioF());
const uchar *src = reinterpret_cast<const uchar*>(const_cast<const QImage &>(srcImage).bits());
- int sx = srcImage.bytesPerLine();
- int sx2 = sx << 1;
+ qsizetype sx = srcImage.bytesPerLine();
+ qsizetype sx2 = sx << 1;
uchar *dst = reinterpret_cast<uchar*>(dest.bits());
- int dx = dest.bytesPerLine();
+ qsizetype dx = dest.bytesPerLine();
int ww = dest.width();
int hh = dest.height();
@@ -843,11 +843,11 @@ Q_WIDGETS_EXPORT QImage qt_halfScaled(const QImage &source)
dest.setDevicePixelRatio(source.devicePixelRatioF());
const quint32 *src = reinterpret_cast<const quint32*>(const_cast<const QImage &>(srcImage).bits());
- int sx = srcImage.bytesPerLine() >> 2;
- int sx2 = sx << 1;
+ qsizetype sx = srcImage.bytesPerLine() >> 2;
+ qsizetype sx2 = sx << 1;
quint32 *dst = reinterpret_cast<quint32*>(dest.bits());
- int dx = dest.bytesPerLine() >> 2;
+ qsizetype dx = dest.bytesPerLine() >> 2;
int ww = dest.width();
int hh = dest.height();
diff --git a/src/widgets/graphicsview/qgraphicsanchorlayout_p.cpp b/src/widgets/graphicsview/qgraphicsanchorlayout_p.cpp
index af0ee3d38c..c5c24adde3 100644
--- a/src/widgets/graphicsview/qgraphicsanchorlayout_p.cpp
+++ b/src/widgets/graphicsview/qgraphicsanchorlayout_p.cpp
@@ -41,7 +41,6 @@
#include <QtWidgets/qwidget.h>
#include <QtWidgets/qapplication.h>
-#include <QtCore/qlinkedlist.h>
#include <QtCore/qstack.h>
#ifdef QT_DEBUG
diff --git a/src/widgets/graphicsview/qgraphicsgridlayoutengine.cpp b/src/widgets/graphicsview/qgraphicsgridlayoutengine.cpp
index 5797d9e539..3dd1b1652a 100644
--- a/src/widgets/graphicsview/qgraphicsgridlayoutengine.cpp
+++ b/src/widgets/graphicsview/qgraphicsgridlayoutengine.cpp
@@ -42,29 +42,9 @@
#include "qgraphicslayoutitem_p.h"
#include "qgraphicslayout_p.h"
#include "qgraphicswidget.h"
-#include <private/qgraphicswidget_p.h>
QT_BEGIN_NAMESPACE
-bool QGraphicsGridLayoutEngineItem::isHidden() const
-{
- if (QGraphicsItem *item = q_layoutItem->graphicsItem())
- return QGraphicsItemPrivate::get(item)->explicitlyHidden;
- return false;
-}
-
-/*!
- \internal
-
- If this returns true, the layout will arrange just as if the item was never added to the layout.
- (Note that this shouldn't lead to a "double spacing" where the item was hidden)
- ### Qt6: Move to QGraphicsLayoutItem and make virtual
-*/
-bool QGraphicsGridLayoutEngineItem::isIgnored() const
-{
- return isHidden() && !q_layoutItem->sizePolicy().retainSizeWhenHidden();
-}
-
/*
returns \c true if the size policy returns \c true for either hasHeightForWidth()
or hasWidthForHeight()
@@ -83,6 +63,16 @@ Qt::Orientation QGraphicsGridLayoutEngineItem::dynamicConstraintOrientation() co
return Qt::Horizontal;
}
+/*!
+ \internal
+
+ If this returns true, the layout will arrange just as if the item was never added to the layout.
+ (Note that this shouldn't lead to a "double spacing" where the item was hidden)
+*/
+bool QGraphicsGridLayoutEngineItem::isEmpty() const
+{
+ return q_layoutItem->isEmpty();
+}
void QGraphicsGridLayoutEngine::setAlignment(QGraphicsLayoutItem *graphicsLayoutItem, Qt::Alignment alignment)
{
diff --git a/src/widgets/graphicsview/qgraphicsgridlayoutengine_p.h b/src/widgets/graphicsview/qgraphicsgridlayoutengine_p.h
index 2f2c547977..a3e42c7b77 100644
--- a/src/widgets/graphicsview/qgraphicsgridlayoutengine_p.h
+++ b/src/widgets/graphicsview/qgraphicsgridlayoutengine_p.h
@@ -89,10 +89,6 @@ public:
return q_layoutItem->effectiveSizeHint(which, constraint);
}
- bool isHidden() const;
-
- virtual bool isIgnored() const override;
-
virtual void setGeometry(const QRectF &rect) override
{
q_layoutItem->setGeometry(rect);
@@ -101,6 +97,8 @@ public:
virtual bool hasDynamicConstraint() const override;
virtual Qt::Orientation dynamicConstraintOrientation() const override;
+ virtual bool isEmpty() const override;
+
QGraphicsLayoutItem *layoutItem() const { return q_layoutItem; }
protected:
diff --git a/src/widgets/graphicsview/qgraphicsitem.cpp b/src/widgets/graphicsview/qgraphicsitem.cpp
index 38cab60fc2..db5c53a48a 100644
--- a/src/widgets/graphicsview/qgraphicsitem.cpp
+++ b/src/widgets/graphicsview/qgraphicsitem.cpp
@@ -1580,13 +1580,8 @@ QGraphicsItem::~QGraphicsItem()
p->wasDeleted = true;
if (p->declarativeData) {
p->wasDeleted = true; // needed, so that destroying the declarative data does the right thing
- if (static_cast<QAbstractDeclarativeDataImpl*>(p->declarativeData)->ownedByQml1) {
- if (QAbstractDeclarativeData::destroyed_qml1)
- QAbstractDeclarativeData::destroyed_qml1(p->declarativeData, o);
- } else {
- if (QAbstractDeclarativeData::destroyed)
- QAbstractDeclarativeData::destroyed(p->declarativeData, o);
- }
+ if (QAbstractDeclarativeData::destroyed)
+ QAbstractDeclarativeData::destroyed(p->declarativeData, o);
p->declarativeData = nullptr;
p->wasDeleted = false;
}
diff --git a/src/widgets/graphicsview/qgraphicslayoutitem.cpp b/src/widgets/graphicsview/qgraphicslayoutitem.cpp
index 8694dcb36b..2c484321e4 100644
--- a/src/widgets/graphicsview/qgraphicslayoutitem.cpp
+++ b/src/widgets/graphicsview/qgraphicslayoutitem.cpp
@@ -45,6 +45,7 @@
#include "qgraphicslayoutitem_p.h"
#include "qwidget.h"
#include "qgraphicswidget.h"
+#include "qgraphicsitem_p.h"
#include <QtDebug>
@@ -826,6 +827,22 @@ void QGraphicsLayoutItem::updateGeometry()
}
/*!
+ * returns \c true if this item is empty, i.e whether it has no content and
+ * should not occupy any space.
+ *
+ * The default implementation returns true if the item has been hidden unless
+ * its size policy has retainSizeWhenHidden set to \c true
+ */
+bool QGraphicsLayoutItem::isEmpty() const
+{
+ bool isHidden = false;
+ if (QGraphicsItem *item = graphicsItem())
+ isHidden = QGraphicsItemPrivate::get(item)->explicitlyHidden;
+
+ return isHidden && !sizePolicy().retainSizeWhenHidden();
+}
+
+/*!
Returns the parent of this QGraphicsLayoutItem, or \nullptr if there is
no parent, or if the parent does not inherit from QGraphicsLayoutItem
(QGraphicsLayoutItem is often used through multiple inheritance with
diff --git a/src/widgets/graphicsview/qgraphicslayoutitem.h b/src/widgets/graphicsview/qgraphicslayoutitem.h
index 86a0a87361..04905c7654 100644
--- a/src/widgets/graphicsview/qgraphicslayoutitem.h
+++ b/src/widgets/graphicsview/qgraphicslayoutitem.h
@@ -94,6 +94,7 @@ public:
virtual void updateGeometry();
+ virtual bool isEmpty() const;
QGraphicsLayoutItem *parentLayoutItem() const;
void setParentLayoutItem(QGraphicsLayoutItem *parent);
diff --git a/src/widgets/graphicsview/qgraphicsscene.h b/src/widgets/graphicsview/qgraphicsscene.h
index 3ba9bddc32..e459b80970 100644
--- a/src/widgets/graphicsview/qgraphicsscene.h
+++ b/src/widgets/graphicsview/qgraphicsscene.h
@@ -53,7 +53,6 @@ QT_REQUIRE_CONFIG(graphicsview);
QT_BEGIN_NAMESPACE
-template<typename T> class QList;
class QFocusEvent;
class QFont;
class QFontMetrics;
diff --git a/src/widgets/graphicsview/qgraphicssceneindex_p.h b/src/widgets/graphicsview/qgraphicssceneindex_p.h
index b494c52671..e13c2a3cd3 100644
--- a/src/widgets/graphicsview/qgraphicssceneindex_p.h
+++ b/src/widgets/graphicsview/qgraphicssceneindex_p.h
@@ -67,7 +67,6 @@ QT_BEGIN_NAMESPACE
class QGraphicsSceneIndexPrivate;
class QPointF;
class QRectF;
-template<typename T> class QList;
typedef bool (*QGraphicsSceneIndexIntersector)(const QGraphicsItem *item, const QRectF &exposeRect, Qt::ItemSelectionMode mode,
const QTransform &deviceTransform, const void *data);
diff --git a/src/widgets/graphicsview/qgraphicswidget.h b/src/widgets/graphicsview/qgraphicswidget.h
index 8223b921c9..6c5171cc02 100644
--- a/src/widgets/graphicsview/qgraphicswidget.h
+++ b/src/widgets/graphicsview/qgraphicswidget.h
@@ -42,6 +42,9 @@
#include <QtWidgets/qtwidgetsglobal.h>
#include <QtGui/qfont.h>
+#if QT_CONFIG(action)
+# include <QtWidgets/qaction.h>
+#endif
#include <QtWidgets/qgraphicslayoutitem.h>
#include <QtWidgets/qgraphicsitem.h>
#include <QtGui/qpalette.h>
diff --git a/src/widgets/itemviews/qdatawidgetmapper.cpp b/src/widgets/itemviews/qdatawidgetmapper.cpp
index 24039c42f6..74100c077e 100644
--- a/src/widgets/itemviews/qdatawidgetmapper.cpp
+++ b/src/widgets/itemviews/qdatawidgetmapper.cpp
@@ -383,6 +383,9 @@ QAbstractItemModel *QDataWidgetMapper::model() const
data from the model into the widget and from the widget to the model,
using QAbstractItemDelegate::setEditorData() and QAbstractItemDelegate::setModelData().
+ Any existing delegate will be removed, but not deleted. QDataWidgetMapper
+ does not take ownership of \a delegate.
+
The delegate also decides when to apply data and when to change the editor,
using QAbstractItemDelegate::commitData() and QAbstractItemDelegate::closeEditor().
diff --git a/src/widgets/itemviews/qlistwidget.cpp b/src/widgets/itemviews/qlistwidget.cpp
index c9379f9a8a..4aca923151 100644
--- a/src/widgets/itemviews/qlistwidget.cpp
+++ b/src/widgets/itemviews/qlistwidget.cpp
@@ -112,7 +112,7 @@ void QListModel::insert(int row, QListWidgetItem *item)
QList<QListWidgetItem*>::iterator it;
it = sortedInsertionIterator(items.begin(), items.end(),
item->view->sortOrder(), item);
- row = qMax(it - items.begin(), 0);
+ row = qMax<qsizetype>(it - items.begin(), 0);
} else {
if (row < 0)
row = 0;
@@ -398,7 +398,7 @@ void QListModel::ensureSorted(int column, Qt::SortOrder order, int start, int en
--tmpitepos;
lit = tmp.begin() + tmpitepos;
lit = sortedInsertionIterator(lit, tmp.end(), order, item);
- int newRow = qMax(lit - tmp.begin(), 0);
+ int newRow = qMax<qsizetype>(lit - tmp.begin(), 0);
lit = tmp.insert(lit, item);
if (newRow != oldRow) {
changed = true;
diff --git a/src/widgets/itemviews/qtreewidget.cpp b/src/widgets/itemviews/qtreewidget.cpp
index 0d4c391e1c..3bd77b340b 100644
--- a/src/widgets/itemviews/qtreewidget.cpp
+++ b/src/widgets/itemviews/qtreewidget.cpp
@@ -648,7 +648,7 @@ void QTreeModel::ensureSorted(int column, Qt::SortOrder order,
lit = lst.begin() + tmpitepos;
lit = sortedInsertionIterator(lit, lst.end(), order, item);
- int newRow = qMax(lit - lst.begin(), 0);
+ int newRow = qMax<qsizetype>(lit - lst.begin(), 0);
if ((newRow < oldRow) && !(*item < *lst.at(oldRow - 1)) && !(*lst.at(oldRow - 1) < *item ))
newRow = oldRow;
diff --git a/src/widgets/kernel/kernel.pri b/src/widgets/kernel/kernel.pri
index 693af7eb80..a960280959 100644
--- a/src/widgets/kernel/kernel.pri
+++ b/src/widgets/kernel/kernel.pri
@@ -7,9 +7,6 @@ KERNEL_P= kernel
HEADERS += \
kernel/qtwidgetsglobal.h \
kernel/qtwidgetsglobal_p.h \
- kernel/qaction.h \
- kernel/qaction_p.h \
- kernel/qactiongroup.h \
kernel/qapplication.h \
kernel/qapplication_p.h \
kernel/qwidgetrepaintmanager_p.h \
@@ -20,13 +17,10 @@ HEADERS += \
kernel/qlayout_p.h \
kernel/qlayoutengine_p.h \
kernel/qlayoutitem.h \
- kernel/qshortcut.h \
- kernel/qsizepolicy.h \
+ kernel/qsizepolicy.h \
kernel/qstackedlayout.h \
kernel/qwidget.h \
kernel/qwidget_p.h \
- kernel/qwidgetaction.h \
- kernel/qwidgetaction_p.h \
kernel/qgesture.h \
kernel/qgesture_p.h \
kernel/qstandardgestures_p.h \
@@ -38,8 +32,6 @@ HEADERS += \
kernel/qtestsupport_widgets.h
SOURCES += \
- kernel/qaction.cpp \
- kernel/qactiongroup.cpp \
kernel/qapplication.cpp \
kernel/qwidgetrepaintmanager.cpp \
kernel/qboxlayout.cpp \
@@ -47,11 +39,9 @@ SOURCES += \
kernel/qlayout.cpp \
kernel/qlayoutengine.cpp \
kernel/qlayoutitem.cpp \
- kernel/qshortcut.cpp \
kernel/qsizepolicy.cpp \
kernel/qstackedlayout.cpp \
kernel/qwidget.cpp \
- kernel/qwidgetaction.cpp \
kernel/qgesture.cpp \
kernel/qstandardgestures.cpp \
kernel/qgesturerecognizer.cpp \
@@ -67,9 +57,15 @@ macx: {
SOURCES += kernel/qmacgesturerecognizer.cpp
}
-qtConfig(opengl) {
- HEADERS += kernel/qopenglwidget.h
- SOURCES += kernel/qopenglwidget.cpp
+qtConfig(action) {
+ HEADERS += kernel/qaction.h \
+ kernel/qaction_p.h \
+ kernel/qactiongroup.h \
+ kernel/qwidgetaction.h \
+ kernel/qwidgetaction_p.h
+ SOURCES += kernel/qaction.cpp \
+ kernel/qactiongroup.cpp \
+ kernel/qwidgetaction.cpp
}
qtConfig(formlayout) {
@@ -77,6 +73,11 @@ qtConfig(formlayout) {
SOURCES += kernel/qformlayout.cpp
}
+qtConfig(shortcut) {
+ HEADERS += kernel/qshortcut.h
+ SOURCES += kernel/qshortcut.cpp
+}
+
qtConfig(tooltip) {
HEADERS += kernel/qtooltip.h
SOURCES += kernel/qtooltip.cpp
diff --git a/src/widgets/kernel/qaction.cpp b/src/widgets/kernel/qaction.cpp
index 64b0d69f6d..934fe576d1 100644
--- a/src/widgets/kernel/qaction.cpp
+++ b/src/widgets/kernel/qaction.cpp
@@ -40,52 +40,29 @@
#include "qaction.h"
#include "qactiongroup.h"
-#ifndef QT_NO_ACTION
#include "qaction_p.h"
#include "qapplication.h"
#include "qevent.h"
#include "qlist.h"
#include "qstylehints.h"
-#include <private/qshortcutmap_p.h>
+#if QT_CONFIG(shortcut)
+# include <private/qshortcutmap_p.h>
+#endif
#include <private/qguiapplication_p.h>
#if QT_CONFIG(menu)
#include <private/qmenu_p.h>
#endif
#include <private/qdebug_p.h>
-#define QAPP_CHECK(functionName) \
- if (Q_UNLIKELY(!QCoreApplication::instance())) { \
- qWarning("QAction: Initialize Q(Gui)Application before calling '" functionName "'."); \
- return; \
- }
QT_BEGIN_NAMESPACE
-/*
- internal: guesses a descriptive text from a text suited for a menu entry
- */
-static QString qt_strippedText(QString s)
-{
- s.remove(QLatin1String("..."));
- for (int i = 0; i < s.size(); ++i) {
- if (s.at(i) == QLatin1Char('&'))
- s.remove(i, 1);
- }
- return s.trimmed();
-}
-
-
-QActionPrivate::QActionPrivate() :
#if QT_CONFIG(shortcut)
- autorepeat(1),
-#endif
- enabled(1), forceDisabled(0), visible(1), forceInvisible(0), checkable(0),
- checked(0), separator(0), fontSet(false),
- iconVisibleInMenu(-1), shortcutVisibleInContextMenu(-1)
+QShortcutMap::ContextMatcher QActionPrivate::contextMatcher() const
{
+ return qWidgetShortcutContextMatcher;
}
-
-QActionPrivate::~QActionPrivate() = default;
+#endif // QT_CONFIG(shortcut)
bool QActionPrivate::showStatusText(QWidget *widget, const QString &str)
{
@@ -102,84 +79,6 @@ bool QActionPrivate::showStatusText(QWidget *widget, const QString &str)
return false;
}
-void QActionPrivate::sendDataChanged()
-{
- Q_Q(QAction);
- QActionEvent e(QEvent::ActionChanged, q);
- for (int i = 0; i < widgets.size(); ++i) {
- QWidget *w = widgets.at(i);
- QCoreApplication::sendEvent(w, &e);
- }
-#if QT_CONFIG(graphicsview)
- for (int i = 0; i < graphicsWidgets.size(); ++i) {
- QGraphicsWidget *w = graphicsWidgets.at(i);
- QCoreApplication::sendEvent(w, &e);
- }
-#endif
- QCoreApplication::sendEvent(q, &e);
-
- emit q->changed();
-}
-
-#if QT_CONFIG(shortcut)
-void QActionPrivate::redoGrab(QShortcutMap &map)
-{
- Q_Q(QAction);
- if (shortcutId)
- map.removeShortcut(shortcutId, q);
- if (shortcut.isEmpty())
- return;
- shortcutId = map.addShortcut(q, shortcut, shortcutContext, qWidgetShortcutContextMatcher);
- if (!enabled)
- map.setShortcutEnabled(false, shortcutId, q);
- if (!autorepeat)
- map.setShortcutAutoRepeat(false, shortcutId, q);
-}
-
-void QActionPrivate::redoGrabAlternate(QShortcutMap &map)
-{
- Q_Q(QAction);
- for(int i = 0; i < alternateShortcutIds.count(); ++i) {
- if (const int id = alternateShortcutIds.at(i))
- map.removeShortcut(id, q);
- }
- alternateShortcutIds.clear();
- if (alternateShortcuts.isEmpty())
- return;
- for(int i = 0; i < alternateShortcuts.count(); ++i) {
- const QKeySequence& alternate = alternateShortcuts.at(i);
- if (!alternate.isEmpty())
- alternateShortcutIds.append(map.addShortcut(q, alternate, shortcutContext, qWidgetShortcutContextMatcher));
- else
- alternateShortcutIds.append(0);
- }
- if (!enabled) {
- for(int i = 0; i < alternateShortcutIds.count(); ++i) {
- const int id = alternateShortcutIds.at(i);
- map.setShortcutEnabled(false, id, q);
- }
- }
- if (!autorepeat) {
- for(int i = 0; i < alternateShortcutIds.count(); ++i) {
- const int id = alternateShortcutIds.at(i);
- map.setShortcutAutoRepeat(false, id, q);
- }
- }
-}
-
-void QActionPrivate::setShortcutEnabled(bool enable, QShortcutMap &map)
-{
- Q_Q(QAction);
- if (shortcutId)
- map.setShortcutEnabled(enable, shortcutId, q);
- for(int i = 0; i < alternateShortcutIds.count(); ++i) {
- if (const int id = alternateShortcutIds.at(i))
- map.setShortcutEnabled(enable, id, q);
- }
-}
-#endif // QT_NO_SHORTCUT
-
-
/*!
\class QAction
\brief The QAction class provides an abstract user interface
@@ -323,12 +222,26 @@ QAction::QAction(const QIcon &icon, const QString &text, QObject* parent)
\internal
*/
QAction::QAction(QActionPrivate &dd, QObject *parent)
- : QObject(dd, parent)
+ : QGuiAction(dd, parent)
+{
+}
+
+/*!
+ \reimp
+*/
+
+bool QAction::event(QEvent *e)
{
Q_D(QAction);
- d->group = qobject_cast<QActionGroup *>(parent);
- if (d->group)
- d->group->addAction(this);
+ if (e->type() == QEvent::ActionChanged) {
+ for (auto w : qAsConst(d->widgets))
+ QCoreApplication::sendEvent(w, e);
+#if QT_CONFIG(graphicsview)
+ for (auto gw : qAsConst(d->graphicsWidgets))
+ QCoreApplication::sendEvent(gw, e);
+#endif
+ }
+ return QGuiAction::event(e);
}
/*!
@@ -368,190 +281,6 @@ QList<QGraphicsWidget *> QAction::associatedGraphicsWidgets() const
}
#endif
-#if QT_CONFIG(shortcut)
-/*!
- \property QAction::shortcut
- \brief the action's primary shortcut key
-
- Valid keycodes for this property can be found in \l Qt::Key and
- \l Qt::Modifier. There is no default shortcut key.
-*/
-void QAction::setShortcut(const QKeySequence &shortcut)
-{
- QAPP_CHECK("setShortcut");
-
- Q_D(QAction);
- if (d->shortcut == shortcut)
- return;
-
- d->shortcut = shortcut;
- d->redoGrab(QGuiApplicationPrivate::instance()->shortcutMap);
- d->sendDataChanged();
-}
-
-/*!
- \since 4.2
-
- Sets \a shortcuts as the list of shortcuts that trigger the
- action. The first element of the list is the primary shortcut.
-
- \sa shortcut
-*/
-void QAction::setShortcuts(const QList<QKeySequence> &shortcuts)
-{
- Q_D(QAction);
-
- QList <QKeySequence> listCopy = shortcuts;
-
- QKeySequence primary;
- if (!listCopy.isEmpty())
- primary = listCopy.takeFirst();
-
- if (d->shortcut == primary && d->alternateShortcuts == listCopy)
- return;
-
- QAPP_CHECK("setShortcuts");
-
- d->shortcut = primary;
- d->alternateShortcuts = listCopy;
- d->redoGrab(QGuiApplicationPrivate::instance()->shortcutMap);
- d->redoGrabAlternate(QGuiApplicationPrivate::instance()->shortcutMap);
- d->sendDataChanged();
-}
-
-/*!
- \since 4.2
-
- Sets a platform dependent list of shortcuts based on the \a key.
- The result of calling this function will depend on the currently running platform.
- Note that more than one shortcut can assigned by this action.
- If only the primary shortcut is required, use setShortcut instead.
-
- \sa QKeySequence::keyBindings()
-*/
-void QAction::setShortcuts(QKeySequence::StandardKey key)
-{
- QList <QKeySequence> list = QKeySequence::keyBindings(key);
- setShortcuts(list);
-}
-
-/*!
- Returns the primary shortcut.
-
- \sa setShortcuts()
-*/
-QKeySequence QAction::shortcut() const
-{
- Q_D(const QAction);
- return d->shortcut;
-}
-
-/*!
- \since 4.2
-
- Returns the list of shortcuts, with the primary shortcut as
- the first element of the list.
-
- \sa setShortcuts()
-*/
-QList<QKeySequence> QAction::shortcuts() const
-{
- Q_D(const QAction);
- QList <QKeySequence> shortcuts;
- if (!d->shortcut.isEmpty())
- shortcuts << d->shortcut;
- if (!d->alternateShortcuts.isEmpty())
- shortcuts << d->alternateShortcuts;
- return shortcuts;
-}
-
-/*!
- \property QAction::shortcutContext
- \brief the context for the action's shortcut
-
- Valid values for this property can be found in \l Qt::ShortcutContext.
- The default value is Qt::WindowShortcut.
-*/
-void QAction::setShortcutContext(Qt::ShortcutContext context)
-{
- Q_D(QAction);
- if (d->shortcutContext == context)
- return;
- QAPP_CHECK("setShortcutContext");
- d->shortcutContext = context;
- d->redoGrab(QGuiApplicationPrivate::instance()->shortcutMap);
- d->redoGrabAlternate(QGuiApplicationPrivate::instance()->shortcutMap);
- d->sendDataChanged();
-}
-
-Qt::ShortcutContext QAction::shortcutContext() const
-{
- Q_D(const QAction);
- return d->shortcutContext;
-}
-
-/*!
- \property QAction::autoRepeat
- \brief whether the action can auto repeat
- \since 4.2
-
- If true, the action will auto repeat when the keyboard shortcut
- combination is held down, provided that keyboard auto repeat is
- enabled on the system.
- The default value is true.
-*/
-void QAction::setAutoRepeat(bool on)
-{
- Q_D(QAction);
- if (d->autorepeat == on)
- return;
- QAPP_CHECK("setAutoRepeat");
- d->autorepeat = on;
- d->redoGrab(QGuiApplicationPrivate::instance()->shortcutMap);
- d->redoGrabAlternate(QGuiApplicationPrivate::instance()->shortcutMap);
- d->sendDataChanged();
-}
-
-bool QAction::autoRepeat() const
-{
- Q_D(const QAction);
- return d->autorepeat;
-}
-#endif // QT_NO_SHORTCUT
-
-/*!
- \property QAction::font
- \brief the action's font
-
- The font property is used to render the text set on the
- QAction. The font will can be considered a hint as it will not be
- consulted in all cases based upon application and style.
-
- By default, this property contains the application's default font.
-
- \sa QAction::setText(), QStyle
-*/
-void QAction::setFont(const QFont &font)
-{
- Q_D(QAction);
- if (d->font == font)
- return;
-
- d->fontSet = true;
- d->font = font;
- d->sendDataChanged();
-}
-
-QFont QAction::font() const
-{
- Q_D(const QAction);
- return d->font;
-}
-
-
-/*!
- Destroys the object and frees allocated resources.
-*/
QAction::~QAction()
{
Q_D(QAction);
@@ -565,76 +294,17 @@ QAction::~QAction()
w->removeAction(this);
}
#endif
- if (d->group)
- d->group->removeAction(this);
-#if QT_CONFIG(shortcut)
- if (d->shortcutId && qApp) {
- QGuiApplicationPrivate::instance()->shortcutMap.removeShortcut(d->shortcutId, this);
- for(int i = 0; i < d->alternateShortcutIds.count(); ++i) {
- const int id = d->alternateShortcutIds.at(i);
- QGuiApplicationPrivate::instance()->shortcutMap.removeShortcut(id, this);
- }
- }
-#endif
}
/*!
- Sets this action group to \a group. The action will be automatically
- added to the group's list of actions.
-
- Actions within the group will be mutually exclusive.
-
- \sa QActionGroup, QAction::actionGroup()
-*/
-void QAction::setActionGroup(QActionGroup *group)
-{
- Q_D(QAction);
- if(group == d->group)
- return;
+ Returns the action group for this action. If no action group manages
+ this action then \nullptr will be returned.
- if(d->group)
- d->group->removeAction(this);
- d->group = group;
- if(group)
- group->addAction(this);
- d->sendDataChanged();
-}
-
-/*!
- Returns the action group for this action. If no action group manages
- this action then 0 will be returned.
-
- \sa QActionGroup, QAction::setActionGroup()
-*/
+ \sa QActionGroup, QAction::setActionGroup()
+ */
QActionGroup *QAction::actionGroup() const
{
- Q_D(const QAction);
- return d->group;
-}
-
-
-/*!
- \property QAction::icon
- \brief the action's icon
-
- In toolbars, the icon is used as the tool button icon; in menus,
- it is displayed to the left of the menu text. There is no default
- icon.
-
- If a null icon (QIcon::isNull()) is passed into this function,
- the icon of the action is cleared.
-*/
-void QAction::setIcon(const QIcon &icon)
-{
- Q_D(QAction);
- d->icon = icon;
- d->sendDataChanged();
-}
-
-QIcon QAction::icon() const
-{
- Q_D(const QAction);
- return d->icon;
+ return static_cast<QActionGroup *>(guiActionGroup());
}
#if QT_CONFIG(menu)
@@ -667,460 +337,6 @@ void QAction::setMenu(QMenu *menu)
#endif // QT_CONFIG(menu)
/*!
- If \a b is true then this action will be considered a separator.
-
- How a separator is represented depends on the widget it is inserted
- into. Under most circumstances the text, submenu, and icon will be
- ignored for separator actions.
-
- \sa QAction::isSeparator()
-*/
-void QAction::setSeparator(bool b)
-{
- Q_D(QAction);
- if (d->separator == b)
- return;
-
- d->separator = b;
- d->sendDataChanged();
-}
-
-/*!
- Returns \c true if this action is a separator action; otherwise it
- returns \c false.
-
- \sa QAction::setSeparator()
-*/
-bool QAction::isSeparator() const
-{
- Q_D(const QAction);
- return d->separator;
-}
-
-/*!
- \property QAction::text
- \brief the action's descriptive text
-
- If the action is added to a menu, the menu option will consist of
- the icon (if there is one), the text, and the shortcut (if there
- is one). If the text is not explicitly set in the constructor, or
- by using setText(), the action's description icon text will be
- used as text. There is no default text.
-
- \sa iconText
-*/
-void QAction::setText(const QString &text)
-{
- Q_D(QAction);
- if (d->text == text)
- return;
-
- d->text = text;
- d->sendDataChanged();
-}
-
-QString QAction::text() const
-{
- Q_D(const QAction);
- QString s = d->text;
- if(s.isEmpty()) {
- s = d->iconText;
- s.replace(QLatin1Char('&'), QLatin1String("&&"));
- }
- return s;
-}
-
-
-
-
-
-/*!
- \property QAction::iconText
- \brief the action's descriptive icon text
-
- If QToolBar::toolButtonStyle is set to a value that permits text to
- be displayed, the text defined held in this property appears as a
- label in the relevant tool button.
-
- It also serves as the default text in menus and tooltips if the action
- has not been defined with setText() or setToolTip(), and will
- also be used in toolbar buttons if no icon has been defined using setIcon().
-
- If the icon text is not explicitly set, the action's normal text will be
- used for the icon text.
-
- By default, this property contains an empty string.
-
- \sa setToolTip(), setStatusTip()
-*/
-void QAction::setIconText(const QString &text)
-{
- Q_D(QAction);
- if (d->iconText == text)
- return;
-
- d->iconText = text;
- d->sendDataChanged();
-}
-
-QString QAction::iconText() const
-{
- Q_D(const QAction);
- if (d->iconText.isEmpty())
- return qt_strippedText(d->text);
- return d->iconText;
-}
-
-/*!
- \property QAction::toolTip
- \brief the action's tooltip
-
- This text is used for the tooltip. If no tooltip is specified,
- the action's text is used.
-
- By default, this property contains the action's text.
-
- \sa setStatusTip(), setShortcut()
-*/
-void QAction::setToolTip(const QString &tooltip)
-{
- Q_D(QAction);
- if (d->tooltip == tooltip)
- return;
-
- d->tooltip = tooltip;
- d->sendDataChanged();
-}
-
-QString QAction::toolTip() const
-{
- Q_D(const QAction);
- if (d->tooltip.isEmpty()) {
- if (!d->text.isEmpty())
- return qt_strippedText(d->text);
- return qt_strippedText(d->iconText);
- }
- return d->tooltip;
-}
-
-/*!
- \property QAction::statusTip
- \brief the action's status tip
-
- The status tip is displayed on all status bars provided by the
- action's top-level parent widget.
-
- By default, this property contains an empty string.
-
- \sa setToolTip(), showStatusText()
-*/
-void QAction::setStatusTip(const QString &statustip)
-{
- Q_D(QAction);
- if (d->statustip == statustip)
- return;
-
- d->statustip = statustip;
- d->sendDataChanged();
-}
-
-QString QAction::statusTip() const
-{
- Q_D(const QAction);
- return d->statustip;
-}
-
-/*!
- \property QAction::whatsThis
- \brief the action's "What's This?" help text
-
- The "What's This?" text is used to provide a brief description of
- the action. The text may contain rich text. There is no default
- "What's This?" text.
-
- \sa QWhatsThis
-*/
-void QAction::setWhatsThis(const QString &whatsthis)
-{
- Q_D(QAction);
- if (d->whatsthis == whatsthis)
- return;
-
- d->whatsthis = whatsthis;
- d->sendDataChanged();
-}
-
-QString QAction::whatsThis() const
-{
- Q_D(const QAction);
- return d->whatsthis;
-}
-
-/*!
- \enum QAction::Priority
- \since 4.6
-
- This enum defines priorities for actions in user interface.
-
- \value LowPriority The action should not be prioritized in
- the user interface.
-
- \value NormalPriority
-
- \value HighPriority The action should be prioritized in
- the user interface.
-
- \sa priority
-*/
-
-
-/*!
- \property QAction::priority
- \since 4.6
-
- \brief the actions's priority in the user interface.
-
- This property can be set to indicate how the action should be prioritized
- in the user interface.
-
- For instance, when toolbars have the Qt::ToolButtonTextBesideIcon
- mode set, then actions with LowPriority will not show the text
- labels.
-*/
-void QAction::setPriority(Priority priority)
-{
- Q_D(QAction);
- if (d->priority == priority)
- return;
-
- d->priority = priority;
- d->sendDataChanged();
-}
-
-QAction::Priority QAction::priority() const
-{
- Q_D(const QAction);
- return d->priority;
-}
-
-/*!
- \property QAction::checkable
- \brief whether the action is a checkable action
-
- A checkable action is one which has an on/off state. For example,
- in a word processor, a Bold toolbar button may be either on or
- off. An action which is not a toggle action is a command action;
- a command action is simply executed, e.g. file save.
- By default, this property is \c false.
-
- In some situations, the state of one toggle action should depend
- on the state of others. For example, "Left Align", "Center" and
- "Right Align" toggle actions are mutually exclusive. To achieve
- exclusive toggling, add the relevant toggle actions to a
- QActionGroup with the QActionGroup::exclusive property set to
- true.
-
- \sa QAction::setChecked()
-*/
-void QAction::setCheckable(bool b)
-{
- Q_D(QAction);
- if (d->checkable == b)
- return;
-
- d->checkable = b;
- d->checked = false;
- d->sendDataChanged();
-}
-
-bool QAction::isCheckable() const
-{
- Q_D(const QAction);
- return d->checkable;
-}
-
-/*!
- \fn void QAction::toggle()
-
- This is a convenience function for the \l checked property.
- Connect to it to change the checked state to its opposite state.
-*/
-void QAction::toggle()
-{
- Q_D(QAction);
- setChecked(!d->checked);
-}
-
-/*!
- \property QAction::checked
- \brief whether the action is checked.
-
- Only checkable actions can be checked. By default, this is false
- (the action is unchecked).
-
- \note The notifier signal for this property is toggled(). As toggling
- a QAction changes its state, it will also emit a changed() signal.
-
- \sa checkable, toggled()
-*/
-void QAction::setChecked(bool b)
-{
- Q_D(QAction);
- if (!d->checkable || d->checked == b)
- return;
-
- QPointer<QAction> guard(this);
- d->checked = b;
- d->sendDataChanged();
- if (guard)
- emit toggled(b);
-}
-
-bool QAction::isChecked() const
-{
- Q_D(const QAction);
- return d->checked;
-}
-
-/*!
- \fn void QAction::setDisabled(bool b)
-
- This is a convenience function for the \l enabled property, that
- is useful for signals--slots connections. If \a b is true the
- action is disabled; otherwise it is enabled.
-*/
-
-/*!
- \property QAction::enabled
- \brief whether the action is enabled
-
- Disabled actions cannot be chosen by the user. They do not
- disappear from menus or toolbars, but they are displayed in a way
- which indicates that they are unavailable. For example, they might
- be displayed using only shades of gray.
-
- \uicontrol{What's This?} help on disabled actions is still available, provided
- that the QAction::whatsThis property is set.
-
- An action will be disabled when all widgets to which it is added
- (with QWidget::addAction()) are disabled or not visible. When an
- action is disabled, it is not possible to trigger it through its
- shortcut.
-
- By default, this property is \c true (actions are enabled).
-
- \sa text
-*/
-void QAction::setEnabled(bool b)
-{
- Q_D(QAction);
- if (b == d->enabled && b != d->forceDisabled)
- return;
- d->forceDisabled = !b;
- if (b && (!d->visible || (d->group && !d->group->isEnabled())))
- return;
- QAPP_CHECK("setEnabled");
- d->enabled = b;
-#if QT_CONFIG(shortcut)
- d->setShortcutEnabled(b, QGuiApplicationPrivate::instance()->shortcutMap);
-#endif
- d->sendDataChanged();
-}
-
-bool QAction::isEnabled() const
-{
- Q_D(const QAction);
- return d->enabled;
-}
-
-/*!
- \property QAction::visible
- \brief whether the action can be seen (e.g. in menus and toolbars)
-
- If \e visible is true the action can be seen (e.g. in menus and
- toolbars) and chosen by the user; if \e visible is false the
- action cannot be seen or chosen by the user.
-
- Actions which are not visible are \e not grayed out; they do not
- appear at all.
-
- By default, this property is \c true (actions are visible).
-*/
-void QAction::setVisible(bool b)
-{
- Q_D(QAction);
- if (b == d->visible && b != d->forceInvisible)
- return;
- QAPP_CHECK("setVisible");
- d->forceInvisible = !b;
- d->visible = b;
- d->enabled = b && !d->forceDisabled && (!d->group || d->group->isEnabled()) ;
-#if QT_CONFIG(shortcut)
- d->setShortcutEnabled(d->enabled, QGuiApplicationPrivate::instance()->shortcutMap);
-#endif
- d->sendDataChanged();
-}
-
-
-bool QAction::isVisible() const
-{
- Q_D(const QAction);
- return d->visible;
-}
-
-/*!
- \reimp
-*/
-bool
-QAction::event(QEvent *e)
-{
-#if QT_CONFIG(shortcut)
- if (e->type() == QEvent::Shortcut) {
- QShortcutEvent *se = static_cast<QShortcutEvent *>(e);
- Q_ASSERT_X(se->key() == d_func()->shortcut || d_func()->alternateShortcuts.contains(se->key()),
- "QAction::event",
- "Received shortcut event from incorrect shortcut");
- if (se->isAmbiguous())
- qWarning("QAction::event: Ambiguous shortcut overload: %s", se->key().toString(QKeySequence::NativeText).toLatin1().constData());
- else
- activate(Trigger);
- return true;
- }
-#endif
- return QObject::event(e);
-}
-
-/*!
- Returns the user data as set in QAction::setData.
-
- \sa setData()
-*/
-QVariant
-QAction::data() const
-{
- Q_D(const QAction);
- return d->userData;
-}
-
-/*!
- \fn void QAction::setData(const QVariant &userData)
-
- Sets the action's internal data to the given \a userData.
-
- \sa data()
-*/
-void
-QAction::setData(const QVariant &data)
-{
- Q_D(QAction);
- if (d->userData == data)
- return;
- d->userData = data;
- d->sendDataChanged();
-}
-
-
-/*!
Updates the relevant status bar for the \a widget specified by sending a
QStatusTipEvent to its parent widget. Returns \c true if an event was sent;
otherwise returns \c false.
@@ -1135,233 +351,4 @@ QAction::showStatusText(QWidget *widget)
return d_func()->showStatusText(widget, statusTip());
}
-/*!
- Sends the relevant signals for ActionEvent \a event.
-
- Action based widgets use this API to cause the QAction
- to emit signals as well as emitting their own.
-*/
-void QAction::activate(ActionEvent event)
-{
- Q_D(QAction);
- if(event == Trigger) {
- QPointer<QObject> guard = this;
- if(d->checkable) {
- // the checked action of an exclusive group may not be unchecked
- if (d->checked && (d->group
- && d->group->exclusionPolicy() == QActionGroup::ExclusionPolicy::Exclusive
- && d->group->checkedAction() == this)) {
- if (!guard.isNull())
- emit triggered(true);
- return;
- }
- setChecked(!d->checked);
- }
- if (!guard.isNull())
- emit triggered(d->checked);
- } else if(event == Hover) {
- emit hovered();
- }
-}
-
-/*!
- \fn void QAction::triggered(bool checked)
-
- This signal is emitted when an action is activated by the user;
- for example, when the user clicks a menu option, toolbar button,
- or presses an action's shortcut key combination, or when trigger()
- was called. Notably, it is \e not emitted when setChecked() or
- toggle() is called.
-
- If the action is checkable, \a checked is true if the action is
- checked, or false if the action is unchecked.
-
- \sa QAction::activate(), QAction::toggled(), checked
-*/
-
-/*!
- \fn void QAction::toggled(bool checked)
-
- This signal is emitted whenever a checkable action changes its
- isChecked() status. This can be the result of a user interaction,
- or because setChecked() was called. As setChecked() changes the
- QAction, it emits changed() in addition to toggled().
-
- \a checked is true if the action is checked, or false if the
- action is unchecked.
-
- \sa QAction::activate(), QAction::triggered(), checked
-*/
-
-/*!
- \fn void QAction::hovered()
-
- This signal is emitted when an action is highlighted by the user;
- for example, when the user pauses with the cursor over a menu option,
- toolbar button, or presses an action's shortcut key combination.
-
- \sa QAction::activate()
-*/
-
-/*!
- \fn void QAction::changed()
-
- This signal is emitted when an action has changed. If you
- are only interested in actions in a given widget, you can
- watch for QWidget::actionEvent() sent with an
- QEvent::ActionChanged.
-
- \sa QWidget::actionEvent()
-*/
-
-/*!
- \enum QAction::ActionEvent
-
- This enum type is used when calling QAction::activate()
-
- \value Trigger this will cause the QAction::triggered() signal to be emitted.
-
- \value Hover this will cause the QAction::hovered() signal to be emitted.
-*/
-
-/*!
- \property QAction::menuRole
- \brief the action's menu role
- \since 4.2
-
- This indicates what role the action serves in the application menu on
- \macos. By default all actions have the TextHeuristicRole, which means that
- the action is added based on its text (see QMenuBar for more information).
-
- The menu role can only be changed before the actions are put into the menu
- bar in \macos (usually just before the first application window is
- shown).
-*/
-void QAction::setMenuRole(MenuRole menuRole)
-{
- Q_D(QAction);
- if (d->menuRole == menuRole)
- return;
-
- d->menuRole = menuRole;
- d->sendDataChanged();
-}
-
-QAction::MenuRole QAction::menuRole() const
-{
- Q_D(const QAction);
- return d->menuRole;
-}
-
-/*!
- \property QAction::iconVisibleInMenu
- \brief Whether or not an action should show an icon in a menu
- \since 4.4
-
- In some applications, it may make sense to have actions with icons in the
- toolbar, but not in menus. If true, the icon (if valid) is shown in the menu, when it
- is false, it is not shown.
-
- The default is to follow whether the Qt::AA_DontShowIconsInMenus attribute
- is set for the application. Explicitly settings this property overrides
- the presence (or abscence) of the attribute.
-
- For example:
- \snippet code/src_gui_kernel_qaction.cpp 0
-
- \sa QAction::icon, QCoreApplication::setAttribute()
-*/
-void QAction::setIconVisibleInMenu(bool visible)
-{
- Q_D(QAction);
- if (d->iconVisibleInMenu == -1 || visible != bool(d->iconVisibleInMenu)) {
- int oldValue = d->iconVisibleInMenu;
- d->iconVisibleInMenu = visible;
- // Only send data changed if we really need to.
- if (oldValue != -1
- || visible == !QCoreApplication::testAttribute(Qt::AA_DontShowIconsInMenus)) {
- d->sendDataChanged();
- }
- }
-}
-
-bool QAction::isIconVisibleInMenu() const
-{
- Q_D(const QAction);
- if (d->iconVisibleInMenu == -1) {
- return !QCoreApplication::testAttribute(Qt::AA_DontShowIconsInMenus);
- }
- return d->iconVisibleInMenu;
-}
-
-/*!
- \property QAction::shortcutVisibleInContextMenu
- \brief Whether or not an action should show a shortcut in a context menu
- \since 5.10
-
- In some applications, it may make sense to have actions with shortcuts in
- context menus. If true, the shortcut (if valid) is shown when the action is
- shown via a context menu, when it is false, it is not shown.
-
- The default is to follow whether the Qt::AA_DontShowShortcutsInContextMenus attribute
- is set for the application, falling back to the widget style hint.
- Explicitly setting this property overrides the presence (or abscence) of the attribute.
-
- \sa QAction::shortcut, QCoreApplication::setAttribute()
-*/
-void QAction::setShortcutVisibleInContextMenu(bool visible)
-{
- Q_D(QAction);
- if (d->shortcutVisibleInContextMenu == -1 || visible != bool(d->shortcutVisibleInContextMenu)) {
- int oldValue = d->shortcutVisibleInContextMenu;
- d->shortcutVisibleInContextMenu = visible;
- // Only send data changed if we really need to.
- if (oldValue != -1
- || visible == !QCoreApplication::testAttribute(Qt::AA_DontShowShortcutsInContextMenus)) {
- d->sendDataChanged();
- }
- }
-}
-
-bool QAction::isShortcutVisibleInContextMenu() const
-{
- Q_D(const QAction);
- if (d->shortcutVisibleInContextMenu == -1) {
- return !QCoreApplication::testAttribute(Qt::AA_DontShowShortcutsInContextMenus)
- && QGuiApplication::styleHints()->showShortcutsInContextMenus();
- }
- return d->shortcutVisibleInContextMenu;
-}
-
-#ifndef QT_NO_DEBUG_STREAM
-Q_WIDGETS_EXPORT QDebug operator<<(QDebug d, const QAction *action)
-{
- QDebugStateSaver saver(d);
- d.nospace();
- d << "QAction(" << static_cast<const void *>(action);
- if (action) {
- d << " text=" << action->text();
- if (!action->toolTip().isEmpty())
- d << " toolTip=" << action->toolTip();
- if (action->isCheckable())
- d << " checked=" << action->isChecked();
-#if QT_CONFIG(shortcut)
- if (!action->shortcut().isEmpty())
- d << " shortcut=" << action->shortcut();
-#endif
- d << " menuRole=";
- QtDebugUtils::formatQEnum(d, action->menuRole());
- d << " visible=" << action->isVisible();
- } else {
- d << '0';
- }
- d << ')';
- return d;
-}
-#endif // QT_NO_DEBUG_STREAM
-
QT_END_NAMESPACE
-
-#include "moc_qaction.cpp"
-
-#endif // QT_NO_ACTION
diff --git a/src/widgets/kernel/qaction.h b/src/widgets/kernel/qaction.h
index 258a1ea0a0..808ee9065d 100644
--- a/src/widgets/kernel/qaction.h
+++ b/src/widgets/kernel/qaction.h
@@ -41,137 +41,39 @@
#define QACTION_H
#include <QtWidgets/qtwidgetsglobal.h>
-#include <QtGui/qkeysequence.h>
+#include <QtGui/qguiaction.h>
#include <QtCore/qstring.h>
#include <QtWidgets/qwidget.h>
#include <QtCore/qvariant.h>
-#include <QtGui/qicon.h>
-
-QT_BEGIN_NAMESPACE
+QT_REQUIRE_CONFIG(action);
-#ifndef QT_NO_ACTION
+QT_BEGIN_NAMESPACE
class QMenu;
class QActionGroup;
class QActionPrivate;
class QGraphicsWidget;
-class Q_WIDGETS_EXPORT QAction : public QObject
+class Q_WIDGETS_EXPORT QAction : public QGuiAction
{
Q_OBJECT
Q_DECLARE_PRIVATE(QAction)
-
- Q_PROPERTY(bool checkable READ isCheckable WRITE setCheckable NOTIFY changed)
- Q_PROPERTY(bool checked READ isChecked WRITE setChecked NOTIFY toggled)
- Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled NOTIFY changed)
- Q_PROPERTY(QIcon icon READ icon WRITE setIcon NOTIFY changed)
- Q_PROPERTY(QString text READ text WRITE setText NOTIFY changed)
- Q_PROPERTY(QString iconText READ iconText WRITE setIconText NOTIFY changed)
- Q_PROPERTY(QString toolTip READ toolTip WRITE setToolTip NOTIFY changed)
- Q_PROPERTY(QString statusTip READ statusTip WRITE setStatusTip NOTIFY changed)
- Q_PROPERTY(QString whatsThis READ whatsThis WRITE setWhatsThis NOTIFY changed)
- Q_PROPERTY(QFont font READ font WRITE setFont NOTIFY changed)
-#if QT_CONFIG(shortcut)
- Q_PROPERTY(QKeySequence shortcut READ shortcut WRITE setShortcut NOTIFY changed)
- Q_PROPERTY(Qt::ShortcutContext shortcutContext READ shortcutContext WRITE setShortcutContext NOTIFY changed)
- Q_PROPERTY(bool autoRepeat READ autoRepeat WRITE setAutoRepeat NOTIFY changed)
-#endif
- Q_PROPERTY(bool visible READ isVisible WRITE setVisible NOTIFY changed)
- Q_PROPERTY(MenuRole menuRole READ menuRole WRITE setMenuRole NOTIFY changed)
- Q_PROPERTY(bool iconVisibleInMenu READ isIconVisibleInMenu WRITE setIconVisibleInMenu NOTIFY changed)
- Q_PROPERTY(bool shortcutVisibleInContextMenu READ isShortcutVisibleInContextMenu WRITE setShortcutVisibleInContextMenu NOTIFY changed)
- Q_PROPERTY(Priority priority READ priority WRITE setPriority)
-
public:
- // note this is copied into qplatformmenu.h, which must stay in sync
- enum MenuRole { NoRole = 0, TextHeuristicRole, ApplicationSpecificRole, AboutQtRole,
- AboutRole, PreferencesRole, QuitRole };
- Q_ENUM(MenuRole)
- enum Priority { LowPriority = 0,
- NormalPriority = 128,
- HighPriority = 256};
- Q_ENUM(Priority)
- explicit QAction(QObject *parent = nullptr);
- explicit QAction(const QString &text, QObject *parent = nullptr);
- explicit QAction(const QIcon &icon, const QString &text, QObject *parent = nullptr);
-
+ QAction(QObject* parent = nullptr);
+ QAction(const QString &text, QObject* parent = nullptr);
+ QAction(const QIcon &icon, const QString &text, QObject* parent);
~QAction();
- void setActionGroup(QActionGroup *group);
QActionGroup *actionGroup() const;
- void setIcon(const QIcon &icon);
- QIcon icon() const;
-
- void setText(const QString &text);
- QString text() const;
-
- void setIconText(const QString &text);
- QString iconText() const;
-
- void setToolTip(const QString &tip);
- QString toolTip() const;
-
- void setStatusTip(const QString &statusTip);
- QString statusTip() const;
-
- void setWhatsThis(const QString &what);
- QString whatsThis() const;
-
- void setPriority(Priority priority);
- Priority priority() const;
#if QT_CONFIG(menu)
QMenu *menu() const;
void setMenu(QMenu *menu);
#endif
- void setSeparator(bool b);
- bool isSeparator() const;
-
-#if QT_CONFIG(shortcut)
- void setShortcut(const QKeySequence &shortcut);
- QKeySequence shortcut() const;
-
- void setShortcuts(const QList<QKeySequence> &shortcuts);
- void setShortcuts(QKeySequence::StandardKey);
- QList<QKeySequence> shortcuts() const;
-
- void setShortcutContext(Qt::ShortcutContext context);
- Qt::ShortcutContext shortcutContext() const;
-
- void setAutoRepeat(bool);
- bool autoRepeat() const;
-#endif
-
- void setFont(const QFont &font);
- QFont font() const;
-
- void setCheckable(bool);
- bool isCheckable() const;
-
- QVariant data() const;
- void setData(const QVariant &var);
-
- bool isChecked() const;
-
- bool isEnabled() const;
-
- bool isVisible() const;
-
- enum ActionEvent { Trigger, Hover };
- void activate(ActionEvent event);
bool showStatusText(QWidget *widget = nullptr);
- void setMenuRole(MenuRole menuRole);
- MenuRole menuRole() const;
-
- void setIconVisibleInMenu(bool visible);
- bool isIconVisibleInMenu() const;
-
- void setShortcutVisibleInContextMenu(bool show);
- bool isShortcutVisibleInContextMenu() const;
-
QWidget *parentWidget() const;
QList<QWidget *> associatedWidgets() const;
@@ -180,30 +82,14 @@ public:
#endif
protected:
- bool event(QEvent *) override;
QAction(QActionPrivate &dd, QObject *parent);
-
-public Q_SLOTS:
- void trigger() { activate(Trigger); }
- void hover() { activate(Hover); }
- void setChecked(bool);
- void toggle();
- void setEnabled(bool);
- inline void setDisabled(bool b) { setEnabled(!b); }
- void setVisible(bool);
-
-Q_SIGNALS:
- void changed();
- void triggered(bool checked = false);
- void hovered();
- void toggled(bool);
+ bool event(QEvent *) override;
private:
Q_DISABLE_COPY(QAction)
friend class QGraphicsWidget;
friend class QWidget;
- friend class QActionGroup;
friend class QMenu;
friend class QMenuPrivate;
friend class QMenuBar;
@@ -221,8 +107,6 @@ QT_BEGIN_INCLUDE_NAMESPACE
#include <QtWidgets/qactiongroup.h>
QT_END_INCLUDE_NAMESPACE
-#endif // QT_NO_ACTION
-
QT_END_NAMESPACE
#endif // QACTION_H
diff --git a/src/widgets/kernel/qaction_p.h b/src/widgets/kernel/qaction_p.h
index 6b6ca8076f..b865769372 100644
--- a/src/widgets/kernel/qaction_p.h
+++ b/src/widgets/kernel/qaction_p.h
@@ -52,6 +52,7 @@
//
#include <QtWidgets/private/qtwidgetsglobal_p.h>
+#include <QtGui/private/qguiaction_p.h>
#include "QtWidgets/qaction.h"
#if QT_CONFIG(menu)
#include "QtWidgets/qmenu.h"
@@ -68,12 +69,15 @@ QT_BEGIN_NAMESPACE
class QShortcutMap;
-class Q_WIDGETS_EXPORT QActionPrivate : public QObjectPrivate
+class Q_WIDGETS_EXPORT QActionPrivate : public QGuiActionPrivate
{
Q_DECLARE_PUBLIC(QAction)
public:
- QActionPrivate();
- ~QActionPrivate();
+ QActionPrivate() = default;
+
+#if QT_CONFIG(shortcut)
+ QShortcutMap::ContextMatcher contextMatcher() const override;
+#endif
static QActionPrivate *get(QAction *q)
{
@@ -82,50 +86,11 @@ public:
bool showStatusText(QWidget *w, const QString &str);
- QPointer<QActionGroup> group;
- QString text;
- QString iconText;
- QIcon icon;
- QString tooltip;
- QString statustip;
- QString whatsthis;
-#if QT_CONFIG(shortcut)
- QKeySequence shortcut;
- QList<QKeySequence> alternateShortcuts;
-#endif
- QVariant userData;
-#if QT_CONFIG(shortcut)
- int shortcutId = 0;
- QVector<int> alternateShortcutIds;
- Qt::ShortcutContext shortcutContext = Qt::WindowShortcut;
- uint autorepeat : 1;
-#endif
- QFont font;
QPointer<QMenu> menu;
- uint enabled : 1, forceDisabled : 1;
- uint visible : 1, forceInvisible : 1;
- uint checkable : 1;
- uint checked : 1;
- uint separator : 1;
- uint fontSet : 1;
-
- int iconVisibleInMenu : 2; // Only has values -1, 0, and 1
- int shortcutVisibleInContextMenu : 2; // Only has values -1, 0, and 1
-
- QAction::MenuRole menuRole = QAction::TextHeuristicRole;
- QAction::Priority priority = QAction::NormalPriority;
-
QWidgetList widgets;
#if QT_CONFIG(graphicsview)
QList<QGraphicsWidget *> graphicsWidgets;
#endif
-#if QT_CONFIG(shortcut)
- void redoGrab(QShortcutMap &map);
- void redoGrabAlternate(QShortcutMap &map);
- void setShortcutEnabled(bool enable, QShortcutMap &map);
-#endif // QT_NO_SHORTCUT
-
- void sendDataChanged();
};
#endif // QT_NO_ACTION
diff --git a/src/widgets/kernel/qactiongroup.cpp b/src/widgets/kernel/qactiongroup.cpp
index d51fb778c4..cc900cbb0f 100644
--- a/src/widgets/kernel/qactiongroup.cpp
+++ b/src/widgets/kernel/qactiongroup.cpp
@@ -38,70 +38,32 @@
****************************************************************************/
#include "qactiongroup.h"
+#include <QtGui/private/qguiactiongroup_p.h>
-#ifndef QT_NO_ACTION
-
-#include "qaction_p.h"
-#include "qevent.h"
-#include "qlist.h"
+#include "qaction.h"
QT_BEGIN_NAMESPACE
-class QActionGroupPrivate : public QObjectPrivate
+class QActionGroupPrivate : public QGuiActionGroupPrivate
{
Q_DECLARE_PUBLIC(QActionGroup)
public:
- QActionGroupPrivate() : enabled(1),
- visible(1),
- exclusionPolicy(QActionGroup::ExclusionPolicy::Exclusive)
- {
- }
- QList<QAction *> actions;
- QPointer<QAction> current;
- uint enabled : 1;
- uint visible : 1;
- QActionGroup::ExclusionPolicy exclusionPolicy;
-
-private:
- void _q_actionTriggered(); //private slot
- void _q_actionChanged(); //private slot
- void _q_actionHovered(); //private slot
+ void emitSignal(Signal, QGuiAction *) override;
};
-void QActionGroupPrivate::_q_actionChanged()
+void QActionGroupPrivate::emitSignal(Signal s, QGuiAction *action)
{
Q_Q(QActionGroup);
- QAction *action = qobject_cast<QAction*>(q->sender());
- Q_ASSERT_X(action != nullptr, "QActionGroup::_q_actionChanged", "internal error");
- if (exclusionPolicy != QActionGroup::ExclusionPolicy::None) {
- if (action->isChecked()) {
- if (action != current) {
- if(current)
- current->setChecked(false);
- current = action;
- }
- } else if (action == current) {
- current = nullptr;
- }
+ switch (s) {
+ case QGuiActionGroupPrivate::Triggered:
+ emit q->triggered(static_cast<QAction *>(action));
+ break;
+ case QGuiActionGroupPrivate::Hovered:
+ emit q->hovered(static_cast<QAction *>(action));
+ break;
}
}
-void QActionGroupPrivate::_q_actionTriggered()
-{
- Q_Q(QActionGroup);
- QAction *action = qobject_cast<QAction*>(q->sender());
- Q_ASSERT_X(action != nullptr, "QActionGroup::_q_actionTriggered", "internal error");
- emit q->triggered(action);
-}
-
-void QActionGroupPrivate::_q_actionHovered()
-{
- Q_Q(QActionGroup);
- QAction *action = qobject_cast<QAction*>(q->sender());
- Q_ASSERT_X(action != nullptr, "QActionGroup::_q_actionHovered", "internal error");
- emit q->hovered(action);
-}
-
/*!
\class QActionGroup
\brief The QActionGroup class groups actions together.
@@ -154,27 +116,6 @@ void QActionGroupPrivate::_q_actionHovered()
*/
/*!
- \enum QActionGroup::ExclusionPolicy
-
- This enum specifies the different policies that can be used to
- control how the group performs exclusive checking on checkable actions.
-
- \value None
- The actions in the group can be checked independently of each other.
-
- \value Exclusive
- Exactly one action can be checked at any one time.
- This is the default policy.
-
- \value ExclusiveOptional
- At most one action can be checked at any one time. The actions
- can also be all unchecked.
-
- \sa exclusionPolicy
- \since 5.14
-*/
-
-/*!
Constructs an action group for the \a parent object.
The action group is exclusive by default. Call setExclusive(false)
@@ -182,53 +123,24 @@ void QActionGroupPrivate::_q_actionHovered()
but allow unchecking the active action call instead
setExclusionPolicy(QActionGroup::ExclusionPolicy::ExclusiveOptional)
*/
-QActionGroup::QActionGroup(QObject* parent) : QObject(*new QActionGroupPrivate, parent)
+QActionGroup::QActionGroup(QObject* parent) :
+ QGuiActionGroup(*new QActionGroupPrivate, parent)
{
}
/*!
Destroys the action group.
*/
-QActionGroup::~QActionGroup()
+QActionGroup::~QActionGroup() = default;
+
+QAction *QActionGroup::checkedAction() const
{
+ return static_cast<QAction *>(checkedGuiAction());
}
-/*!
- \fn QAction *QActionGroup::addAction(QAction *action)
-
- Adds the \a action to this group, and returns it.
-
- Normally an action is added to a group by creating it with the
- group as its parent, so this function is not usually used.
-
- \sa QAction::setActionGroup()
-*/
-QAction *QActionGroup::addAction(QAction* a)
+QAction *QActionGroup::addAction(QAction *a)
{
- Q_D(QActionGroup);
- if(!d->actions.contains(a)) {
- d->actions.append(a);
- QObject::connect(a, SIGNAL(triggered()), this, SLOT(_q_actionTriggered()));
- QObject::connect(a, SIGNAL(changed()), this, SLOT(_q_actionChanged()));
- QObject::connect(a, SIGNAL(hovered()), this, SLOT(_q_actionHovered()));
- }
- if(!a->d_func()->forceDisabled) {
- a->setEnabled(d->enabled);
- a->d_func()->forceDisabled = false;
- }
- if(!a->d_func()->forceInvisible) {
- a->setVisible(d->visible);
- a->d_func()->forceInvisible = false;
- }
- if(a->isChecked())
- d->current = a;
- QActionGroup *oldGroup = a->d_func()->group;
- if(oldGroup != this) {
- if (oldGroup)
- oldGroup->removeAction(a);
- a->d_func()->group = this;
- a->d_func()->sendDataChanged();
- }
+ QGuiActionGroup::addAction(a);
return a;
}
@@ -261,185 +173,16 @@ QAction *QActionGroup::addAction(const QIcon &icon, const QString &text)
}
/*!
- Removes the \a action from this group. The action will have no
- parent as a result.
-
- \sa QAction::setActionGroup()
-*/
-void QActionGroup::removeAction(QAction *action)
-{
- Q_D(QActionGroup);
- if (d->actions.removeAll(action)) {
- if (action == d->current)
- d->current = nullptr;
- QObject::disconnect(action, SIGNAL(triggered()), this, SLOT(_q_actionTriggered()));
- QObject::disconnect(action, SIGNAL(changed()), this, SLOT(_q_actionChanged()));
- QObject::disconnect(action, SIGNAL(hovered()), this, SLOT(_q_actionHovered()));
- action->d_func()->group = nullptr;
- }
-}
-
-/*!
Returns the list of this groups's actions. This may be empty.
*/
QList<QAction*> QActionGroup::actions() const
{
- Q_D(const QActionGroup);
- return d->actions;
+ QList<QAction*> result;
+ const auto baseActions = guiActions();
+ result.reserve(baseActions.size());
+ for (auto baseAction : baseActions)
+ result.append(static_cast<QAction*>(baseAction));
+ return result;
}
-/*!
- \brief Enable or disable the group exclusion checking
-
- This is a convenience method that calls
- setExclusionPolicy(ExclusionPolicy::Exclusive) when \a b is true,
- else setExclusionPolicy(QActionGroup::ExclusionPolicy::None).
-
- \sa QActionGroup::exclusionPolicy
-*/
-void QActionGroup::setExclusive(bool b)
-{
- setExclusionPolicy(b ? QActionGroup::ExclusionPolicy::Exclusive
- : QActionGroup::ExclusionPolicy::None);
-}
-
-/*!
- \brief Returns true if the group is exclusive
-
- The group is exclusive if the ExclusionPolicy is either Exclusive
- or ExclusionOptional.
-
-*/
-bool QActionGroup::isExclusive() const
-{
- return exclusionPolicy() != QActionGroup::ExclusionPolicy::None;
-}
-
-/*!
- \property QActionGroup::exclusionPolicy
- \brief This property holds the group exclusive checking policy
-
- If exclusionPolicy is set to Exclusive, only one checkable
- action in the action group can ever be active at any time. If the user
- chooses another checkable action in the group, the one they chose becomes
- active and the one that was active becomes inactive. If exclusionPolicy is
- set to ExclusionOptional the group is exclusive but the active checkable
- action in the group can be unchecked leaving the group with no actions
- checked.
-
- \sa QAction::checkable
- \since 5.14
-*/
-void QActionGroup::setExclusionPolicy(QActionGroup::ExclusionPolicy policy)
-{
- Q_D(QActionGroup);
- d->exclusionPolicy = policy;
-}
-
-QActionGroup::ExclusionPolicy QActionGroup::exclusionPolicy() const
-{
- Q_D(const QActionGroup);
- return d->exclusionPolicy;
-}
-
-/*!
- \fn void QActionGroup::setDisabled(bool b)
-
- This is a convenience function for the \l enabled property, that
- is useful for signals--slots connections. If \a b is true the
- action group is disabled; otherwise it is enabled.
-*/
-
-/*!
- \property QActionGroup::enabled
- \brief whether the action group is enabled
-
- Each action in the group will be enabled or disabled unless it
- has been explicitly disabled.
-
- \sa QAction::setEnabled()
-*/
-void QActionGroup::setEnabled(bool b)
-{
- Q_D(QActionGroup);
- d->enabled = b;
- for (auto action : qAsConst(d->actions)) {
- if (!action->d_func()->forceDisabled) {
- action->setEnabled(b);
- action->d_func()->forceDisabled = false;
- }
- }
-}
-
-bool QActionGroup::isEnabled() const
-{
- Q_D(const QActionGroup);
- return d->enabled;
-}
-
-/*!
- Returns the currently checked action in the group, or \nullptr if
- none are checked.
-*/
-QAction *QActionGroup::checkedAction() const
-{
- Q_D(const QActionGroup);
- return d->current;
-}
-
-/*!
- \property QActionGroup::visible
- \brief whether the action group is visible
-
- Each action in the action group will match the visible state of
- this group unless it has been explicitly hidden.
-
- \sa QAction::setEnabled()
-*/
-void QActionGroup::setVisible(bool b)
-{
- Q_D(QActionGroup);
- d->visible = b;
- for (auto action : qAsConst(d->actions)) {
- if (!action->d_func()->forceInvisible) {
- action->setVisible(b);
- action->d_func()->forceInvisible = false;
- }
- }
-}
-
-bool QActionGroup::isVisible() const
-{
- Q_D(const QActionGroup);
- return d->visible;
-}
-
-/*!
- \fn void QActionGroup::triggered(QAction *action)
-
- This signal is emitted when the given \a action in the action
- group is activated by the user; for example, when the user clicks
- a menu option, toolbar button, or presses an action's shortcut key
- combination.
-
- Connect to this signal for command actions.
-
- \sa QAction::activate()
-*/
-
-/*!
- \fn void QActionGroup::hovered(QAction *action)
-
- This signal is emitted when the given \a action in the action
- group is highlighted by the user; for example, when the user
- pauses with the cursor over a menu option, toolbar button, or
- presses an action's shortcut key combination.
-
- \sa QAction::activate()
-*/
-
QT_END_NAMESPACE
-
-#include "moc_qactiongroup.cpp"
-
-#endif // QT_NO_ACTION
diff --git a/src/widgets/kernel/qactiongroup.h b/src/widgets/kernel/qactiongroup.h
index 90f488bedb..0a6a85f093 100644
--- a/src/widgets/kernel/qactiongroup.h
+++ b/src/widgets/kernel/qactiongroup.h
@@ -41,54 +41,31 @@
#define QACTIONGROUP_H
#include <QtWidgets/qtwidgetsglobal.h>
+#include <QtGui/qguiactiongroup.h>
#include <QtWidgets/qaction.h>
-QT_BEGIN_NAMESPACE
-
+QT_REQUIRE_CONFIG(action);
-#ifndef QT_NO_ACTION
+QT_BEGIN_NAMESPACE
class QActionGroupPrivate;
-class Q_WIDGETS_EXPORT QActionGroup : public QObject
+class Q_WIDGETS_EXPORT QActionGroup : public QGuiActionGroup
{
Q_OBJECT
Q_DECLARE_PRIVATE(QActionGroup)
- Q_PROPERTY(QActionGroup::ExclusionPolicy exclusionPolicy READ exclusionPolicy WRITE setExclusionPolicy)
- Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled)
- Q_PROPERTY(bool visible READ isVisible WRITE setVisible)
-
public:
- enum class ExclusionPolicy {
- None,
- Exclusive,
- ExclusiveOptional
- };
- Q_ENUM(ExclusionPolicy)
-
explicit QActionGroup(QObject* parent);
~QActionGroup();
- QAction *addAction(QAction* a);
- QAction *addAction(const QString &text);
- QAction *addAction(const QIcon &icon, const QString &text);
- void removeAction(QAction *a);
- QList<QAction*> actions() const;
-
QAction *checkedAction() const;
- bool isExclusive() const;
- bool isEnabled() const;
- bool isVisible() const;
- ExclusionPolicy exclusionPolicy() const;
+ QAction *addAction(QAction *a);
+ QAction *addAction(const QString &text);
+ QAction *addAction(const QIcon &icon, const QString &text);
-public Q_SLOTS:
- void setEnabled(bool);
- inline void setDisabled(bool b) { setEnabled(!b); }
- void setVisible(bool);
- void setExclusive(bool);
- void setExclusionPolicy(ExclusionPolicy policy);
+ QList<QAction*> actions() const;
Q_SIGNALS:
void triggered(QAction *);
@@ -96,13 +73,8 @@ Q_SIGNALS:
private:
Q_DISABLE_COPY(QActionGroup)
- Q_PRIVATE_SLOT(d_func(), void _q_actionTriggered())
- Q_PRIVATE_SLOT(d_func(), void _q_actionChanged())
- Q_PRIVATE_SLOT(d_func(), void _q_actionHovered())
};
-#endif // QT_NO_ACTION
-
QT_END_NAMESPACE
#endif // QACTIONGROUP_H
diff --git a/src/widgets/kernel/qapplication.h b/src/widgets/kernel/qapplication.h
index 6de72899f1..4ecfe64b60 100644
--- a/src/widgets/kernel/qapplication.h
+++ b/src/widgets/kernel/qapplication.h
@@ -58,7 +58,6 @@ class QDesktopWidget;
class QStyle;
class QEventLoop;
class QIcon;
-template <typename T> class QList;
class QLocale;
class QPlatformNativeInterface;
diff --git a/src/widgets/kernel/qopenglwidget.cpp b/src/widgets/kernel/qopenglwidget.cpp
deleted file mode 100644
index 9b4955320b..0000000000
--- a/src/widgets/kernel/qopenglwidget.cpp
+++ /dev/null
@@ -1,1471 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** 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 The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qopenglwidget.h"
-#include <QtGui/QOpenGLContext>
-#include <QtGui/QOpenGLFramebufferObject>
-#include <QtGui/QOffscreenSurface>
-#include <QtGui/QOpenGLFunctions>
-#include <QtGui/QWindow>
-#include <QtGui/QGuiApplication>
-#include <QtGui/QScreen>
-#include <QtGui/QOpenGLPaintDevice>
-#include <QtGui/qpa/qplatformwindow.h>
-#include <QtGui/qpa/qplatformintegration.h>
-#include <QtGui/private/qguiapplication_p.h>
-#include <QtGui/private/qopenglextensions_p.h>
-#include <QtGui/private/qfont_p.h>
-#include <QtGui/private/qopenglpaintdevice_p.h>
-#include <QtGui/private/qopenglcontext_p.h>
-#include <QtWidgets/private/qwidget_p.h>
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QOpenGLWidget
- \inmodule QtWidgets
- \since 5.4
-
- \brief The QOpenGLWidget class is a widget for rendering OpenGL graphics.
-
- QOpenGLWidget provides functionality for displaying OpenGL graphics
- integrated into a Qt application. It is very simple to use: Make
- your class inherit from it and use the subclass like any other
- QWidget, except that you have the choice between using QPainter and
- standard OpenGL rendering commands.
-
- QOpenGLWidget provides three convenient virtual functions that you
- can reimplement in your subclass to perform the typical OpenGL
- tasks:
-
- \list
- \li paintGL() - Renders the OpenGL scene. Gets called whenever the widget
- needs to be updated.
- \li resizeGL() - Sets up the OpenGL viewport, projection, etc. Gets
- called whenever the widget has been resized (and also when it
- is shown for the first time because all newly created widgets get a
- resize event automatically).
- \li initializeGL() - Sets up the OpenGL resources and state. Gets called
- once before the first time resizeGL() or paintGL() is called.
- \endlist
-
- If you need to trigger a repaint from places other than paintGL() (a
- typical example is when using \l{QTimer}{timers} to animate scenes),
- you should call the widget's update() function to schedule an update.
-
- Your widget's OpenGL rendering context is made current when
- paintGL(), resizeGL(), or initializeGL() is called. If you need to
- call the standard OpenGL API functions from other places (e.g. in
- your widget's constructor or in your own paint functions), you
- must call makeCurrent() first.
-
- All rendering happens into an OpenGL framebuffer
- object. makeCurrent() ensure that it is bound in the context. Keep
- this in mind when creating and binding additional framebuffer
- objects in the rendering code in paintGL(). Never re-bind the
- framebuffer with ID 0. Instead, call defaultFramebufferObject() to
- get the ID that should be bound.
-
- QOpenGLWidget allows using different OpenGL versions and profiles
- when the platform supports it. Just set the requested format via
- setFormat(). Keep in mind however that having multiple QOpenGLWidget
- instances in the same window requires that they all use the same
- format, or at least formats that do not make the contexts
- non-sharable. To overcome this issue, prefer using
- QSurfaceFormat::setDefaultFormat() instead of setFormat().
-
- \note Calling QSurfaceFormat::setDefaultFormat() before constructing
- the QApplication instance is mandatory on some platforms (for example,
- \macos) when an OpenGL core profile context is requested. This is to
- ensure that resource sharing between contexts stays functional as all
- internal contexts are created using the correct version and profile.
-
- \section1 Painting Techniques
-
- As described above, subclass QOpenGLWidget to render pure 3D content in the
- following way:
-
- \list
-
- \li Reimplement the initializeGL() and resizeGL() functions to
- set up the OpenGL state and provide a perspective transformation.
-
- \li Reimplement paintGL() to paint the 3D scene, calling only
- OpenGL functions.
-
- \endlist
-
- It is also possible to draw 2D graphics onto a QOpenGLWidget subclass using QPainter:
-
- \list
-
- \li In paintGL(), instead of issuing OpenGL commands, construct a QPainter
- object for use on the widget.
-
- \li Draw primitives using QPainter's member functions.
-
- \li Direct OpenGL commands can still be issued. However, you must make sure
- these are enclosed by a call to the painter's beginNativePainting() and
- endNativePainting().
-
- \endlist
-
- When performing drawing using QPainter only, it is also possible to perform
- the painting like it is done for ordinary widgets: by reimplementing paintEvent().
-
- \list
-
- \li Reimplement the paintEvent() function.
-
- \li Construct a QPainter object targeting the widget. Either pass the widget to the
- constructor or the QPainter::begin() function.
-
- \li Draw primitives using QPainter's member functions.
-
- \li Painting finishes then the QPainter instance is destroyed. Alternatively,
- call QPainter::end() explicitly.
-
- \endlist
-
- \section1 OpenGL Function Calls, Headers and QOpenGLFunctions
-
- When making OpenGL function calls, it is strongly recommended to avoid calling
- the functions directly. Instead, prefer using QOpenGLFunctions (when making
- portable applications) or the versioned variants (for example,
- QOpenGLFunctions_3_2_Core and similar, when targeting modern, desktop-only
- OpenGL). This way the application will work correctly in all Qt build
- configurations, including the ones that perform dynamic OpenGL implementation
- loading which means applications are not directly linking to an GL
- implementation and thus direct function calls are not feasible.
-
- In paintGL() the current context is always accessible by caling
- QOpenGLContext::currentContext(). From this context an already initialized,
- ready-to-be-used QOpenGLFunctions instance is retrievable by calling
- QOpenGLContext::functions(). An alternative to prefixing every GL call is to
- inherit from QOpenGLFunctions and call
- QOpenGLFunctions::initializeOpenGLFunctions() in initializeGL().
-
- As for the OpenGL headers, note that in most cases there will be no need to
- directly include any headers like GL.h. The OpenGL-related Qt headers will
- include qopengl.h which will in turn include an appropriate header for the
- system. This might be an OpenGL ES 3.x or 2.0 header, the highest version that
- is available, or a system-provided gl.h. In addition, a copy of the extension
- headers (called glext.h on some systems) is provided as part of Qt both for
- OpenGL and OpenGL ES. These will get included automatically on platforms where
- feasible. This means that constants and function pointer typedefs from ARB,
- EXT, OES extensions are automatically available.
-
- \section1 Code Examples
-
- To get started, the simplest QOpenGLWidget subclass could like like the following:
-
- \snippet code/doc_gui_widgets_qopenglwidget.cpp 0
-
- Alternatively, the prefixing of each and every OpenGL call can be avoided by deriving
- from QOpenGLFunctions instead:
-
- \snippet code/doc_gui_widgets_qopenglwidget.cpp 1
-
- To get a context compatible with a given OpenGL version or profile, or to
- request depth and stencil buffers, call setFormat():
-
- \snippet code/doc_gui_widgets_qopenglwidget.cpp 2
-
- With OpenGL 3.0+ contexts, when portability is not important, the versioned
- QOpenGLFunctions variants give easy access to all the modern OpenGL functions
- available in a given version:
-
- \snippet code/doc_gui_widgets_qopenglwidget.cpp 3
-
- As described above, it is simpler and more robust to set the requested format
- globally so that it applies to all windows and contexts during the lifetime of
- the application. Below is an example of this:
-
- \snippet code/doc_gui_widgets_qopenglwidget.cpp 6
-
- \section1 Relation to QGLWidget
-
- The legacy QtOpenGL module (classes prefixed with QGL) provides a widget
- called QGLWidget. QOpenGLWidget is intended to be a modern replacement for
- it. Therefore, especially in new applications, the general recommendation is
- to use QOpenGLWidget.
-
- While the API is very similar, there is an important difference between the
- two: QOpenGLWidget always renders offscreen, using framebuffer
- objects. QGLWidget on the other hand uses a native window and surface. The
- latter causes issues when using it in complex user interfaces since, depending
- on the platform, such native child widgets may have various limitations,
- regarding stacking orders for example. QOpenGLWidget avoids this by not
- creating a separate native window.
-
- Due to being backed by a framebuffer object, the behavior of QOpenGLWidget is
- very similar to QOpenGLWindow with the update behavior set to \c
- PartialUpdateBlit or \c PartialUpdateBlend. This means that the contents are
- preserved between paintGL() calls so that incremental rendering is
- possible. With QGLWidget (and naturally QOpenGLWindow with the default update
- behavior) this is usually not the case because swapping the buffers leaves the
- back buffer with undefined contents.
-
- \note Most applications do not need incremental rendering because they will
- render everything in the view on every paint call. In this case it is
- important to call glClear() as early as possible in paintGL(). This helps
- mobile GPUs that use a tile-based architecture to recognize that the tile
- buffer does not need to be reloaded with the framebuffer's previous
- contents. Omitting the clear call can lead to significant performance drops on
- such systems.
-
- \note Avoid calling winId() on a QOpenGLWidget. This function triggers the creation of
- a native window, resulting in reduced performance and possibly rendering glitches.
-
- \section1 Differences to QGLWidget
-
- Besides the main conceptual difference of being backed by a framebuffer object, there
- are a number of smaller, internal differences between QOpenGLWidget and the older
- QGLWidget:
-
- \list
-
- \li OpenGL state when invoking paintGL(). QOpenGLWidget sets up the viewport via
- glViewport(). It does not perform any clearing.
-
- \li Clearing when starting to paint via QPainter. Unlike regular widgets, QGLWidget
- defaulted to a value of \c true for
- \l{QWidget::autoFillBackground()}{autoFillBackground}. It then performed clearing to the
- palette's background color every time QPainter::begin() was used. QOpenGLWidget does not
- follow this: \l{QWidget::autoFillBackground()}{autoFillBackground} defaults to false,
- like for any other widget. The only exception is when being used as a viewport for other
- widgets like QGraphicsView. In such a case autoFillBackground will be automatically set
- to true to ensure compatibility with QGLWidget-based viewports.
-
- \endlist
-
- \section1 Multisampling
-
- To enable multisampling, set the number of requested samples on the
- QSurfaceFormat that is passed to setFormat(). On systems that do not support
- it the request may get ignored.
-
- Multisampling support requires support for multisampled renderbuffers and
- framebuffer blits. On OpenGL ES 2.0 implementations it is likely that these
- will not be present. This means that multisampling will not be available. With
- modern OpenGL versions and OpenGL ES 3.0 and up this is usually not a problem
- anymore.
-
- \section1 Threading
-
- Performing offscreen rendering on worker threads, for example to generate
- textures that are then used in the GUI/main thread in paintGL(), are supported
- by exposing the widget's QOpenGLContext so that additional contexts sharing
- with it can be created on each thread.
-
- Drawing directly to the QOpenGLWidget's framebuffer outside the GUI/main
- thread is possible by reimplementing paintEvent() to do nothing. The context's
- thread affinity has to be changed via QObject::moveToThread(). After that,
- makeCurrent() and doneCurrent() are usable on the worker thread. Be careful to
- move the context back to the GUI/main thread afterwards.
-
- Unlike QGLWidget, triggering a buffer swap just for the QOpenGLWidget is not
- possible since there is no real, onscreen native surface for it. Instead, it
- is up to the widget stack to manage composition and buffer swaps on the gui
- thread. When a thread is done updating the framebuffer, call update() \b{on
- the GUI/main thread} to schedule composition.
-
- Extra care has to be taken to avoid using the framebuffer when the GUI/main
- thread is performing compositing. The signals aboutToCompose() and
- frameSwapped() will be emitted when the composition is starting and
- ending. They are emitted on the GUI/main thread. This means that by using a
- direct connection aboutToCompose() can block the GUI/main thread until the
- worker thread has finished its rendering. After that, the worker thread must
- perform no further rendering until the frameSwapped() signal is emitted. If
- this is not acceptable, the worker thread has to implement a double buffering
- mechanism. This involves drawing using an alternative render target, that is
- fully controlled by the thread, e.g. an additional framebuffer object, and
- blitting to the QOpenGLWidget's framebuffer at a suitable time.
-
- \section1 Context Sharing
-
- When multiple QOpenGLWidgets are added as children to the same top-level
- widget, their contexts will share with each other. This does not apply for
- QOpenGLWidget instances that belong to different windows.
-
- This means that all QOpenGLWidgets in the same window can access each other's
- sharable resources, like textures, and there is no need for an extra "global
- share" context, as was the case with QGLWidget.
-
- To set up sharing between QOpenGLWidget instances belonging to different
- windows, set the Qt::AA_ShareOpenGLContexts application attribute before
- instantiating QApplication. This will trigger sharing between all
- QOpenGLWidget instances without any further steps.
-
- Creating extra QOpenGLContext instances that share resources like textures
- with the QOpenGLWidget's context is also possible. Simply pass the pointer
- returned from context() to QOpenGLContext::setShareContext() before calling
- QOpenGLContext::create(). The resulting context can also be used on a
- different thread, allowing threaded generation of textures and asynchronous
- texture uploads.
-
- Note that QOpenGLWidget expects a standard conformant implementation of
- resource sharing when it comes to the underlying graphics drivers. For
- example, some drivers, in particular for mobile and embedded hardware, have
- issues with setting up sharing between an existing context and others that are
- created later. Some other drivers may behave in unexpected ways when trying to
- utilize shared resources between different threads.
-
- \section1 Resource Initialization and Cleanup
-
- The QOpenGLWidget's associated OpenGL context is guaranteed to be current
- whenever initializeGL() and paintGL() are invoked. Do not attempt to create
- OpenGL resources before initializeGL() is called. For example, attempting to
- compile shaders, initialize vertex buffer objects or upload texture data will
- fail when done in a subclass's constructor. These operations must be deferred
- to initializeGL(). Some of Qt's OpenGL helper classes, like QOpenGLBuffer or
- QOpenGLVertexArrayObject, have a matching deferred behavior: they can be
- instantiated without a context, but all initialization is deferred until a
- create(), or similar, call. This means that they can be used as normal
- (non-pointer) member variables in a QOpenGLWidget subclass, but the create()
- or similar function can only be called from initializeGL(). Be aware however
- that not all classes are designed like this. When in doubt, make the member
- variable a pointer and create and destroy the instance dynamically in
- initializeGL() and the destructor, respectively.
-
- Releasing the resources also needs the context to be current. Therefore
- destructors that perform such cleanup are expected to call makeCurrent()
- before moving on to destroy any OpenGL resources or wrappers. Avoid deferred
- deletion via \l{QObject::deleteLater()}{deleteLater()} or the parenting
- mechanism of QObject. There is no guarantee the correct context will be
- current at the time the instance in question is really destroyed.
-
- A typical subclass will therefore often look like the following when it comes
- to resource initialization and destruction:
-
- \snippet code/doc_gui_widgets_qopenglwidget.cpp 4
-
- This is naturally not the only possible solution. One alternative is to use
- the \l{QOpenGLContext::aboutToBeDestroyed()}{aboutToBeDestroyed()} signal of
- QOpenGLContext. By connecting a slot, using direct connection, to this signal,
- it is possible to perform cleanup whenever the underlying native context
- handle, or the entire QOpenGLContext instance, is going to be released. The
- following snippet is in principle equivalent to the previous one:
-
- \snippet code/doc_gui_widgets_qopenglwidget.cpp 5
-
- \note For widgets that change their associated top-level window multiple times
- during their lifetime, a combined approach is essential. Whenever the widget
- or a parent of it gets reparented so that the top-level window becomes
- different, the widget's associated context is destroyed and a new one is
- created. This is then followed by a call to initializeGL() where all OpenGL
- resources must get reinitialized. Due to this the only option to perform
- proper cleanup is to connect to the context's aboutToBeDestroyed()
- signal. Note that the context in question may not be the current one when the
- signal gets emitted. Therefore it is good practice to call makeCurrent() in
- the connected slot. Additionally, the same cleanup steps must be performed
- from the derived class' destructor, since the slot connected to the signal
- will not get invoked when the widget is being destroyed.
-
- \note When Qt::AA_ShareOpenGLContexts is set, the widget's context never
- changes, not even when reparenting because the widget's associated texture is
- guaranteed to be accessible also from the new top-level's context.
-
- Proper cleanup is especially important due to context sharing. Even though
- each QOpenGLWidget's associated context is destroyed together with the
- QOpenGLWidget, the sharable resources in that context, like textures, will
- stay valid until the top-level window, in which the QOpenGLWidget lived, is
- destroyed. Additionally, settings like Qt::AA_ShareOpenGLContexts and some Qt
- modules may trigger an even wider scope for sharing contexts, potentially
- leading to keeping the resources in question alive for the entire lifetime of
- the application. Therefore the safest and most robust is always to perform
- explicit cleanup for all resources and resource wrappers used in the
- QOpenGLWidget.
-
- \section1 Limitations
-
- Putting other widgets underneath and making the QOpenGLWidget transparent will
- not lead to the expected results: The widgets underneath will not be
- visible. This is because in practice the QOpenGLWidget is drawn before all
- other regular, non-OpenGL widgets, and so see-through type of solutions are
- not feasible. Other type of layouts, like having widgets on top of the
- QOpenGLWidget, will function as expected.
-
- When absolutely necessary, this limitation can be overcome by setting the
- Qt::WA_AlwaysStackOnTop attribute on the QOpenGLWidget. Be aware however that
- this breaks stacking order, for example it will not be possible to have other
- widgets on top of the QOpenGLWidget, so it should only be used in situations
- where a semi-transparent QOpenGLWidget with other widgets visible underneath
- is required.
-
- Note that this does not apply when there are no other widgets underneath and
- the intention is to have a semi-transparent window. In that case the
- traditional approach of setting Qt::WA_TranslucentBackground
- on the top-level window is sufficient. Note that if the transparent areas are
- only desired in the QOpenGLWidget, then Qt::WA_NoSystemBackground will need
- to be turned back to \c false after enabling Qt::WA_TranslucentBackground.
- Additionally, requesting an alpha channel for the QOpenGLWidget's context via
- setFormat() may be necessary too, depending on the system.
-
- QOpenGLWidget supports multiple update behaviors, just like QOpenGLWindow. In
- preserved mode the rendered content from the previous paintGL() call is
- available in the next one, allowing incremental rendering. In non-preserved
- mode the content is lost and paintGL() implementations are expected to redraw
- everything in the view.
-
- Before Qt 5.5 the default behavior of QOpenGLWidget was to preserve the
- rendered contents between paintGL() calls. Since Qt 5.5 the default behavior
- is non-preserved because this provides better performance and the majority of
- applications have no need for the previous content. This also resembles the
- semantics of an OpenGL-based QWindow and matches the default behavior of
- QOpenGLWindow in that the color and ancillary buffers are invalidated for
- each frame. To restore the preserved behavior, call setUpdateBehavior() with
- \c PartialUpdate.
-
- \section1 Alternatives
-
- Adding a QOpenGLWidget into a window turns on OpenGL-based
- compositing for the entire window. In some special cases this may
- not be ideal, and the old QGLWidget-style behavior with a separate,
- native child window is desired. Desktop applications that understand
- the limitations of this approach (for example when it comes to
- overlaps, transparency, scroll views and MDI areas), can use
- QOpenGLWindow with QWidget::createWindowContainer(). This is a
- modern alternative to QGLWidget and is faster than QOpenGLWidget due
- to the lack of the additional composition step. It is strongly
- recommended to limit the usage of this approach to cases where there
- is no other choice. Note that this option is not suitable for most
- embedded and mobile platforms, and it is known to have issues on
- certain desktop platforms (e.g. \macos) too. The stable,
- cross-platform solution is always QOpenGLWidget.
-
- \e{OpenGL is a trademark of Silicon Graphics, Inc. in the United States and other
- countries.}
-
- \sa QOpenGLFunctions, QOpenGLWindow, Qt::AA_ShareOpenGLContexts, UpdateBehavior
-*/
-
-/*!
- \fn void QOpenGLWidget::aboutToCompose()
-
- This signal is emitted when the widget's top-level window is about to begin
- composing the textures of its QOpenGLWidget children and the other widgets.
-*/
-
-/*!
- \fn void QOpenGLWidget::frameSwapped()
-
- This signal is emitted after the widget's top-level window has finished
- composition and returned from its potentially blocking
- QOpenGLContext::swapBuffers() call.
-*/
-
-/*!
- \fn void QOpenGLWidget::aboutToResize()
-
- This signal is emitted when the widget's size is changed and therefore the
- framebuffer object is going to be recreated.
-*/
-
-/*!
- \fn void QOpenGLWidget::resized()
-
- This signal is emitted right after the framebuffer object has been recreated
- due to resizing the widget.
-*/
-
-/*!
- \enum QOpenGLWidget::UpdateBehavior
- \since 5.5
-
- This enum describes the update semantics of QOpenGLWidget.
-
- \value NoPartialUpdate QOpenGLWidget will discard the
- contents of the color buffer and the ancillary buffers after the
- QOpenGLWidget is rendered to screen. This is the same behavior that can be
- expected by calling QOpenGLContext::swapBuffers with a default opengl
- enabled QWindow as the argument. NoPartialUpdate can have some performance
- benefits on certain hardware architectures common in the mobile and
- embedded space when a framebuffer object is used as the rendering target.
- The framebuffer object is invalidated between frames with
- glDiscardFramebufferEXT if supported or a glClear. Please see the
- documentation of EXT_discard_framebuffer for more information:
- https://www.khronos.org/registry/gles/extensions/EXT/EXT_discard_framebuffer.txt
-
- \value PartialUpdate The framebuffer objects color buffer and ancillary
- buffers are not invalidated between frames.
-
- \sa updateBehavior(), setUpdateBehavior()
-*/
-
-class QOpenGLWidgetPaintDevicePrivate : public QOpenGLPaintDevicePrivate
-{
-public:
- QOpenGLWidgetPaintDevicePrivate(QOpenGLWidget *widget)
- : QOpenGLPaintDevicePrivate(QSize()),
- w(widget) { }
-
- void beginPaint() override;
- void endPaint() override;
-
- QOpenGLWidget *w;
-};
-
-class QOpenGLWidgetPaintDevice : public QOpenGLPaintDevice
-{
-public:
- QOpenGLWidgetPaintDevice(QOpenGLWidget *widget)
- : QOpenGLPaintDevice(*new QOpenGLWidgetPaintDevicePrivate(widget)) { }
- void ensureActiveTarget() override;
-};
-
-class QOpenGLWidgetPrivate : public QWidgetPrivate
-{
- Q_DECLARE_PUBLIC(QOpenGLWidget)
-public:
- QOpenGLWidgetPrivate()
- : context(nullptr),
- fbo(nullptr),
- resolvedFbo(nullptr),
- surface(nullptr),
- initialized(false),
- fakeHidden(false),
- inBackingStorePaint(false),
- hasBeenComposed(false),
- flushPending(false),
- paintDevice(nullptr),
- updateBehavior(QOpenGLWidget::NoPartialUpdate),
- requestedSamples(0),
- inPaintGL(false),
- textureFormat(0)
- {
- requestedFormat = QSurfaceFormat::defaultFormat();
- }
-
- void reset();
- void recreateFbo();
-
- GLuint textureId() const override;
- QPlatformTextureList::Flags textureListFlags() override;
-
- void initialize();
- void invokeUserPaint();
- void render();
-
- void invalidateFbo();
-
- QImage grabFramebuffer() override;
- void beginBackingStorePainting() override { inBackingStorePaint = true; }
- void endBackingStorePainting() override { inBackingStorePaint = false; }
- void beginCompose() override;
- void endCompose() override;
- void initializeViewportFramebuffer() override;
- void resizeViewportFramebuffer() override;
- void resolveSamples() override;
-
- QOpenGLContext *context;
- QOpenGLFramebufferObject *fbo;
- QOpenGLFramebufferObject *resolvedFbo;
- QOffscreenSurface *surface;
- bool initialized;
- bool fakeHidden;
- bool inBackingStorePaint;
- bool hasBeenComposed;
- bool flushPending;
- QOpenGLPaintDevice *paintDevice;
- QSurfaceFormat requestedFormat;
- QOpenGLWidget::UpdateBehavior updateBehavior;
- int requestedSamples;
- bool inPaintGL;
- GLenum textureFormat;
-};
-
-void QOpenGLWidgetPaintDevicePrivate::beginPaint()
-{
- // NB! autoFillBackground is and must be false by default. Otherwise we would clear on
- // every QPainter begin() which is not desirable. This is only for legacy use cases,
- // like using QOpenGLWidget as the viewport of a graphics view, that expect clearing
- // with the palette's background color.
- if (w->autoFillBackground()) {
- QOpenGLFunctions *f = QOpenGLContext::currentContext()->functions();
- if (w->format().hasAlpha()) {
- f->glClearColor(0, 0, 0, 0);
- } else {
- QColor c = w->palette().brush(w->backgroundRole()).color();
- float alpha = c.alphaF();
- f->glClearColor(c.redF() * alpha, c.greenF() * alpha, c.blueF() * alpha, alpha);
- }
- f->glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
- }
-}
-
-void QOpenGLWidgetPaintDevicePrivate::endPaint()
-{
- QOpenGLWidgetPrivate *wd = static_cast<QOpenGLWidgetPrivate *>(QWidgetPrivate::get(w));
- if (!wd->initialized)
- return;
-
- if (!wd->inPaintGL)
- QOpenGLContextPrivate::get(wd->context)->defaultFboRedirect = 0;
-}
-
-void QOpenGLWidgetPaintDevice::ensureActiveTarget()
-{
- QOpenGLWidgetPaintDevicePrivate *d = static_cast<QOpenGLWidgetPaintDevicePrivate *>(d_ptr.data());
- QOpenGLWidgetPrivate *wd = static_cast<QOpenGLWidgetPrivate *>(QWidgetPrivate::get(d->w));
- if (!wd->initialized)
- return;
-
- if (QOpenGLContext::currentContext() != wd->context)
- d->w->makeCurrent();
- else
- wd->fbo->bind();
-
- if (!wd->inPaintGL)
- QOpenGLContextPrivate::get(wd->context)->defaultFboRedirect = wd->fbo->handle();
-
- // When used as a viewport, drawing is done via opening a QPainter on the widget
- // without going through paintEvent(). We will have to make sure a glFlush() is done
- // before the texture is accessed also in this case.
- wd->flushPending = true;
-}
-
-GLuint QOpenGLWidgetPrivate::textureId() const
-{
- return resolvedFbo ? resolvedFbo->texture() : (fbo ? fbo->texture() : 0);
-}
-
-#ifndef GL_SRGB
-#define GL_SRGB 0x8C40
-#endif
-#ifndef GL_SRGB8
-#define GL_SRGB8 0x8C41
-#endif
-#ifndef GL_SRGB_ALPHA
-#define GL_SRGB_ALPHA 0x8C42
-#endif
-#ifndef GL_SRGB8_ALPHA8
-#define GL_SRGB8_ALPHA8 0x8C43
-#endif
-
-QPlatformTextureList::Flags QOpenGLWidgetPrivate::textureListFlags()
-{
- QPlatformTextureList::Flags flags = QWidgetPrivate::textureListFlags();
- switch (textureFormat) {
- case GL_SRGB:
- case GL_SRGB8:
- case GL_SRGB_ALPHA:
- case GL_SRGB8_ALPHA8:
- flags |= QPlatformTextureList::TextureIsSrgb;
- break;
- default:
- break;
- }
- return flags;
-}
-
-void QOpenGLWidgetPrivate::reset()
-{
- Q_Q(QOpenGLWidget);
-
- // Destroy the OpenGL resources first. These need the context to be current.
- if (initialized)
- q->makeCurrent();
-
- delete paintDevice;
- paintDevice = nullptr;
- delete fbo;
- fbo = nullptr;
- delete resolvedFbo;
- resolvedFbo = nullptr;
-
- if (initialized)
- q->doneCurrent();
-
- // Delete the context first, then the surface. Slots connected to
- // the context's aboutToBeDestroyed() may still call makeCurrent()
- // to perform some cleanup.
- delete context;
- context = nullptr;
- delete surface;
- surface = nullptr;
- initialized = fakeHidden = inBackingStorePaint = false;
-}
-
-void QOpenGLWidgetPrivate::recreateFbo()
-{
- Q_Q(QOpenGLWidget);
-
- emit q->aboutToResize();
-
- context->makeCurrent(surface);
-
- delete fbo;
- fbo = nullptr;
- delete resolvedFbo;
- resolvedFbo = nullptr;
-
- int samples = requestedSamples;
- QOpenGLExtensions *extfuncs = static_cast<QOpenGLExtensions *>(context->functions());
- if (!extfuncs->hasOpenGLExtension(QOpenGLExtensions::FramebufferMultisample))
- samples = 0;
-
- QOpenGLFramebufferObjectFormat format;
- format.setAttachment(QOpenGLFramebufferObject::CombinedDepthStencil);
- format.setSamples(samples);
- if (textureFormat)
- format.setInternalTextureFormat(textureFormat);
-
- const QSize deviceSize = q->size() * q->devicePixelRatioF();
- fbo = new QOpenGLFramebufferObject(deviceSize, format);
- if (samples > 0)
- resolvedFbo = new QOpenGLFramebufferObject(deviceSize);
-
- textureFormat = fbo->format().internalTextureFormat();
-
- fbo->bind();
- context->functions()->glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
- flushPending = true; // Make sure the FBO is initialized before use
-
- paintDevice->setSize(deviceSize);
- paintDevice->setDevicePixelRatio(q->devicePixelRatioF());
-
- emit q->resized();
-}
-
-void QOpenGLWidgetPrivate::beginCompose()
-{
- Q_Q(QOpenGLWidget);
- if (flushPending) {
- flushPending = false;
- q->makeCurrent();
- static_cast<QOpenGLExtensions *>(context->functions())->flushShared();
- }
- hasBeenComposed = true;
- emit q->aboutToCompose();
-}
-
-void QOpenGLWidgetPrivate::endCompose()
-{
- Q_Q(QOpenGLWidget);
- emit q->frameSwapped();
-}
-
-void QOpenGLWidgetPrivate::initialize()
-{
- Q_Q(QOpenGLWidget);
- if (initialized)
- return;
-
- // If no global shared context get our toplevel's context with which we
- // will share in order to make the texture usable by the underlying window's backingstore.
- QWidget *tlw = q->window();
- QOpenGLContext *shareContext = qt_gl_global_share_context();
- if (!shareContext)
- shareContext = get(tlw)->shareContext();
- // If shareContext is null, showing content on-screen will not work.
- // However, offscreen rendering and grabFramebuffer() will stay fully functional.
-
- // Do not include the sample count. Requesting a multisampled context is not necessary
- // since we render into an FBO, never to an actual surface. What's more, attempting to
- // create a pbuffer with a multisampled config crashes certain implementations. Just
- // avoid the entire hassle, the result is the same.
- requestedSamples = requestedFormat.samples();
- requestedFormat.setSamples(0);
-
- QScopedPointer<QOpenGLContext> ctx(new QOpenGLContext);
- ctx->setFormat(requestedFormat);
- if (shareContext) {
- ctx->setShareContext(shareContext);
- ctx->setScreen(shareContext->screen());
- }
- if (Q_UNLIKELY(!ctx->create())) {
- qWarning("QOpenGLWidget: Failed to create context");
- return;
- }
-
- // Propagate settings that make sense only for the tlw. Note that this only
- // makes sense for properties that get picked up even after the native
- // window is created.
- if (tlw->windowHandle()) {
- QSurfaceFormat tlwFormat = tlw->windowHandle()->format();
- if (requestedFormat.swapInterval() != tlwFormat.swapInterval()) {
- // Most platforms will pick up the changed swap interval on the next
- // makeCurrent or swapBuffers.
- tlwFormat.setSwapInterval(requestedFormat.swapInterval());
- tlw->windowHandle()->setFormat(tlwFormat);
- }
- if (requestedFormat.swapBehavior() != tlwFormat.swapBehavior()) {
- tlwFormat.setSwapBehavior(requestedFormat.swapBehavior());
- tlw->windowHandle()->setFormat(tlwFormat);
- }
- }
-
- // The top-level window's surface is not good enough since it causes way too
- // much trouble with regards to the QSurfaceFormat for example. So just like
- // in QQuickWidget, use a dedicated QOffscreenSurface.
- surface = new QOffscreenSurface;
- surface->setFormat(ctx->format());
- surface->setScreen(ctx->screen());
- surface->create();
-
- if (Q_UNLIKELY(!ctx->makeCurrent(surface))) {
- qWarning("QOpenGLWidget: Failed to make context current");
- return;
- }
-
- paintDevice = new QOpenGLWidgetPaintDevice(q);
- paintDevice->setSize(q->size() * q->devicePixelRatioF());
- paintDevice->setDevicePixelRatio(q->devicePixelRatioF());
-
- context = ctx.take();
- initialized = true;
-
- q->initializeGL();
-}
-
-void QOpenGLWidgetPrivate::resolveSamples()
-{
- Q_Q(QOpenGLWidget);
- if (resolvedFbo) {
- q->makeCurrent();
- QRect rect(QPoint(0, 0), fbo->size());
- QOpenGLFramebufferObject::blitFramebuffer(resolvedFbo, rect, fbo, rect);
- flushPending = true;
- }
-}
-
-void QOpenGLWidgetPrivate::invokeUserPaint()
-{
- Q_Q(QOpenGLWidget);
-
- QOpenGLContext *ctx = QOpenGLContext::currentContext();
- Q_ASSERT(ctx && fbo);
-
- QOpenGLFunctions *f = ctx->functions();
- QOpenGLContextPrivate::get(ctx)->defaultFboRedirect = fbo->handle();
-
- f->glViewport(0, 0, q->width() * q->devicePixelRatioF(), q->height() * q->devicePixelRatioF());
- inPaintGL = true;
- q->paintGL();
- inPaintGL = false;
- flushPending = true;
-
- QOpenGLContextPrivate::get(ctx)->defaultFboRedirect = 0;
-}
-
-void QOpenGLWidgetPrivate::render()
-{
- Q_Q(QOpenGLWidget);
-
- if (fakeHidden || !initialized)
- return;
-
- q->makeCurrent();
-
- if (updateBehavior == QOpenGLWidget::NoPartialUpdate && hasBeenComposed) {
- invalidateFbo();
- hasBeenComposed = false;
- }
-
- invokeUserPaint();
-}
-
-void QOpenGLWidgetPrivate::invalidateFbo()
-{
- QOpenGLExtensions *f = static_cast<QOpenGLExtensions *>(QOpenGLContext::currentContext()->functions());
- if (f->hasOpenGLExtension(QOpenGLExtensions::DiscardFramebuffer)) {
- const int gl_color_attachment0 = 0x8CE0; // GL_COLOR_ATTACHMENT0
- const int gl_depth_attachment = 0x8D00; // GL_DEPTH_ATTACHMENT
- const int gl_stencil_attachment = 0x8D20; // GL_STENCIL_ATTACHMENT
-#ifdef Q_OS_WASM
- // webgl does not allow separate depth and stencil attachments
- // QTBUG-69913
- const int gl_depth_stencil_attachment = 0x821A; // GL_DEPTH_STENCIL_ATTACHMENT
-
- const GLenum attachments[] = {
- gl_color_attachment0, gl_depth_attachment, gl_stencil_attachment, gl_depth_stencil_attachment
- };
-#else
- const GLenum attachments[] = {
- gl_color_attachment0, gl_depth_attachment, gl_stencil_attachment
- };
-#endif
- f->glDiscardFramebufferEXT(GL_FRAMEBUFFER, sizeof attachments / sizeof *attachments, attachments);
- } else {
- f->glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
- }
-}
-
-extern Q_GUI_EXPORT QImage qt_gl_read_framebuffer(const QSize &size, bool alpha_format, bool include_alpha);
-
-QImage QOpenGLWidgetPrivate::grabFramebuffer()
-{
- Q_Q(QOpenGLWidget);
-
- initialize();
- if (!initialized)
- return QImage();
-
- if (!fbo) // could be completely offscreen, without ever getting a resize event
- recreateFbo();
-
- if (!inPaintGL)
- render();
-
- if (resolvedFbo) {
- resolveSamples();
- resolvedFbo->bind();
- } else {
- q->makeCurrent();
- }
-
- const bool hasAlpha = q->format().hasAlpha();
- QImage res = qt_gl_read_framebuffer(q->size() * q->devicePixelRatioF(), hasAlpha, hasAlpha);
- res.setDevicePixelRatio(q->devicePixelRatioF());
-
- // While we give no guarantees of what is going to be left bound, prefer the
- // multisample fbo instead of the resolved one. Clients may continue to
- // render straight after calling this function.
- if (resolvedFbo)
- q->makeCurrent();
-
- return res;
-}
-
-void QOpenGLWidgetPrivate::initializeViewportFramebuffer()
-{
- Q_Q(QOpenGLWidget);
- // Legacy behavior for compatibility with QGLWidget when used as a graphics view
- // viewport: enable clearing on each painter begin.
- q->setAutoFillBackground(true);
-}
-
-void QOpenGLWidgetPrivate::resizeViewportFramebuffer()
-{
- Q_Q(QOpenGLWidget);
- if (!initialized)
- return;
-
- if (!fbo || q->size() * q->devicePixelRatioF() != fbo->size()) {
- recreateFbo();
- q->update();
- }
-}
-
-/*!
- Constructs a widget which is a child of \a parent, with widget flags set to \a f.
- */
-QOpenGLWidget::QOpenGLWidget(QWidget *parent, Qt::WindowFlags f)
- : QWidget(*(new QOpenGLWidgetPrivate), parent, f)
-{
- Q_D(QOpenGLWidget);
- if (Q_UNLIKELY(!QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::RasterGLSurface)))
- qWarning("QOpenGLWidget is not supported on this platform.");
- else
- d->setRenderToTexture();
-}
-
-/*!
- Destroys the QOpenGLWidget instance, freeing its resources.
-
- The QOpenGLWidget's context is made current in the destructor, allowing for
- safe destruction of any child object that may need to release OpenGL
- resources belonging to the context provided by this widget.
-
- \warning if you have objects wrapping OpenGL resources (such as
- QOpenGLBuffer, QOpenGLShaderProgram, etc.) as members of a OpenGLWidget
- subclass, you may need to add a call to makeCurrent() in that subclass'
- destructor as well. Due to the rules of C++ object destruction, those objects
- will be destroyed \e{before} calling this function (but after that the
- destructor of the subclass has run), therefore making the OpenGL context
- current in this function happens too late for their safe disposal.
-
- \sa makeCurrent
-*/
-QOpenGLWidget::~QOpenGLWidget()
-{
- Q_D(QOpenGLWidget);
- d->reset();
-}
-
-/*!
- Sets this widget's update behavior to \a updateBehavior.
- \since 5.5
-*/
-void QOpenGLWidget::setUpdateBehavior(UpdateBehavior updateBehavior)
-{
- Q_D(QOpenGLWidget);
- d->updateBehavior = updateBehavior;
-}
-
-/*!
- \return the update behavior of the widget.
- \since 5.5
-*/
-QOpenGLWidget::UpdateBehavior QOpenGLWidget::updateBehavior() const
-{
- Q_D(const QOpenGLWidget);
- return d->updateBehavior;
-}
-
-/*!
- Sets the requested surface \a format.
-
- When the format is not explicitly set via this function, the format returned by
- QSurfaceFormat::defaultFormat() will be used. This means that when having multiple
- OpenGL widgets, individual calls to this function can be replaced by one single call to
- QSurfaceFormat::setDefaultFormat() before creating the first widget.
-
- \note Requesting an alpha buffer via this function will not lead to the
- desired results when the intention is to make other widgets beneath visible.
- Instead, use Qt::WA_AlwaysStackOnTop to enable semi-transparent QOpenGLWidget
- instances with other widgets visible underneath. Keep in mind however that
- this breaks the stacking order, so it will no longer be possible to have
- other widgets on top of the QOpenGLWidget.
-
- \sa format(), Qt::WA_AlwaysStackOnTop, QSurfaceFormat::setDefaultFormat()
- */
-void QOpenGLWidget::setFormat(const QSurfaceFormat &format)
-{
- Q_D(QOpenGLWidget);
- if (Q_UNLIKELY(d->initialized)) {
- qWarning("QOpenGLWidget: Already initialized, setting the format has no effect");
- return;
- }
-
- d->requestedFormat = format;
-}
-
-/*!
- Returns the context and surface format used by this widget and its toplevel
- window.
-
- After the widget and its toplevel have both been created, resized and shown,
- this function will return the actual format of the context. This may differ
- from the requested format if the request could not be fulfilled by the
- platform. It is also possible to get larger color buffer sizes than
- requested.
-
- When the widget's window and the related OpenGL resources are not yet
- initialized, the return value is the format that has been set via
- setFormat().
-
- \sa setFormat(), context()
- */
-QSurfaceFormat QOpenGLWidget::format() const
-{
- Q_D(const QOpenGLWidget);
- return d->initialized ? d->context->format() : d->requestedFormat;
-}
-
-/*!
- Sets a custom internal texture format of \a texFormat.
-
- When working with sRGB framebuffers, it will be necessary to specify a
- format like \c{GL_SRGB8_ALPHA8}. This can be achieved by calling this
- function.
-
- \note This function has no effect if called after the widget has already
- been shown and thus it performed initialization.
-
- \note This function will typically have to be used in combination with a
- QSurfaceFormat::setDefaultFormat() call that sets the color space to
- QSurfaceFormat::sRGBColorSpace.
-
- \since 5.10
- */
-void QOpenGLWidget::setTextureFormat(GLenum texFormat)
-{
- Q_D(QOpenGLWidget);
- if (Q_UNLIKELY(d->initialized)) {
- qWarning("QOpenGLWidget: Already initialized, setting the internal texture format has no effect");
- return;
- }
-
- d->textureFormat = texFormat;
-}
-
-/*!
- \return the active internal texture format if the widget has already
- initialized, the requested format if one was set but the widget has not yet
- been made visible, or \nullptr if setTextureFormat() was not called and the
- widget has not yet been made visible.
-
- \since 5.10
- */
-GLenum QOpenGLWidget::textureFormat() const
-{
- Q_D(const QOpenGLWidget);
- return d->textureFormat;
-}
-
-/*!
- \return \e true if the widget and OpenGL resources, like the context, have
- been successfully initialized. Note that the return value is always false
- until the widget is shown.
-*/
-bool QOpenGLWidget::isValid() const
-{
- Q_D(const QOpenGLWidget);
- return d->initialized && d->context->isValid();
-}
-
-/*!
- Prepares for rendering OpenGL content for this widget by making the
- corresponding context current and binding the framebuffer object in that
- context.
-
- It is not necessary to call this function in most cases, because it
- is called automatically before invoking paintGL().
-
- \sa context(), paintGL(), doneCurrent()
- */
-void QOpenGLWidget::makeCurrent()
-{
- Q_D(QOpenGLWidget);
- if (!d->initialized)
- return;
-
- d->context->makeCurrent(d->surface);
-
- if (d->fbo) // there may not be one if we are in reset()
- d->fbo->bind();
-}
-
-/*!
- Releases the context.
-
- It is not necessary to call this function in most cases, since the
- widget will make sure the context is bound and released properly
- when invoking paintGL().
- */
-void QOpenGLWidget::doneCurrent()
-{
- Q_D(QOpenGLWidget);
- if (!d->initialized)
- return;
-
- d->context->doneCurrent();
-}
-
-/*!
- \return The QOpenGLContext used by this widget or \c 0 if not yet initialized.
-
- \note The context and the framebuffer object used by the widget changes when
- reparenting the widget via setParent().
-
- \sa QOpenGLContext::setShareContext(), defaultFramebufferObject()
- */
-QOpenGLContext *QOpenGLWidget::context() const
-{
- Q_D(const QOpenGLWidget);
- return d->context;
-}
-
-/*!
- \return The framebuffer object handle or \c 0 if not yet initialized.
-
- \note The framebuffer object belongs to the context returned by context()
- and may not be accessible from other contexts.
-
- \note The context and the framebuffer object used by the widget changes when
- reparenting the widget via setParent(). In addition, the framebuffer object
- changes on each resize.
-
- \sa context()
- */
-GLuint QOpenGLWidget::defaultFramebufferObject() const
-{
- Q_D(const QOpenGLWidget);
- return d->fbo ? d->fbo->handle() : 0;
-}
-
-/*!
- This virtual function is called once before the first call to
- paintGL() or resizeGL(). Reimplement it in a subclass.
-
- This function should set up any required OpenGL resources and state.
-
- There is no need to call makeCurrent() because this has already been
- done when this function is called. Note however that the framebuffer
- is not yet available at this stage, so avoid issuing draw calls from
- here. Defer such calls to paintGL() instead.
-
- \sa paintGL(), resizeGL()
-*/
-void QOpenGLWidget::initializeGL()
-{
-}
-
-/*!
- This virtual function is called whenever the widget has been
- resized. Reimplement it in a subclass. The new size is passed in
- \a w and \a h.
-
- There is no need to call makeCurrent() because this has already been
- done when this function is called. Additionally, the framebuffer is
- also bound.
-
- \sa initializeGL(), paintGL()
-*/
-void QOpenGLWidget::resizeGL(int w, int h)
-{
- Q_UNUSED(w);
- Q_UNUSED(h);
-}
-
-/*!
- This virtual function is called whenever the widget needs to be
- painted. Reimplement it in a subclass.
-
- There is no need to call makeCurrent() because this has already
- been done when this function is called.
-
- Before invoking this function, the context and the framebuffer are
- bound, and the viewport is set up by a call to glViewport(). No
- other state is set and no clearing or drawing is performed by the
- framework.
-
- \sa initializeGL(), resizeGL()
-*/
-void QOpenGLWidget::paintGL()
-{
-}
-
-/*!
- Handles resize events that are passed in the \a e event parameter.
- Calls the virtual function resizeGL().
-
- \note Avoid overriding this function in derived classes. If that is not
- feasible, make sure that QOpenGLWidget's implementation is invoked
- too. Otherwise the underlying framebuffer object and related resources will
- not get resized properly and will lead to incorrect rendering.
-*/
-void QOpenGLWidget::resizeEvent(QResizeEvent *e)
-{
- Q_D(QOpenGLWidget);
-
- if (e->size().isEmpty()) {
- d->fakeHidden = true;
- return;
- }
- d->fakeHidden = false;
-
- d->initialize();
- if (!d->initialized)
- return;
-
- d->recreateFbo();
- resizeGL(width(), height());
- d->sendPaintEvent(QRect(QPoint(0, 0), size()));
-}
-
-/*!
- Handles paint events.
-
- Calling QWidget::update() will lead to sending a paint event \a e,
- and thus invoking this function. (NB this is asynchronous and will
- happen at some point after returning from update()). This function
- will then, after some preparation, call the virtual paintGL() to
- update the contents of the QOpenGLWidget's framebuffer. The widget's
- top-level window will then composite the framebuffer's texture with
- the rest of the window.
-*/
-void QOpenGLWidget::paintEvent(QPaintEvent *e)
-{
- Q_UNUSED(e);
- Q_D(QOpenGLWidget);
- if (!d->initialized)
- return;
-
- if (updatesEnabled())
- d->render();
-}
-
-/*!
- Renders and returns a 32-bit RGB image of the framebuffer.
-
- \note This is a potentially expensive operation because it relies on glReadPixels()
- to read back the pixels. This may be slow and can stall the GPU pipeline.
-*/
-QImage QOpenGLWidget::grabFramebuffer()
-{
- Q_D(QOpenGLWidget);
- return d->grabFramebuffer();
-}
-
-/*!
- \internal
-*/
-int QOpenGLWidget::metric(QPaintDevice::PaintDeviceMetric metric) const
-{
- Q_D(const QOpenGLWidget);
- if (d->inBackingStorePaint)
- return QWidget::metric(metric);
-
- auto window = d->windowHandle(QWidgetPrivate::WindowHandleMode::TopLevel);
- QScreen *screen = window ? window->screen() : QGuiApplication::primaryScreen();
-
- const float dpmx = qt_defaultDpiX() * 100. / 2.54;
- const float dpmy = qt_defaultDpiY() * 100. / 2.54;
-
- switch (metric) {
- case PdmWidth:
- return width();
- case PdmHeight:
- return height();
- case PdmDepth:
- return 32;
- case PdmWidthMM:
- if (screen)
- return width() * screen->physicalSize().width() / screen->geometry().width();
- else
- return width() * 1000 / dpmx;
- case PdmHeightMM:
- if (screen)
- return height() * screen->physicalSize().height() / screen->geometry().height();
- else
- return height() * 1000 / dpmy;
- case PdmNumColors:
- return 0;
- case PdmDpiX:
- if (screen)
- return qRound(screen->logicalDotsPerInchX());
- else
- return qRound(dpmx * 0.0254);
- case PdmDpiY:
- if (screen)
- return qRound(screen->logicalDotsPerInchY());
- else
- return qRound(dpmy * 0.0254);
- case PdmPhysicalDpiX:
- if (screen)
- return qRound(screen->physicalDotsPerInchX());
- else
- return qRound(dpmx * 0.0254);
- case PdmPhysicalDpiY:
- if (screen)
- return qRound(screen->physicalDotsPerInchY());
- else
- return qRound(dpmy * 0.0254);
- case PdmDevicePixelRatio:
- if (window)
- return int(window->devicePixelRatio());
- else
- return 1.0;
- case PdmDevicePixelRatioScaled:
- if (window)
- return int(window->devicePixelRatio() * devicePixelRatioFScale());
- else
- return int(devicePixelRatioFScale());
- default:
- qWarning("QOpenGLWidget::metric(): unknown metric %d", metric);
- return 0;
- }
-}
-
-/*!
- \internal
-*/
-QPaintDevice *QOpenGLWidget::redirected(QPoint *p) const
-{
- Q_D(const QOpenGLWidget);
- if (d->inBackingStorePaint)
- return QWidget::redirected(p);
-
- return d->paintDevice;
-}
-
-/*!
- \internal
-*/
-QPaintEngine *QOpenGLWidget::paintEngine() const
-{
- Q_D(const QOpenGLWidget);
- // QWidget needs to "punch a hole" into the backingstore. This needs the
- // normal paint engine and device, not the GL one. So in this mode, behave
- // like a normal widget.
- if (d->inBackingStorePaint)
- return QWidget::paintEngine();
-
- if (!d->initialized)
- return nullptr;
-
- return d->paintDevice->paintEngine();
-}
-
-/*!
- \internal
-*/
-bool QOpenGLWidget::event(QEvent *e)
-{
- Q_D(QOpenGLWidget);
- switch (e->type()) {
- case QEvent::WindowChangeInternal:
- if (QCoreApplication::testAttribute(Qt::AA_ShareOpenGLContexts))
- break;
- if (d->initialized)
- d->reset();
- if (isHidden())
- break;
- Q_FALLTHROUGH();
- case QEvent::Show: // reparenting may not lead to a resize so reinitalize on Show too
- if (d->initialized && window()->windowHandle()
- && d->context->shareContext() != QWidgetPrivate::get(window())->shareContext())
- {
- // Special case: did grabFramebuffer() for a hidden widget that then became visible.
- // Recreate all resources since the context now needs to share with the TLW's.
- if (!QCoreApplication::testAttribute(Qt::AA_ShareOpenGLContexts))
- d->reset();
- }
- if (!d->initialized && !size().isEmpty() && window()->windowHandle()) {
- d->initialize();
- if (d->initialized)
- d->recreateFbo();
- }
- break;
- case QEvent::ScreenChangeInternal:
- if (d->initialized && d->paintDevice->devicePixelRatioF() != devicePixelRatioF())
- d->recreateFbo();
- break;
- default:
- break;
- }
- return QWidget::event(e);
-}
-
-QT_END_NAMESPACE
-
-#include "moc_qopenglwidget.cpp"
diff --git a/src/widgets/kernel/qopenglwidget.h b/src/widgets/kernel/qopenglwidget.h
deleted file mode 100644
index 9eb4a9ba5a..0000000000
--- a/src/widgets/kernel/qopenglwidget.h
+++ /dev/null
@@ -1,115 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** 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 The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QOPENGLWIDGET_H
-#define QOPENGLWIDGET_H
-
-#include <QtWidgets/qtwidgetsglobal.h>
-
-#ifndef QT_NO_OPENGL
-
-#include <QtWidgets/QWidget>
-#include <QtGui/QSurfaceFormat>
-#include <QtGui/qopengl.h>
-
-QT_BEGIN_NAMESPACE
-
-class QOpenGLWidgetPrivate;
-
-class Q_WIDGETS_EXPORT QOpenGLWidget : public QWidget
-{
- Q_OBJECT
- Q_DECLARE_PRIVATE(QOpenGLWidget)
-
-public:
- enum UpdateBehavior {
- NoPartialUpdate,
- PartialUpdate
- };
-
- explicit QOpenGLWidget(QWidget* parent = nullptr, Qt::WindowFlags f = Qt::WindowFlags());
- ~QOpenGLWidget();
-
- void setUpdateBehavior(UpdateBehavior updateBehavior);
- UpdateBehavior updateBehavior() const;
-
- void setFormat(const QSurfaceFormat &format);
- QSurfaceFormat format() const;
-
- GLenum textureFormat() const;
- void setTextureFormat(GLenum texFormat);
-
- bool isValid() const;
-
- void makeCurrent();
- void doneCurrent();
-
- QOpenGLContext *context() const;
- GLuint defaultFramebufferObject() const;
-
- QImage grabFramebuffer();
-
-Q_SIGNALS:
- void aboutToCompose();
- void frameSwapped();
- void aboutToResize();
- void resized();
-
-protected:
- virtual void initializeGL();
- virtual void resizeGL(int w, int h);
- virtual void paintGL();
-
- void paintEvent(QPaintEvent *e) override;
- void resizeEvent(QResizeEvent *e) override;
- bool event(QEvent *e) override;
-
- int metric(QPaintDevice::PaintDeviceMetric metric) const override;
- QPaintDevice *redirected(QPoint *p) const override;
- QPaintEngine *paintEngine() const override;
-
-private:
- Q_DISABLE_COPY(QOpenGLWidget)
-};
-
-QT_END_NAMESPACE
-
-#endif // QT_NO_OPENGL
-
-#endif // QOPENGLWIDGET_H
diff --git a/src/widgets/kernel/qshortcut.cpp b/src/widgets/kernel/qshortcut.cpp
index 039699a004..4a2f8d66c2 100644
--- a/src/widgets/kernel/qshortcut.cpp
+++ b/src/widgets/kernel/qshortcut.cpp
@@ -40,7 +40,6 @@
#include "qshortcut.h"
#include "private/qwidget_p.h"
-#ifndef QT_NO_SHORTCUT
#include <qevent.h>
#if QT_CONFIG(whatsthis)
#include <qwhatsthis.h>
@@ -53,25 +52,21 @@
#endif
#include <qapplication.h>
#include <private/qapplication_p.h>
+#include "private/qguishortcut_p.h"
#include <private/qshortcutmap_p.h>
-#include <private/qaction_p.h>
+#if QT_CONFIG(action)
+# include <private/qaction_p.h>
+#endif
#include <private/qwidgetwindow_p.h>
#include <qpa/qplatformmenu.h>
QT_BEGIN_NAMESPACE
-#define QAPP_CHECK(functionName) \
- if (Q_UNLIKELY(!qApp)) { \
- qWarning("QShortcut: Initialize QApplication before calling '" functionName "'."); \
- return; \
- }
-
-
static bool correctWidgetContext(Qt::ShortcutContext context, QWidget *w, QWidget *active_window);
#if QT_CONFIG(graphicsview)
static bool correctGraphicsWidgetContext(Qt::ShortcutContext context, QGraphicsWidget *w, QWidget *active_window);
#endif
-#ifndef QT_NO_ACTION
+#if QT_CONFIG(action)
static bool correctActionContext(Qt::ShortcutContext context, QAction *a, QWidget *active_window);
#endif
@@ -108,7 +103,7 @@ bool qWidgetShortcutContextMatcher(QObject *object, Qt::ShortcutContext context)
if (!active_window)
return false;
-#ifndef QT_NO_ACTION
+#if QT_CONFIG(action)
if (auto a = qobject_cast<QAction *>(object))
return correctActionContext(context, a, active_window);
#endif
@@ -284,7 +279,7 @@ static bool correctGraphicsWidgetContext(Qt::ShortcutContext context, QGraphicsW
}
#endif
-#ifndef QT_NO_ACTION
+#if QT_CONFIG(action)
static bool correctActionContext(Qt::ShortcutContext context, QAction *a, QWidget *active_window)
{
const QWidgetList &widgets = static_cast<QActionPrivate *>(QObjectPrivate::get(a))->widgets;
@@ -332,7 +327,7 @@ static bool correctActionContext(Qt::ShortcutContext context, QAction *a, QWidge
#endif
return false;
}
-#endif // QT_NO_ACTION
+#endif // QT_CONFIG(action)
/*!
@@ -395,29 +390,62 @@ static bool correctActionContext(Qt::ShortcutContext context, QAction *a, QWidge
Returns the shortcut's parent widget.
*/
-/*!
- \fn void QShortcut::activated()
+/*
+ \internal
+ Private data accessed through d-pointer.
+*/
+class QShortcutPrivate : public QGuiShortcutPrivate
+{
+ Q_DECLARE_PUBLIC(QShortcut)
+public:
+ QShortcutPrivate() = default;
- This signal is emitted when the user types the shortcut's key
- sequence.
+ QShortcutMap::ContextMatcher contextMatcher() const override
+ { return qWidgetShortcutContextMatcher; }
- \sa activatedAmbiguously()
-*/
+ bool handleWhatsThis() override;
-/*!
- \fn void QShortcut::activatedAmbiguously()
+ QString sc_whatsthis;
+};
- When a key sequence is being typed at the keyboard, it is said to
- be ambiguous as long as it matches the start of more than one
- shortcut.
+bool QShortcutPrivate::handleWhatsThis()
+{
+#if QT_CONFIG(whatsthis)
+ const bool result = QWhatsThis::inWhatsThisMode();
+ if (result)
+ QWhatsThis::showText(QCursor::pos(), sc_whatsthis);
+ return result;
+#else
+ return false;
+#endif
+}
- When a shortcut's key sequence is completed,
- activatedAmbiguously() is emitted if the key sequence is still
- ambiguous (i.e., it is the start of one or more other shortcuts).
- The activated() signal is not emitted in this case.
+/*!
+ Constructs a QShortcut object for the \a parent widget. Since no
+ shortcut key sequence is specified, the shortcut will not emit any
+ signals.
- \sa activated()
+ \sa setKey()
*/
+QShortcut::QShortcut(QWidget *parent)
+ : QGuiShortcut(*new QShortcutPrivate, parent)
+{
+}
+
+/*!
+ Constructs a QShortcut object for the \a parent widget. The shortcut
+ operates on its parent, listening for \l{QShortcutEvent}s that
+ match the \a key sequence. Depending on the ambiguity of the
+ event, the shortcut will call the \a member function, or the \a
+ ambiguousMember function, if the key press was in the shortcut's
+ \a shortcutContext.
+*/
+QShortcut::QShortcut(const QKeySequence &key, QWidget *parent,
+ const char *member, const char *ambiguousMember,
+ Qt::ShortcutContext shortcutContext)
+ : QGuiShortcut(*new QShortcutPrivate, key, parent, member, ambiguousMember, shortcutContext)
+{
+}
/*!
\fn template<typename Functor>
@@ -489,177 +517,6 @@ static bool correctActionContext(Qt::ShortcutContext context, QAction *a, QWidge
will not be called.
*/
-/*
- \internal
- Private data accessed through d-pointer.
-*/
-class QShortcutPrivate : public QObjectPrivate
-{
- Q_DECLARE_PUBLIC(QShortcut)
-public:
- QShortcutPrivate() = default;
- QKeySequence sc_sequence;
- Qt::ShortcutContext sc_context = Qt::WindowShortcut;
- bool sc_enabled = true;
- bool sc_autorepeat = true;
- int sc_id = 0;
- QString sc_whatsthis;
- void redoGrab(QShortcutMap &map);
-};
-
-void QShortcutPrivate::redoGrab(QShortcutMap &map)
-{
- Q_Q(QShortcut);
- if (Q_UNLIKELY(!parent)) {
- qWarning("QShortcut: No widget parent defined");
- return;
- }
-
- if (sc_id)
- map.removeShortcut(sc_id, q);
- if (sc_sequence.isEmpty())
- return;
- sc_id = map.addShortcut(q, sc_sequence, sc_context, qWidgetShortcutContextMatcher);
- if (!sc_enabled)
- map.setShortcutEnabled(false, sc_id, q);
- if (!sc_autorepeat)
- map.setShortcutAutoRepeat(false, sc_id, q);
-}
-
-/*!
- Constructs a QShortcut object for the \a parent widget. Since no
- shortcut key sequence is specified, the shortcut will not emit any
- signals.
-
- \sa setKey()
-*/
-QShortcut::QShortcut(QWidget *parent)
- : QObject(*new QShortcutPrivate, parent)
-{
- Q_ASSERT(parent != nullptr);
-}
-
-/*!
- Constructs a QShortcut object for the \a parent widget. The shortcut
- operates on its parent, listening for \l{QShortcutEvent}s that
- match the \a key sequence. Depending on the ambiguity of the
- event, the shortcut will call the \a member function, or the \a
- ambiguousMember function, if the key press was in the shortcut's
- \a shortcutContext.
-*/
-QShortcut::QShortcut(const QKeySequence &key, QWidget *parent,
- const char *member, const char *ambiguousMember,
- Qt::ShortcutContext shortcutContext)
- : QShortcut(parent)
-{
- QAPP_CHECK("QShortcut");
-
- Q_D(QShortcut);
- d->sc_context = shortcutContext;
- d->sc_sequence = key;
- d->redoGrab(QGuiApplicationPrivate::instance()->shortcutMap);
- if (member)
- connect(this, SIGNAL(activated()), parent, member);
- if (ambiguousMember)
- connect(this, SIGNAL(activatedAmbiguously()), parent, ambiguousMember);
-}
-
-/*!
- Destroys the shortcut.
-*/
-QShortcut::~QShortcut()
-{
- Q_D(QShortcut);
- if (qApp)
- QGuiApplicationPrivate::instance()->shortcutMap.removeShortcut(d->sc_id, this);
-}
-
-/*!
- \property QShortcut::key
- \brief the shortcut's key sequence
-
- This is a key sequence with an optional combination of Shift, Ctrl,
- and Alt. The key sequence may be supplied in a number of ways:
-
- \snippet code/src_gui_kernel_qshortcut.cpp 1
-
- By default, this property contains an empty key sequence.
-*/
-void QShortcut::setKey(const QKeySequence &key)
-{
- Q_D(QShortcut);
- if (d->sc_sequence == key)
- return;
- QAPP_CHECK("setKey");
- d->sc_sequence = key;
- d->redoGrab(QGuiApplicationPrivate::instance()->shortcutMap);
-}
-
-QKeySequence QShortcut::key() const
-{
- Q_D(const QShortcut);
- return d->sc_sequence;
-}
-
-/*!
- \property QShortcut::enabled
- \brief whether the shortcut is enabled
-
- An enabled shortcut emits the activated() or activatedAmbiguously()
- signal when a QShortcutEvent occurs that matches the shortcut's
- key() sequence.
-
- If the application is in \c WhatsThis mode the shortcut will not emit
- the signals, but will show the "What's This?" text instead.
-
- By default, this property is \c true.
-
- \sa whatsThis
-*/
-void QShortcut::setEnabled(bool enable)
-{
- Q_D(QShortcut);
- if (d->sc_enabled == enable)
- return;
- QAPP_CHECK("setEnabled");
- d->sc_enabled = enable;
- QGuiApplicationPrivate::instance()->shortcutMap.setShortcutEnabled(enable, d->sc_id, this);
-}
-
-bool QShortcut::isEnabled() const
-{
- Q_D(const QShortcut);
- return d->sc_enabled;
-}
-
-/*!
- \property QShortcut::context
- \brief the context in which the shortcut is valid
-
- A shortcut's context decides in which circumstances a shortcut is
- allowed to be triggered. The normal context is Qt::WindowShortcut,
- which allows the shortcut to trigger if the parent (the widget
- containing the shortcut) is a subwidget of the active top-level
- window.
-
- By default, this property is set to Qt::WindowShortcut.
-*/
-void QShortcut::setContext(Qt::ShortcutContext context)
-{
- Q_D(QShortcut);
- if(d->sc_context == context)
- return;
- QAPP_CHECK("setContext");
- d->sc_context = context;
- d->redoGrab(QGuiApplicationPrivate::instance()->shortcutMap);
-}
-
-Qt::ShortcutContext QShortcut::context() const
-{
- Q_D(const QShortcut);
- return d->sc_context;
-}
-
/*!
\property QShortcut::whatsThis
\brief the shortcut's "What's This?" help text
@@ -687,67 +544,8 @@ QString QShortcut::whatsThis() const
}
/*!
- \property QShortcut::autoRepeat
- \brief whether the shortcut can auto repeat
- \since 4.2
-
- If true, the shortcut will auto repeat when the keyboard shortcut
- combination is held down, provided that keyboard auto repeat is
- enabled on the system.
- The default value is true.
-*/
-void QShortcut::setAutoRepeat(bool on)
-{
- Q_D(QShortcut);
- if (d->sc_autorepeat == on)
- return;
- QAPP_CHECK("setAutoRepeat");
- d->sc_autorepeat = on;
- QGuiApplicationPrivate::instance()->shortcutMap.setShortcutAutoRepeat(on, d->sc_id, this);
-}
-
-bool QShortcut::autoRepeat() const
-{
- Q_D(const QShortcut);
- return d->sc_autorepeat;
-}
-
-/*!
- Returns the shortcut's ID.
-
- \sa QShortcutEvent::shortcutId()
-*/
-int QShortcut::id() const
-{
- Q_D(const QShortcut);
- return d->sc_id;
-}
-
-/*!
- \internal
+ Destroys the shortcut.
*/
-bool QShortcut::event(QEvent *e)
-{
- Q_D(QShortcut);
- if (d->sc_enabled && e->type() == QEvent::Shortcut) {
- auto se = static_cast<QShortcutEvent *>(e);
- if (se->shortcutId() == d->sc_id && se->key() == d->sc_sequence){
-#if QT_CONFIG(whatsthis)
- if (QWhatsThis::inWhatsThisMode()) {
- QWhatsThis::showText(QCursor::pos(), d->sc_whatsthis);
- } else
-#endif
- if (se->isAmbiguous())
- emit activatedAmbiguously();
- else
- emit activated();
- return true;
- }
- }
- return QObject::event(e);
-}
-#endif // QT_NO_SHORTCUT
+QShortcut::~QShortcut() = default;
QT_END_NAMESPACE
-
-#include "moc_qshortcut.cpp"
diff --git a/src/widgets/kernel/qshortcut.h b/src/widgets/kernel/qshortcut.h
index 4f9c5ba0f7..6c92f87c46 100644
--- a/src/widgets/kernel/qshortcut.h
+++ b/src/widgets/kernel/qshortcut.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtWidgets module of the Qt Toolkit.
@@ -42,28 +42,23 @@
#include <QtWidgets/qtwidgetsglobal.h>
#include <QtWidgets/qwidget.h>
-#include <QtGui/qkeysequence.h>
-
-QT_BEGIN_NAMESPACE
+#include <QtGui/qguishortcut.h>
+QT_REQUIRE_CONFIG(shortcut);
-#ifndef QT_NO_SHORTCUT
+QT_BEGIN_NAMESPACE
class QShortcutPrivate;
-class Q_WIDGETS_EXPORT QShortcut : public QObject
+class Q_WIDGETS_EXPORT QShortcut : public QGuiShortcut
{
Q_OBJECT
- Q_DECLARE_PRIVATE(QShortcut)
- Q_PROPERTY(QKeySequence key READ key WRITE setKey)
Q_PROPERTY(QString whatsThis READ whatsThis WRITE setWhatsThis)
- Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled)
- Q_PROPERTY(bool autoRepeat READ autoRepeat WRITE setAutoRepeat)
- Q_PROPERTY(Qt::ShortcutContext context READ context WRITE setContext)
+ Q_DECLARE_PRIVATE(QShortcut)
public:
explicit QShortcut(QWidget *parent);
- QShortcut(const QKeySequence &key, QWidget *parent,
- const char *member = nullptr, const char *ambiguousMember = nullptr,
- Qt::ShortcutContext shortcutContext = Qt::WindowShortcut);
+ explicit QShortcut(const QKeySequence& key, QWidget *parent,
+ const char *member = nullptr, const char *ambiguousMember = nullptr,
+ Qt::ShortcutContext shortcutContext = Qt::WindowShortcut);
#ifdef Q_CLANG_QDOC
template<typename Functor>
QShortcut(const QKeySequence &key, QWidget *parent,
@@ -122,36 +117,13 @@ public:
#endif
~QShortcut();
- void setKey(const QKeySequence& key);
- QKeySequence key() const;
-
- void setEnabled(bool enable);
- bool isEnabled() const;
-
- void setContext(Qt::ShortcutContext context);
- Qt::ShortcutContext context() const;
-
void setWhatsThis(const QString &text);
QString whatsThis() const;
- void setAutoRepeat(bool on);
- bool autoRepeat() const;
-
- int id() const;
-
inline QWidget *parentWidget() const
{ return static_cast<QWidget *>(QObject::parent()); }
-
-Q_SIGNALS:
- void activated();
- void activatedAmbiguously();
-
-protected:
- bool event(QEvent *e) override;
};
-#endif // QT_NO_SHORTCUT
-
QT_END_NAMESPACE
#endif // QSHORTCUT_H
diff --git a/src/widgets/kernel/qt_widgets_pch.h b/src/widgets/kernel/qt_widgets_pch.h
index b70941950b..3551f19e80 100644
--- a/src/widgets/kernel/qt_widgets_pch.h
+++ b/src/widgets/kernel/qt_widgets_pch.h
@@ -53,7 +53,9 @@
#include <qabstractbutton.h>
#include <qabstractscrollarea.h>
#include <qabstractslider.h>
-#include <qaction.h>
+#if QT_CONFIG(action)
+# include <qaction.h>
+#endif
#include <qcommonstyle.h>
#include <qlayout.h>
#include <qstyle.h>
diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp
index 2da967485b..b4699ae040 100644
--- a/src/widgets/kernel/qwidget.cpp
+++ b/src/widgets/kernel/qwidget.cpp
@@ -88,7 +88,9 @@
#include "qwidget_p.h"
#include <QtGui/private/qwindow_p.h>
-#include "qaction_p.h"
+#if QT_CONFIG(action)
+# include "qaction_p.h"
+#endif
#include "qlayout_p.h"
#if QT_CONFIG(graphicsview)
#include "QtWidgets/qgraphicsproxywidget.h"
@@ -192,7 +194,15 @@ QWidgetPrivate::QWidgetPrivate(int version)
return;
}
- checkForIncompatibleLibraryVersion(version);
+#ifdef QT_BUILD_INTERNAL
+ // Don't check the version parameter in internal builds.
+ // This allows incompatible versions to be loaded, possibly for testing.
+ Q_UNUSED(version);
+#else
+ if (Q_UNLIKELY(version != QObjectPrivateVersion))
+ qFatal("Cannot mix incompatible Qt library (version 0x%x) with this library (version 0x%x)",
+ version, QObjectPrivateVersion);
+#endif
isWidget = true;
memset(high_attributes, 0, sizeof(high_attributes));
@@ -1506,13 +1516,8 @@ QWidget::~QWidget()
if (d->declarativeData) {
d->wasDeleted = true; // needed, so that destroying the declarative data does the right thing
- if (static_cast<QAbstractDeclarativeDataImpl*>(d->declarativeData)->ownedByQml1) {
- if (QAbstractDeclarativeData::destroyed_qml1)
- QAbstractDeclarativeData::destroyed_qml1(d->declarativeData, this);
- } else {
- if (QAbstractDeclarativeData::destroyed)
- QAbstractDeclarativeData::destroyed(d->declarativeData, this);
- }
+ if (QAbstractDeclarativeData::destroyed)
+ QAbstractDeclarativeData::destroyed(d->declarativeData, this);
d->declarativeData = nullptr; // don't activate again in ~QObject
d->wasDeleted = false;
}
@@ -4374,7 +4379,7 @@ void QWidget::setPalette(const QPalette &palette)
widget's palette are implicitly imposed on this widget by the user). Note
that this font does not take into account the palette set on \a w itself.
*/
-QPalette QWidgetPrivate::naturalWidgetPalette(uint inheritedMask) const
+QPalette QWidgetPrivate::naturalWidgetPalette(QPalette::ResolveMask inheritedMask) const
{
Q_Q(const QWidget);
@@ -4911,9 +4916,6 @@ void qt_qpa_set_cursor(QWidget *w, bool force)
\note To obtain the contents of a QOpenGLWidget, use QOpenGLWidget::grabFramebuffer()
instead.
-
- \note To obtain the contents of a QGLWidget (deprecated), use
- QGLWidget::grabFrameBuffer() or QGLWidget::renderPixmap() instead.
*/
void QWidget::render(QPaintDevice *target, const QPoint &targetOffset,
const QRegion &sourceRegion, RenderFlags renderFlags)
diff --git a/src/widgets/kernel/qwidget.h b/src/widgets/kernel/qwidget.h
index 415a738eb4..5117fa94c8 100644
--- a/src/widgets/kernel/qwidget.h
+++ b/src/widgets/kernel/qwidget.h
@@ -53,7 +53,9 @@
#include <QtGui/qregion.h>
#include <QtGui/qbrush.h>
#include <QtGui/qcursor.h>
-#include <QtGui/qkeysequence.h>
+#if QT_CONFIG(shortcut)
+# include <QtGui/qkeysequence.h>
+#endif
#ifdef QT_INCLUDE_COMPAT
#include <QtGui/qevent.h>
diff --git a/src/widgets/kernel/qwidget_p.h b/src/widgets/kernel/qwidget_p.h
index 2597017318..3c29b48973 100644
--- a/src/widgets/kernel/qwidget_p.h
+++ b/src/widgets/kernel/qwidget_p.h
@@ -299,7 +299,7 @@ public:
void setPalette_helper(const QPalette &);
void resolvePalette();
- QPalette naturalWidgetPalette(uint inheritedMask) const;
+ QPalette naturalWidgetPalette(QPalette::ResolveMask inheritedMask) const;
void setMask_sys(const QRegion &);
@@ -673,7 +673,7 @@ public:
uint directFontResolveMask;
uint inheritedFontResolveMask;
decltype(std::declval<QPalette>().resolve()) directPaletteResolveMask;
- uint inheritedPaletteResolveMask;
+ QPalette::ResolveMask inheritedPaletteResolveMask;
short leftmargin;
short topmargin;
short rightmargin;
diff --git a/src/widgets/kernel/qwidgetaction.cpp b/src/widgets/kernel/qwidgetaction.cpp
index 9649e51b92..12250983f7 100644
--- a/src/widgets/kernel/qwidgetaction.cpp
+++ b/src/widgets/kernel/qwidgetaction.cpp
@@ -40,7 +40,6 @@
#include "qwidgetaction.h"
#include "qdebug.h"
-#ifndef QT_NO_ACTION
#include "qwidgetaction_p.h"
QT_BEGIN_NAMESPACE
@@ -282,5 +281,3 @@ QList<QWidget *> QWidgetAction::createdWidgets() const
QT_END_NAMESPACE
#include "moc_qwidgetaction.cpp"
-
-#endif // QT_NO_ACTION
diff --git a/src/widgets/kernel/qwidgetaction.h b/src/widgets/kernel/qwidgetaction.h
index 4769332a23..4d302e8c61 100644
--- a/src/widgets/kernel/qwidgetaction.h
+++ b/src/widgets/kernel/qwidgetaction.h
@@ -43,10 +43,9 @@
#include <QtWidgets/qtwidgetsglobal.h>
#include <QtWidgets/qaction.h>
-QT_BEGIN_NAMESPACE
-
+QT_REQUIRE_CONFIG(action);
-#ifndef QT_NO_ACTION
+QT_BEGIN_NAMESPACE
class QWidgetActionPrivate;
@@ -78,8 +77,6 @@ private:
friend class QToolBar;
};
-#endif // QT_NO_ACTION
-
QT_END_NAMESPACE
#endif // QWIDGETACTION_H
diff --git a/src/widgets/kernel/qwidgetaction_p.h b/src/widgets/kernel/qwidgetaction_p.h
index 1fbcf236a1..0e633a65e4 100644
--- a/src/widgets/kernel/qwidgetaction_p.h
+++ b/src/widgets/kernel/qwidgetaction_p.h
@@ -54,6 +54,8 @@
#include <QtWidgets/private/qtwidgetsglobal_p.h>
#include "private/qaction_p.h"
+QT_REQUIRE_CONFIG(action);
+
QT_BEGIN_NAMESPACE
class QWidgetActionPrivate : public QActionPrivate
diff --git a/src/widgets/kernel/qwidgetsvariant.cpp b/src/widgets/kernel/qwidgetsvariant.cpp
index edb166e8d5..45a3bb3f7a 100644
--- a/src/widgets/kernel/qwidgetsvariant.cpp
+++ b/src/widgets/kernel/qwidgetsvariant.cpp
@@ -48,36 +48,6 @@
QT_BEGIN_NAMESPACE
namespace {
-static void construct(QVariant::Private *x, const void *copy)
-{
- switch (x->type) {
- case QMetaType::QSizePolicy:
- v_construct<QSizePolicy>(x, copy);
- break;
- default:
- qWarning("Trying to construct an instance of an invalid type, type id: %i", x->type);
- x->type = QMetaType::UnknownType;
- return;
- }
- x->is_null = !copy;
-}
-
-static void clear(QVariant::Private *d)
-{
- switch (d->type) {
- case QMetaType::QSizePolicy:
- v_clear<QSizePolicy>(d);
- break;
- default:
- Q_ASSERT(false);
- return;
- }
-
- d->type = QMetaType::UnknownType;
- d->is_null = true;
- d->is_shared = false;
-}
-
static bool isNull(const QVariant::Private *)
{
@@ -86,8 +56,8 @@ static bool isNull(const QVariant::Private *)
static bool compare(const QVariant::Private *a, const QVariant::Private *b)
{
- Q_ASSERT(a->type == b->type);
- switch(a->type) {
+ Q_ASSERT(a->type() == b->type());
+ switch (a->type().id()) {
case QMetaType::QSizePolicy:
return *v_cast<QSizePolicy>(a) == *v_cast<QSizePolicy>(b);
default:
@@ -110,19 +80,17 @@ static bool convert(const QVariant::Private *d, int type, void *result, bool *ok
static void streamDebug(QDebug dbg, const QVariant &v)
{
QVariant::Private *d = const_cast<QVariant::Private *>(&v.data_ptr());
- switch (d->type) {
+ switch (d->type().id()) {
case QMetaType::QSizePolicy:
dbg.nospace() << *v_cast<QSizePolicy>(d);
break;
default:
- dbg.nospace() << "QMetaType::Type(" << d->type << ')';
+ dbg.nospace() << "QMetaType::Type(" << d->type().id() << ')';
}
}
#endif
static const QVariant::Handler widgets_handler = {
- construct,
- clear,
isNull,
#ifndef QT_NO_DATASTREAM
nullptr,
@@ -138,23 +106,42 @@ static const QVariant::Handler widgets_handler = {
#endif
};
-#define QT_IMPL_METATYPEINTERFACE_WIDGETS_TYPES(MetaTypeName, MetaTypeId, RealName) \
- QT_METATYPE_INTERFACE_INIT(RealName),
+static const struct : QMetaTypeModuleHelper
+{
+ QtPrivate::QMetaTypeInterface *interfaceForType(int type) const override {
+ switch (type) {
+ QT_FOR_EACH_STATIC_WIDGETS_CLASS(QT_METATYPE_CONVERT_ID_TO_TYPE)
+ default: return nullptr;
+ }
+ }
+#ifndef QT_NO_DATASTREAM
+ bool save(QDataStream &stream, int type, const void *data) const override {
+ switch (type) {
+ QT_FOR_EACH_STATIC_WIDGETS_CLASS(QT_METATYPE_DATASTREAM_SAVE)
+ default: return false;
+ }
+ }
+ bool load(QDataStream &stream, int type, void *data) const override {
+ switch (type) {
+ QT_FOR_EACH_STATIC_WIDGETS_CLASS(QT_METATYPE_DATASTREAM_LOAD)
+ default: return false;
+ }
+ }
+#endif
+
+} qVariantWidgetsHelper;
-static const QMetaTypeInterface qVariantWidgetsHelper[] = {
- QT_FOR_EACH_STATIC_WIDGETS_CLASS(QT_IMPL_METATYPEINTERFACE_WIDGETS_TYPES)
-};
#undef QT_IMPL_METATYPEINTERFACE_WIDGETS_TYPES
} // namespace
-extern Q_CORE_EXPORT const QMetaTypeInterface *qMetaTypeWidgetsHelper;
+extern Q_CORE_EXPORT const QMetaTypeModuleHelper *qMetaTypeWidgetsHelper;
void qRegisterWidgetsVariant()
{
qRegisterMetaType<QWidget*>();
- qMetaTypeWidgetsHelper = qVariantWidgetsHelper;
+ qMetaTypeWidgetsHelper = &qVariantWidgetsHelper;
QVariantPrivate::registerHandler(QModulesPrivate::Widgets, &widgets_handler);
}
Q_CONSTRUCTOR_FUNCTION(qRegisterWidgetsVariant)
diff --git a/src/widgets/styles/qfusionstyle.cpp b/src/widgets/styles/qfusionstyle.cpp
index ce5f084618..4427d69944 100644
--- a/src/widgets/styles/qfusionstyle.cpp
+++ b/src/widgets/styles/qfusionstyle.cpp
@@ -3191,7 +3191,7 @@ QSize QFusionStyle::sizeFromContents(ContentsType type, const QStyleOption *opti
break;
case CT_MenuItem:
if (const QStyleOptionMenuItem *menuItem = qstyleoption_cast<const QStyleOptionMenuItem *>(option)) {
- int w = newSize.width();
+ int w = size.width(); // Don't rely of QCommonStyle's width calculation here
int maxpmw = menuItem->maxIconWidth;
int tabSpacing = 20;
if (menuItem->text.contains(QLatin1Char('\t')))
diff --git a/src/widgets/styles/qstyle.cpp b/src/widgets/styles/qstyle.cpp
index 5570d59276..69167a1fe2 100644
--- a/src/widgets/styles/qstyle.cpp
+++ b/src/widgets/styles/qstyle.cpp
@@ -638,7 +638,6 @@ void QStyle::drawItemPixmap(QPainter *painter, const QRect &rect, int alignment,
indicator or button bevel.
\omitvalue PE_IndicatorViewItemCheck
- \value PE_FrameStatusBar Obsolete. Use PE_FrameStatusBarItem instead.
\value PE_PanelButtonCommand Button used to initiate an action, for
example, a QPushButton.
diff --git a/src/widgets/styles/qstyle.h b/src/widgets/styles/qstyle.h
index 5be1b4b290..5844251ae5 100644
--- a/src/widgets/styles/qstyle.h
+++ b/src/widgets/styles/qstyle.h
@@ -142,9 +142,6 @@ public:
PE_FrameLineEdit,
PE_FrameMenu,
PE_FrameStatusBarItem,
-#if QT_DEPRECATED_SINCE(5, 13) // ### Qt 6: remove
- PE_FrameStatusBar Q_DECL_ENUMERATOR_DEPRECATED = PE_FrameStatusBarItem,
-#endif
PE_FrameTabWidget,
PE_FrameWindow,
PE_FrameButtonBevel,
@@ -165,9 +162,6 @@ public:
PE_IndicatorBranch,
PE_IndicatorButtonDropDown,
PE_IndicatorItemViewItemCheck,
-#if QT_DEPRECATED_SINCE(5, 13) // ### Qt 6: remove
- PE_IndicatorViewItemCheck Q_DECL_ENUMERATOR_DEPRECATED = PE_IndicatorItemViewItemCheck,
-#endif
PE_IndicatorCheckBox,
PE_IndicatorDockWidgetResizeHandle,
PE_IndicatorHeaderArrow,
diff --git a/src/widgets/styles/qstyleanimation.cpp b/src/widgets/styles/qstyleanimation.cpp
index b9202eae69..1c1158ab10 100644
--- a/src/widgets/styles/qstyleanimation.cpp
+++ b/src/widgets/styles/qstyleanimation.cpp
@@ -266,7 +266,7 @@ static QImage blendedImage(const QImage &start, const QImage &end, float alpha)
const int ia = 256 - a;
const int sw = start.width();
const int sh = start.height();
- const int bpl = start.bytesPerLine();
+ const qsizetype bpl = start.bytesPerLine();
switch (start.depth()) {
case 32:
{
diff --git a/src/widgets/styles/qstyleoption.cpp b/src/widgets/styles/qstyleoption.cpp
index 95232dd97b..bf365585d4 100644
--- a/src/widgets/styles/qstyleoption.cpp
+++ b/src/widgets/styles/qstyleoption.cpp
@@ -1776,7 +1776,7 @@ QStyleOptionMenuItem::QStyleOptionMenuItem(int version)
\value Exclusive The item is an exclusive check item (like a radio button).
\value NonExclusive The item is a non-exclusive check item (like a check box).
- \sa checkType, QAction::checkable, QAction::checked, QActionGroup::exclusionPolicy
+ \sa checkType, QGuiAction::checkable, QGuiAction::checked, QGuiActionGroup::exclusionPolicy
*/
/*!
diff --git a/src/widgets/styles/qstylesheetstyle_p.h b/src/widgets/styles/qstylesheetstyle_p.h
index c5266558af..3c3503b964 100644
--- a/src/widgets/styles/qstylesheetstyle_p.h
+++ b/src/widgets/styles/qstylesheetstyle_p.h
@@ -194,7 +194,7 @@ public:
template <typename T>
struct Tampered {
T oldWidgetValue;
- uint resolveMask;
+ decltype(std::declval<T>().resolve()) resolveMask;
// only call this function on an rvalue *this (it mangles oldWidgetValue)
T reverted(T current)
@@ -214,7 +214,7 @@ public:
};
template <typename T>
class QTypeInfo<QStyleSheetStyleCaches::Tampered<T>>
- : QTypeInfoMerger<QStyleSheetStyleCaches::Tampered<T>, T> {};
+ : public QTypeInfoMerger<QStyleSheetStyleCaches::Tampered<T>, T> {};
// Returns a QStyleSheet from the given style.
diff --git a/src/widgets/util/qundostack.cpp b/src/widgets/util/qundostack.cpp
index f188b8298a..8974f11a13 100644
--- a/src/widgets/util/qundostack.cpp
+++ b/src/widgets/util/qundostack.cpp
@@ -443,7 +443,7 @@ const QUndoCommand *QUndoCommand::child(int index) const
\sa QUndoCommand, QUndoView
*/
-#ifndef QT_NO_ACTION
+#if QT_CONFIG(action)
QUndoAction::QUndoAction(const QString &prefix, QObject *parent)
: QAction(parent)
@@ -473,7 +473,7 @@ void QUndoAction::setTextFormat(const QString &textFormat, const QString &defaul
m_defaultText = defaultText;
}
-#endif // QT_NO_ACTION
+#endif // QT_CONFIG(action)
/*! \internal
Sets the current index to \a idx, emitting appropriate signals. If \a clean is true,
diff --git a/src/widgets/util/qundostack_p.h b/src/widgets/util/qundostack_p.h
index 05c9e0d27e..c44cdd6603 100644
--- a/src/widgets/util/qundostack_p.h
+++ b/src/widgets/util/qundostack_p.h
@@ -44,7 +44,9 @@
#include <private/qobject_p.h>
#include <QtCore/qlist.h>
#include <QtCore/qstring.h>
-#include <QtWidgets/qaction.h>
+#if QT_CONFIG(action)
+# include <QtWidgets/qaction.h>
+#endif
#include "qundostack.h"
diff --git a/src/widgets/widgets/qabstractbutton.cpp b/src/widgets/widgets/qabstractbutton.cpp
index 7961d0a21b..77ffda10b0 100644
--- a/src/widgets/widgets/qabstractbutton.cpp
+++ b/src/widgets/widgets/qabstractbutton.cpp
@@ -52,7 +52,6 @@
#include "qpainter.h"
#include "qapplication.h"
#include "qstyle.h"
-#include "qaction.h"
#ifndef QT_NO_ACCESSIBILITY
#include "qaccessible.h"
#endif
@@ -414,16 +413,8 @@ void QAbstractButtonPrivate::emitClicked()
QPointer<QAbstractButton> guard(q);
emit q->clicked(checked);
#if QT_CONFIG(buttongroup)
- if (guard && group) {
-#if QT_DEPRECATED_SINCE(5, 15)
-QT_WARNING_PUSH
-QT_WARNING_DISABLE_DEPRECATED
- emit group->buttonClicked(group->id(q));
- if (guard && group)
-QT_WARNING_POP
-#endif
- emit group->buttonClicked(q);
- }
+ if (guard && group)
+ emit group->buttonClicked(q);
#endif
}
@@ -433,16 +424,8 @@ void QAbstractButtonPrivate::emitPressed()
QPointer<QAbstractButton> guard(q);
emit q->pressed();
#if QT_CONFIG(buttongroup)
- if (guard && group) {
-#if QT_DEPRECATED_SINCE(5, 15)
-QT_WARNING_PUSH
-QT_WARNING_DISABLE_DEPRECATED
- emit group->buttonPressed(group->id(q));
- if (guard && group)
-QT_WARNING_POP
-#endif
- emit group->buttonPressed(q);
- }
+ if (guard && group)
+ emit group->buttonPressed(q);
#endif
}
@@ -452,16 +435,8 @@ void QAbstractButtonPrivate::emitReleased()
QPointer<QAbstractButton> guard(q);
emit q->released();
#if QT_CONFIG(buttongroup)
- if (guard && group) {
-#if QT_DEPRECATED_SINCE(5, 15)
-QT_WARNING_PUSH
-QT_WARNING_DISABLE_DEPRECATED
- emit group->buttonReleased(group->id(q));
- if (guard && group)
-QT_WARNING_POP
-#endif
- emit group->buttonReleased(q);
- }
+ if (guard && group)
+ emit group->buttonReleased(q);
#endif
}
@@ -471,16 +446,8 @@ void QAbstractButtonPrivate::emitToggled(bool checked)
QPointer<QAbstractButton> guard(q);
emit q->toggled(checked);
#if QT_CONFIG(buttongroup)
- if (guard && group) {
-#if QT_DEPRECATED_SINCE(5, 15)
-QT_WARNING_PUSH
-QT_WARNING_DISABLE_DEPRECATED
- emit group->buttonToggled(group->id(q), checked);
- if (guard && group)
-QT_WARNING_POP
-#endif
- emit group->buttonToggled(q, checked);
- }
+ if (guard && group)
+ emit group->buttonToggled(q, checked);
#endif
}
diff --git a/src/widgets/widgets/qabstractbutton.h b/src/widgets/widgets/qabstractbutton.h
index 50c94654f3..d44da2f4f3 100644
--- a/src/widgets/widgets/qabstractbutton.h
+++ b/src/widgets/widgets/qabstractbutton.h
@@ -42,7 +42,9 @@
#include <QtWidgets/qtwidgetsglobal.h>
#include <QtGui/qicon.h>
-#include <QtGui/qkeysequence.h>
+#if QT_CONFIG(shortcut)
+# include <QtGui/qkeysequence.h>
+#endif
#include <QtWidgets/qwidget.h>
QT_REQUIRE_CONFIG(abstractbutton);
diff --git a/src/widgets/widgets/qbuttongroup.cpp b/src/widgets/widgets/qbuttongroup.cpp
index 9162029cdb..1368c721ad 100644
--- a/src/widgets/widgets/qbuttongroup.cpp
+++ b/src/widgets/widgets/qbuttongroup.cpp
@@ -163,16 +163,6 @@ void QButtonGroup::setExclusive(bool exclusive)
*/
/*!
- \fn void QButtonGroup::buttonClicked(int id)
- \obsolete
-
- This signal is emitted when a button with the given \a id is
- clicked.
-
- \sa checkedButton(), QAbstractButton::clicked()
-*/
-
-/*!
\fn void QButtonGroup::buttonPressed(QAbstractButton *button)
\since 4.2
@@ -182,17 +172,6 @@ void QButtonGroup::setExclusive(bool exclusive)
*/
/*!
- \fn void QButtonGroup::buttonPressed(int id)
- \since 4.2
- \obsolete
-
- This signal is emitted when a button with the given \a id is
- pressed down.
-
- \sa QAbstractButton::pressed()
-*/
-
-/*!
\fn void QButtonGroup::buttonReleased(QAbstractButton *button)
\since 4.2
@@ -202,17 +181,6 @@ void QButtonGroup::setExclusive(bool exclusive)
*/
/*!
- \fn void QButtonGroup::buttonReleased(int id)
- \since 4.2
- \obsolete
-
- This signal is emitted when a button with the given \a id is
- released.
-
- \sa QAbstractButton::released()
-*/
-
-/*!
\fn void QButtonGroup::buttonToggled(QAbstractButton *button, bool checked)
\since 5.2
@@ -222,17 +190,6 @@ void QButtonGroup::setExclusive(bool exclusive)
\sa QAbstractButton::toggled()
*/
-/*!
- \fn void QButtonGroup::buttonToggled(int id, bool checked)
- \since 5.2
- \obsolete
-
- This signal is emitted when a button with the given \a id is toggled.
- \a checked is true if the button is checked, or false if the button is unchecked.
-
- \sa QAbstractButton::toggled()
-*/
-
/*!
Adds the given \a button to the button group. If \a id is -1,
diff --git a/src/widgets/widgets/qbuttongroup.h b/src/widgets/widgets/qbuttongroup.h
index 2989dcb4ba..838bf8abce 100644
--- a/src/widgets/widgets/qbuttongroup.h
+++ b/src/widgets/widgets/qbuttongroup.h
@@ -81,16 +81,6 @@ Q_SIGNALS:
void buttonPressed(QAbstractButton *);
void buttonReleased(QAbstractButton *);
void buttonToggled(QAbstractButton *, bool);
-#if QT_DEPRECATED_SINCE(5, 15)
- QT_DEPRECATED_VERSION_X_5_15("Use QButtonGroup::buttonClicked(QAbstractButton *) instead")
- void buttonClicked(int);
- QT_DEPRECATED_VERSION_X_5_15("Use QButtonGroup::buttonPressed(QAbstractButton *) instead")
- void buttonPressed(int);
- QT_DEPRECATED_VERSION_X_5_15("Use QButtonGroup::buttonReleased(QAbstractButton *) instead")
- void buttonReleased(int);
- QT_DEPRECATED_VERSION_X_5_15("Use QButtonGroup::buttonToggled(QAbstractButton *, bool) instead")
- void buttonToggled(int, bool);
-#endif
private:
Q_DISABLE_COPY(QButtonGroup)
diff --git a/src/widgets/widgets/qcombobox.cpp b/src/widgets/widgets/qcombobox.cpp
index 8c05c6de7a..9c1bd1e79a 100644
--- a/src/widgets/widgets/qcombobox.cpp
+++ b/src/widgets/widgets/qcombobox.cpp
@@ -905,20 +905,9 @@ QStyleOptionComboBox QComboBoxPrivateContainer::comboStyleOption() const
The item's \a index is passed. Note that this signal is sent even
when the choice is not changed. If you need to know when the
choice actually changes, use signal currentIndexChanged().
-
*/
/*!
- \fn void QComboBox::activated(const QString &text)
-
- This signal is sent when the user chooses an item in the combobox.
- The item's \a text is passed. Note that this signal is sent even
- when the choice is not changed. If you need to know when the
- choice actually changes, use signal currentIndexChanged().
-
- \obsolete Use QComboBox::textActivated() instead
-*/
-/*!
\fn void QComboBox::textActivated(const QString &text)
\since 5.14
@@ -936,14 +925,6 @@ QStyleOptionComboBox QComboBoxPrivateContainer::comboStyleOption() const
*/
/*!
- \fn void QComboBox::highlighted(const QString &text)
-
- This signal is sent when an item in the combobox popup list is
- highlighted by the user. The item's \a text is passed.
-
- \obsolete Use textHighlighted() instead
-*/
-/*!
\fn void QComboBox::textHighlighted(const QString &text)
\since 5.14
@@ -952,29 +933,6 @@ QStyleOptionComboBox QComboBoxPrivateContainer::comboStyleOption() const
*/
/*!
- \fn void QComboBox::currentIndexChanged(int index)
- \since 4.1
-
- This signal is sent whenever the currentIndex in the combobox
- changes either through user interaction or programmatically. The
- item's \a index is passed or -1 if the combobox becomes empty or the
- currentIndex was reset.
-
- \obsolete Use currentIndexChanged(int index, const QString &text) instead
-*/
-
-/*!
- \fn void QComboBox::currentIndexChanged(const QString &text)
- \since 4.1
-
- This signal is sent whenever the currentIndex in the combobox
- changes either through user interaction or programmatically. The
- item's \a text is passed.
-
- \obsolete Use currentIndexChanged(int index, const QString &text) instead
-*/
-
-/*!
\fn void QComboBox::currentIndexChanged(int index, const QString &text)
\since 5.15
@@ -1438,12 +1396,6 @@ void QComboBoxPrivate::emitActivated(const QModelIndex &index)
QString text(itemText(index));
emit q->activated(index.row());
emit q->textActivated(text);
-#if QT_DEPRECATED_SINCE(5, 15)
-QT_WARNING_PUSH
-QT_WARNING_DISABLE_DEPRECATED
- emit q->activated(text);
-QT_WARNING_POP
-#endif
}
void QComboBoxPrivate::_q_emitHighlighted(const QModelIndex &index)
@@ -1454,25 +1406,12 @@ void QComboBoxPrivate::_q_emitHighlighted(const QModelIndex &index)
QString text(itemText(index));
emit q->highlighted(index.row());
emit q->textHighlighted(text);
-#if QT_DEPRECATED_SINCE(5, 15)
-QT_WARNING_PUSH
-QT_WARNING_DISABLE_DEPRECATED
- emit q->highlighted(text);
-QT_WARNING_POP
-#endif
}
void QComboBoxPrivate::_q_emitCurrentIndexChanged(const QModelIndex &index)
{
Q_Q(QComboBox);
const QString text = itemText(index);
-#if QT_DEPRECATED_SINCE(5, 15)
- QT_WARNING_PUSH
- QT_WARNING_DISABLE_DEPRECATED
- emit q->currentIndexChanged(index.row());
- emit q->currentIndexChanged(text);
- QT_WARNING_POP
-#endif
emit q->currentIndexChanged(index.row(), text);
// signal lineEdit.textChanged already connected to signal currentTextChanged, so don't emit double here
if (!lineEdit)
@@ -2129,6 +2068,9 @@ QAbstractItemDelegate *QComboBox::itemDelegate() const
Sets the item \a delegate for the popup list view.
The combobox takes ownership of the delegate.
+ Any existing delegate will be removed, but not deleted. QComboBox
+ does not take ownership of \a delegate.
+
\warning You should not share the same instance of a delegate between comboboxes,
widget mappers or views. Doing so can cause incorrect or unintuitive editing behavior
since each view connected to a given delegate may receive the
@@ -2143,7 +2085,6 @@ void QComboBox::setItemDelegate(QAbstractItemDelegate *delegate)
qWarning("QComboBox::setItemDelegate: cannot set a 0 delegate");
return;
}
- delete view()->itemDelegate();
view()->setItemDelegate(delegate);
}
diff --git a/src/widgets/widgets/qcombobox.h b/src/widgets/widgets/qcombobox.h
index 1f6e2fcdb3..444c834e88 100644
--- a/src/widgets/widgets/qcombobox.h
+++ b/src/widgets/widgets/qcombobox.h
@@ -170,7 +170,7 @@ public:
void setItemDelegate(QAbstractItemDelegate *delegate);
QAbstractItemModel *model() const;
- void setModel(QAbstractItemModel *model);
+ virtual void setModel(QAbstractItemModel *model);
QModelIndex rootModelIndex() const;
void setRootModelIndex(const QModelIndex &index);
@@ -230,20 +230,8 @@ Q_SIGNALS:
void textActivated(const QString &);
void highlighted(int index);
void textHighlighted(const QString &);
-#if QT_DEPRECATED_SINCE(5, 15)
- QT_DEPRECATED_VERSION_X_5_15("Use currentIndexChanged(int, const QString &) instead")
- void currentIndexChanged(int index);
- QT_DEPRECATED_VERSION_X_5_15("Use currentIndexChanged(int, const QString &) instead")
- void currentIndexChanged(const QString &);
-#endif
void currentIndexChanged(int index, const QString &text);
void currentTextChanged(const QString &);
-#if QT_DEPRECATED_SINCE(5, 15)
- QT_DEPRECATED_VERSION_X(5, 15, "Use textActivated() instead")
- void activated(const QString &);
- QT_DEPRECATED_VERSION_X(5, 15, "Use textHighlighted() instead")
- void highlighted(const QString &);
-#endif
protected:
void focusInEvent(QFocusEvent *e) override;
diff --git a/src/widgets/widgets/qdatetimeedit.cpp b/src/widgets/widgets/qdatetimeedit.cpp
index 63d5ae268e..4880b5ee46 100644
--- a/src/widgets/widgets/qdatetimeedit.cpp
+++ b/src/widgets/widgets/qdatetimeedit.cpp
@@ -53,6 +53,9 @@
#include <qlayout.h>
#include <qset.h>
#include <qstyle.h>
+#if QT_CONFIG(timezone)
+#include <QTimeZone>
+#endif
#include <algorithm>
@@ -226,8 +229,8 @@ QDateTimeEdit::~QDateTimeEdit()
\property QDateTimeEdit::dateTime
\brief The QDateTime that is set in the QDateTimeEdit.
- When setting this property the timespec of the QDateTimeEdit remains the same
- and the timespec of the new QDateTime is ignored.
+ When setting this property, the new QDateTime is converted to the timespec of
+ the QDateTimeEdit, which thus remains unchanged.
By default, this property is set to the start of 2000 CE. It can only be set
to a valid QDateTime value. If any operation causes this property to have an
@@ -251,11 +254,14 @@ void QDateTimeEdit::setDateTime(const QDateTime &datetime)
{
Q_D(QDateTimeEdit);
if (datetime.isValid()) {
+ QDateTime when = d->convertTimeSpec(datetime);
+ Q_ASSERT(when.timeSpec() == d->spec);
+
d->clearCache();
- const QDate date = datetime.date();
+ const QDate date = when.date();
if (!(d->sections & DateSections_Mask))
setDateRange(date, date);
- d->setValue(QDateTime(date, datetime.time(), d->spec), EmitIfChanged);
+ d->setValue(when, EmitIfChanged);
}
}
@@ -1714,6 +1720,25 @@ QDateTimeEditPrivate::QDateTimeEditPrivate()
#endif
}
+QDateTime QDateTimeEditPrivate::convertTimeSpec(const QDateTime &datetime)
+{
+ Q_ASSERT(value.toDateTime().timeSpec() == spec);
+ switch (spec) {
+ case Qt::UTC:
+ return datetime.toUTC();
+ case Qt::LocalTime:
+ return datetime.toLocalTime();
+ case Qt::OffsetFromUTC:
+ return datetime.toOffsetFromUtc(value.toDateTime().offsetFromUtc());
+#if QT_CONFIG(timezone)
+ case Qt::TimeZone:
+ return datetime.toTimeZone(value.toDateTime().timeZone());
+#endif
+ }
+ Q_UNREACHABLE();
+}
+
+// FIXME: architecturaly incompatible with OffsetFromUTC or TimeZone as spec (QTBUG-80417).
void QDateTimeEditPrivate::updateTimeSpec()
{
minimum = minimum.toDateTime().toTimeSpec(spec);
@@ -2345,33 +2370,6 @@ void QDateTimeEdit::paintEvent(QPaintEvent *event)
style()->drawComplexControl(QStyle::CC_ComboBox, &optCombo, &p, this);
}
-/*
- Returns the string for AM and PM markers.
-
- If a translation for "AM" and "PM" is installed, then use that.
- Otherwise, use the default implementation, which uses the locale.
-*/
-QString QDateTimeEditPrivate::getAmPmText(AmPm ap, Case cs) const
-{
- QString original;
- QString translated;
- if (ap == AmText) {
- original = QLatin1String(cs == UpperCase ? "AM" : "am");
- translated = (cs == UpperCase ? QDateTimeParser::tr("AM") : QDateTimeParser::tr("am"));
- } else {
- original = QLatin1String(cs == UpperCase ? "PM" : "pm");
- translated = (cs == UpperCase ? QDateTimeParser::tr("PM") : QDateTimeParser::tr("pm"));
- }
-
- // This logic fails if a translation exists but doesn't change the string,
- // which we can accept as a corner-case for which a locale-derived answer
- // will be acceptable.
- if (original != translated)
- return translated;
-
- return QDateTimeParser::getAmPmText(ap, cs);
-}
-
int QDateTimeEditPrivate::absoluteIndex(QDateTimeEdit::Section s, int index) const
{
for (int i=0; i<sectionNodes.size(); ++i) {
diff --git a/src/widgets/widgets/qdatetimeedit_p.h b/src/widgets/widgets/qdatetimeedit_p.h
index dcf8863c8b..0a4433846f 100644
--- a/src/widgets/widgets/qdatetimeedit_p.h
+++ b/src/widgets/widgets/qdatetimeedit_p.h
@@ -97,7 +97,6 @@ public:
QDateTime getMinimum() const override { return minimum.toDateTime(); }
QDateTime getMaximum() const override { return maximum.toDateTime(); }
QLocale locale() const override { return q_func()->locale(); }
- QString getAmPmText(AmPm ap, Case cs) const override;
int cursorPosition() const override { return edit ? edit->cursorPosition() : -1; }
int absoluteIndex(QDateTimeEdit::Section s, int index) const;
@@ -110,6 +109,7 @@ public:
void updateCache(const QVariant &val, const QString &str) const;
+ QDateTime convertTimeSpec(const QDateTime &datetime);
void updateTimeSpec();
QString valueToText(const QVariant &var) const { return textFromValue(var); }
diff --git a/src/widgets/widgets/qeffects.cpp b/src/widgets/widgets/qeffects.cpp
index 074352b736..1f2d3517e8 100644
--- a/src/widgets/widgets/qeffects.cpp
+++ b/src/widgets/widgets/qeffects.cpp
@@ -311,7 +311,7 @@ void QAlphaWidget::alphaBlend()
const int sw = frontImage.width();
const int sh = frontImage.height();
- const int bpl = frontImage.bytesPerLine();
+ const qsizetype bpl = frontImage.bytesPerLine();
switch(frontImage.depth()) {
case 32:
{
diff --git a/src/widgets/widgets/qfontcombobox.cpp b/src/widgets/widgets/qfontcombobox.cpp
index 4a99b0f962..cb665de889 100644
--- a/src/widgets/widgets/qfontcombobox.cpp
+++ b/src/widgets/widgets/qfontcombobox.cpp
@@ -427,7 +427,7 @@ QFontComboBox::QFontComboBox(QWidget *parent)
lview->setUniformItemSizes(true);
setWritingSystem(QFontDatabase::Any);
- connect(this, SIGNAL(currentIndexChanged(QString)),
+ connect(this, SIGNAL(currentTextChanged(QString)),
this, SLOT(_q_currentChanged(QString)));
connect(qApp, SIGNAL(fontDatabaseChanged()),
diff --git a/src/widgets/widgets/qlabel.cpp b/src/widgets/widgets/qlabel.cpp
index 992e0cee97..a0b5bdd39f 100644
--- a/src/widgets/widgets/qlabel.cpp
+++ b/src/widgets/widgets/qlabel.cpp
@@ -47,7 +47,6 @@
#include "qstyle.h"
#include "qstyleoption.h"
#include <limits.h>
-#include "qaction.h"
#include "qclipboard.h"
#include <qdebug.h>
#include <qurl.h>
diff --git a/src/widgets/widgets/qlineedit.cpp b/src/widgets/widgets/qlineedit.cpp
index 675f09d283..9faf161cb1 100644
--- a/src/widgets/widgets/qlineedit.cpp
+++ b/src/widgets/widgets/qlineedit.cpp
@@ -40,7 +40,9 @@
#include "qlineedit.h"
#include "qlineedit_p.h"
-#include "qaction.h"
+#if QT_CONFIG(action)
+# include "qaction.h"
+#endif
#include "qapplication.h"
#include "qclipboard.h"
#if QT_CONFIG(draganddrop)
@@ -78,7 +80,7 @@
#endif
#include "private/qstylesheetstyle_p.h"
-#ifndef QT_NO_SHORTCUT
+#if QT_CONFIG(shortcut)
#include "private/qapplication_p.h"
#include "private/qshortcutmap_p.h"
#include "qkeysequence.h"
diff --git a/src/widgets/widgets/qlineedit_p.cpp b/src/widgets/widgets/qlineedit_p.cpp
index feb34ef403..29e0ae3b39 100644
--- a/src/widgets/widgets/qlineedit_p.cpp
+++ b/src/widgets/widgets/qlineedit_p.cpp
@@ -47,7 +47,9 @@
#if QT_CONFIG(draganddrop)
#include "qdrag.h"
#endif
-#include "qwidgetaction.h"
+#if QT_CONFIG(action)
+# include "qwidgetaction.h"
+#endif
#include "qclipboard.h"
#ifndef QT_NO_ACCESSIBILITY
#include "qaccessible.h"
@@ -370,7 +372,7 @@ void QLineEditIconButton::actionEvent(QActionEvent *e)
{
switch (e->type()) {
case QEvent::ActionChanged: {
- const QAction *action = e->action();
+ const auto *action = e->action();
if (isVisibleTo(parentWidget()) != action->isVisible()) {
setVisible(action->isVisible());
if (QLineEditPrivate *lep = lineEditPrivate())
@@ -545,7 +547,8 @@ void QLineEditPrivate::positionSideWidgets()
}
}
-QLineEditPrivate::SideWidgetLocation QLineEditPrivate::findSideWidget(const QAction *a) const
+#if QT_CONFIG(action)
+QLineEditPrivate::SideWidgetLocation QLineEditPrivate::findSideWidget(const QGuiAction *a) const
{
int i = 0;
for (const auto &e : leadingSideWidgets) {
@@ -574,12 +577,10 @@ QWidget *QLineEditPrivate::addAction(QAction *newAction, QAction *before, QLineE
QWidget *w = nullptr;
// Store flags about QWidgetAction here since removeAction() may be called from ~QAction,
// in which a qobject_cast<> no longer works.
-#if QT_CONFIG(action)
if (QWidgetAction *widgetAction = qobject_cast<QWidgetAction *>(newAction)) {
if ((w = widgetAction->requestWidget(q)))
flags |= SideWidgetCreatedByWidgetAction;
}
-#endif
if (!w) {
#if QT_CONFIG(toolbutton)
QLineEditIconButton *toolButton = new QLineEditIconButton(q);
@@ -634,9 +635,8 @@ QWidget *QLineEditPrivate::addAction(QAction *newAction, QAction *before, QLineE
return w;
}
-void QLineEditPrivate::removeAction(QAction *action)
+void QLineEditPrivate::removeAction(QGuiAction *action)
{
-#if QT_CONFIG(action)
Q_Q(QLineEdit);
const auto location = findSideWidget(action);
if (!location.isValid())
@@ -652,10 +652,8 @@ void QLineEditPrivate::removeAction(QAction *action)
if (!hasSideWidgets()) // Last widget, remove connection
QObject::disconnect(q, SIGNAL(textChanged(QString)), q, SLOT(_q_textChanged(QString)));
q->update();
-#else
- Q_UNUSED(action);
-#endif // QT_CONFIG(action)
}
+#endif // QT_CONFIG(action)
static int effectiveTextMargin(int defaultMargin, const QLineEditPrivate::SideWidgetEntryList &widgets,
const QLineEditPrivate::SideWidgetParameters &parameters)
diff --git a/src/widgets/widgets/qlineedit_p.h b/src/widgets/widgets/qlineedit_p.h
index 5ae402b992..9fe571b4bb 100644
--- a/src/widgets/widgets/qlineedit_p.h
+++ b/src/widgets/widgets/qlineedit_p.h
@@ -238,8 +238,10 @@ public:
QString placeholderText;
+#if QT_CONFIG(action)
QWidget *addAction(QAction *newAction, QAction *before, QLineEdit::ActionPosition, int flags = 0);
- void removeAction(QAction *action);
+ void removeAction(QGuiAction *action);
+#endif
SideWidgetParameters sideWidgetParameters() const;
QIcon clearButtonIcon() const;
void setClearButtonEnabled(bool enabled);
@@ -261,7 +263,9 @@ private:
};
friend class QTypeInfo<SideWidgetLocation>;
- SideWidgetLocation findSideWidget(const QAction *a) const;
+#if QT_CONFIG(action)
+ SideWidgetLocation findSideWidget(const QGuiAction *a) const;
+#endif
SideWidgetEntryList leadingSideWidgets;
SideWidgetEntryList trailingSideWidgets;
diff --git a/src/widgets/widgets/qmainwindow.cpp b/src/widgets/widgets/qmainwindow.cpp
index 4f94b81b19..4bd3e23479 100644
--- a/src/widgets/widgets/qmainwindow.cpp
+++ b/src/widgets/widgets/qmainwindow.cpp
@@ -1349,7 +1349,7 @@ bool QMainWindow::event(QEvent *event)
Note that the Qt 5 implementation has several limitations compared to Qt 4:
\list
- \li Use in windows with OpenGL content is not supported. This includes QGLWidget and QOpenGLWidget.
+ \li Use in windows with OpenGL content is not supported. This includes QOpenGLWidget.
\li Using dockable or movable toolbars may result in painting errors and is not recommended
\endlist
diff --git a/src/widgets/widgets/qmdisubwindow.cpp b/src/widgets/widgets/qmdisubwindow.cpp
index 84568c35db..f8460a4718 100644
--- a/src/widgets/widgets/qmdisubwindow.cpp
+++ b/src/widgets/widgets/qmdisubwindow.cpp
@@ -162,7 +162,9 @@
#include <QDebug>
#include <QMdiArea>
#include <QScopedValueRollback>
-#include <QAction>
+#if QT_CONFIG(action)
+# include <qaction.h>
+#endif
#if QT_CONFIG(menu)
#include <QMenu>
#endif
@@ -895,7 +897,7 @@ QMdiSubWindowPrivate::QMdiSubWindowPrivate()
*/
void QMdiSubWindowPrivate::_q_updateStaysOnTopHint()
{
-#ifndef QT_NO_ACTION
+#if QT_CONFIG(action)
Q_Q(QMdiSubWindow);
if (QAction *senderAction = qobject_cast<QAction *>(q->sender())) {
if (senderAction->isChecked()) {
@@ -906,7 +908,7 @@ void QMdiSubWindowPrivate::_q_updateStaysOnTopHint()
q->lower();
}
}
-#endif // QT_NO_ACTION
+#endif // QT_CONFIG(action)
}
/*!
diff --git a/src/widgets/widgets/qmenu.cpp b/src/widgets/widgets/qmenu.cpp
index abe4e485c0..cae776159d 100644
--- a/src/widgets/widgets/qmenu.cpp
+++ b/src/widgets/widgets/qmenu.cpp
@@ -157,10 +157,11 @@ public:
Q_D(QTornOffMenu);
if(menu != d->causedMenu)
return;
+ auto action = static_cast<QAction *>(act->action());
if (act->type() == QEvent::ActionAdded) {
- insertAction(act->before(), act->action());
+ insertAction(static_cast<QAction *>(act->before()), action);
} else if (act->type() == QEvent::ActionRemoved)
- removeAction(act->action());
+ removeAction(action);
}
void actionEvent(QActionEvent *e) override
{
@@ -403,7 +404,9 @@ void QMenuPrivate::updateActionRects(const QRect &screen) const
//calculate size
QFontMetrics qfm = q->fontMetrics();
bool previousWasSeparator = true; // this is true to allow removing the leading separators
+#if QT_CONFIG(shortcut)
const bool contextMenu = isContextMenu();
+#endif
for(int i = 0; i <= lastVisibleAction; i++) {
QAction *action = actions.at(i);
const bool isSection = action->isSeparator() && (!action->text().isEmpty() || !action->icon().isNull());
@@ -434,12 +437,12 @@ void QMenuPrivate::updateActionRects(const QRect &screen) const
if (t != -1) {
tabWidth = qMax(int(tabWidth), qfm.horizontalAdvance(s.mid(t+1)));
s = s.left(t);
- #ifndef QT_NO_SHORTCUT
+#if QT_CONFIG(shortcut)
} else if (action->isShortcutVisibleInContextMenu() || !contextMenu) {
QKeySequence seq = action->shortcut();
if (!seq.isEmpty())
tabWidth = qMax(int(tabWidth), qfm.horizontalAdvance(seq.toString(QKeySequence::NativeText)));
- #endif
+#endif
}
sz.setWidth(fm.boundingRect(QRect(), Qt::TextSingleLine | Qt::TextShowMnemonic, s).width());
sz.setHeight(qMax(fm.height(), qfm.height()));
@@ -1769,12 +1772,14 @@ QAction *QMenu::addAction(const QIcon &icon, const QString &text)
\sa QWidget::addAction()
*/
-QAction *QMenu::addAction(const QString &text, const QObject *receiver, const char* member, const QKeySequence &shortcut)
+QAction *QMenu::addAction(const QString &text, const QObject *receiver, const char* member
+#if QT_CONFIG(shortcut)
+ , const QKeySequence &shortcut
+#endif
+ )
{
QAction *action = new QAction(text, this);
-#ifdef QT_NO_SHORTCUT
- Q_UNUSED(shortcut);
-#else
+#if QT_CONFIG(shortcut)
action->setShortcut(shortcut);
#endif
QObject::connect(action, SIGNAL(triggered(bool)), receiver, member);
@@ -1862,12 +1867,14 @@ QAction *QMenu::addAction(const QString &text, const QObject *receiver, const ch
\sa QWidget::addAction()
*/
QAction *QMenu::addAction(const QIcon &icon, const QString &text, const QObject *receiver,
- const char* member, const QKeySequence &shortcut)
+ const char* member
+#if QT_CONFIG(shortcut)
+ , const QKeySequence &shortcut
+#endif
+ )
{
QAction *action = new QAction(icon, text, this);
-#ifdef QT_NO_SHORTCUT
- Q_UNUSED(shortcut);
-#else
+#if QT_CONFIG(shortcut)
action->setShortcut(shortcut);
#endif
QObject::connect(action, SIGNAL(triggered(bool)), receiver, member);
@@ -3559,15 +3566,16 @@ void QMenu::actionEvent(QActionEvent *e)
wa->releaseWidget(widget);
}
}
- d->widgetItems.remove(e->action());
+ d->widgetItems.remove(static_cast<QAction *>(e->action()));
}
if (!d->platformMenu.isNull()) {
+ auto action = static_cast<QAction *>(e->action());
if (e->type() == QEvent::ActionAdded) {
QPlatformMenuItem *beforeItem = e->before()
? d->platformMenu->menuItemForTag(reinterpret_cast<quintptr>(e->before()))
: nullptr;
- d->insertActionInPlatformMenu(e->action(), beforeItem);
+ d->insertActionInPlatformMenu(action, beforeItem);
} else if (e->type() == QEvent::ActionRemoved) {
QPlatformMenuItem *menuItem = d->platformMenu->menuItemForTag(reinterpret_cast<quintptr>(e->action()));
d->platformMenu->removeMenuItem(menuItem);
@@ -3575,7 +3583,7 @@ void QMenu::actionEvent(QActionEvent *e)
} else if (e->type() == QEvent::ActionChanged) {
QPlatformMenuItem *menuItem = d->platformMenu->menuItemForTag(reinterpret_cast<quintptr>(e->action()));
if (menuItem) {
- d->copyActionToPlatformItem(e->action(), menuItem);
+ d->copyActionToPlatformItem(action, menuItem);
d->platformMenu->syncMenuItem(menuItem);
}
}
diff --git a/src/widgets/widgets/qmenu.h b/src/widgets/widgets/qmenu.h
index 84ab9e027a..35d5a865ff 100644
--- a/src/widgets/widgets/qmenu.h
+++ b/src/widgets/widgets/qmenu.h
@@ -78,8 +78,17 @@ public:
using QWidget::addAction;
QAction *addAction(const QString &text);
QAction *addAction(const QIcon &icon, const QString &text);
- QAction *addAction(const QString &text, const QObject *receiver, const char* member, const QKeySequence &shortcut = 0);
- QAction *addAction(const QIcon &icon, const QString &text, const QObject *receiver, const char* member, const QKeySequence &shortcut = 0);
+
+ QAction *addAction(const QString &text, const QObject *receiver, const char* member
+#if QT_CONFIG(shortcut)
+ , const QKeySequence &shortcut = {}
+#endif
+ );
+ QAction *addAction(const QIcon &icon, const QString &text, const QObject *receiver, const char* member
+#if QT_CONFIG(shortcut)
+ , const QKeySequence &shortcut = {}
+#endif
+ );
#ifdef Q_CLANG_QDOC
template<typename Functor>
@@ -95,12 +104,14 @@ public:
template<class Obj, typename Func1>
inline typename std::enable_if<!std::is_same<const char*, Func1>::value
&& QtPrivate::IsPointerToTypeDerivedFromQObject<Obj*>::Value, QAction *>::type
- addAction(const QString &text, const Obj *object, Func1 slot, const QKeySequence &shortcut = 0)
+ addAction(const QString &text, const Obj *object, Func1 slot
+#if QT_CONFIG(shortcut)
+ , const QKeySequence &shortcut = {}
+#endif
+ )
{
QAction *result = addAction(text);
-#ifdef QT_NO_SHORTCUT
- Q_UNUSED(shortcut)
-#else
+#if QT_CONFIG(shortcut)
result->setShortcut(shortcut);
#endif
connect(result, &QAction::triggered, object, std::move(slot));
@@ -108,12 +119,14 @@ public:
}
// addAction(QString): Connect to a functor or function pointer (without context)
template <typename Func1>
- inline QAction *addAction(const QString &text, Func1 slot, const QKeySequence &shortcut = 0)
+ inline QAction *addAction(const QString &text, Func1 slot
+#if QT_CONFIG(shortcut)
+ , const QKeySequence &shortcut = {}
+#endif
+ )
{
QAction *result = addAction(text);
-#ifdef QT_NO_SHORTCUT
- Q_UNUSED(shortcut)
-#else
+#if QT_CONFIG(shortcut)
result->setShortcut(shortcut);
#endif
connect(result, &QAction::triggered, std::move(slot));
@@ -123,12 +136,15 @@ public:
template<class Obj, typename Func1>
inline typename std::enable_if<!std::is_same<const char*, Func1>::value
&& QtPrivate::IsPointerToTypeDerivedFromQObject<Obj*>::Value, QAction *>::type
- addAction(const QIcon &actionIcon, const QString &text, const Obj *object, Func1 slot, const QKeySequence &shortcut = 0)
+ addAction(const QIcon &actionIcon, const QString &text, const Obj *object, Func1 slot
+#if QT_CONFIG(shortcut)
+ , const QKeySequence &shortcut = {}
+#endif
+ )
+
{
QAction *result = addAction(actionIcon, text);
-#ifdef QT_NO_SHORTCUT
- Q_UNUSED(shortcut)
-#else
+#if QT_CONFIG(shortcut)
result->setShortcut(shortcut);
#endif
connect(result, &QAction::triggered, object, std::move(slot));
@@ -136,12 +152,14 @@ public:
}
// addAction(QIcon, QString): Connect to a functor or function pointer (without context)
template <typename Func1>
- inline QAction *addAction(const QIcon &actionIcon, const QString &text, Func1 slot, const QKeySequence &shortcut = 0)
+ inline QAction *addAction(const QIcon &actionIcon, const QString &text, Func1 slot
+#if QT_CONFIG(shortcut)
+ , const QKeySequence &shortcut = {}
+#endif
+ )
{
QAction *result = addAction(actionIcon, text);
-#ifdef QT_NO_SHORTCUT
- Q_UNUSED(shortcut)
-#else
+#if QT_CONFIG(shortcut)
result->setShortcut(shortcut);
#endif
connect(result, &QAction::triggered, std::move(slot));
diff --git a/src/widgets/widgets/qmenubar.cpp b/src/widgets/widgets/qmenubar.cpp
index 8724fa1a19..c8124468df 100644
--- a/src/widgets/widgets/qmenubar.cpp
+++ b/src/widgets/widgets/qmenubar.cpp
@@ -1289,21 +1289,22 @@ void QMenuBar::actionEvent(QActionEvent *e)
if (!nativeMenuBar)
return;
+ auto action = static_cast<QAction *>(e->action());
if (e->type() == QEvent::ActionAdded) {
- QPlatformMenu *menu = d->getPlatformMenu(e->action());
+ QPlatformMenu *menu = d->getPlatformMenu(action);
if (menu) {
- d->copyActionToPlatformMenu(e->action(), menu);
+ d->copyActionToPlatformMenu(action, menu);
- QPlatformMenu *beforeMenu = d->findInsertionPlatformMenu(e->action());
+ QPlatformMenu *beforeMenu = d->findInsertionPlatformMenu(action);
d->platformMenuBar->insertMenu(menu, beforeMenu);
}
} else if (e->type() == QEvent::ActionRemoved) {
- QPlatformMenu *menu = d->getPlatformMenu(e->action());
+ QPlatformMenu *menu = d->getPlatformMenu(action);
if (menu)
d->platformMenuBar->removeMenu(menu);
} else if (e->type() == QEvent::ActionChanged) {
QPlatformMenu *cur = d->platformMenuBar->menuForTag(reinterpret_cast<quintptr>(e->action()));
- QPlatformMenu *menu = d->getPlatformMenu(e->action());
+ QPlatformMenu *menu = d->getPlatformMenu(action);
// the menu associated with the action can change, need to
// remove and/or insert the new platform menu
@@ -1311,13 +1312,13 @@ void QMenuBar::actionEvent(QActionEvent *e)
if (cur)
d->platformMenuBar->removeMenu(cur);
if (menu) {
- d->copyActionToPlatformMenu(e->action(), menu);
+ d->copyActionToPlatformMenu(action, menu);
- QPlatformMenu *beforeMenu = d->findInsertionPlatformMenu(e->action());
+ QPlatformMenu *beforeMenu = d->findInsertionPlatformMenu(action);
d->platformMenuBar->insertMenu(menu, beforeMenu);
}
} else if (menu) {
- d->copyActionToPlatformMenu(e->action(), menu);
+ d->copyActionToPlatformMenu(action, menu);
d->platformMenuBar->syncMenu(menu);
}
}
diff --git a/src/widgets/widgets/qspinbox.cpp b/src/widgets/widgets/qspinbox.cpp
index cbd600ec6c..6ac2e1cec2 100644
--- a/src/widgets/widgets/qspinbox.cpp
+++ b/src/widgets/widgets/qspinbox.cpp
@@ -191,17 +191,6 @@ public:
The new text is passed in \a text with prefix() and suffix().
*/
-#if QT_DEPRECATED_SINCE(5, 14)
-/*!
- \fn void QSpinBox::valueChanged(const QString &text)
-
- \overload
- \obsolete Use textChanged(QString) instead
-
- The new value is passed in \a text with prefix() and suffix().
-*/
-#endif
-
/*!
Constructs a spin box with 0 as minimum value and 99 as maximum value, a
step value of 1. The value is initially set to 0. It is parented to \a
@@ -663,17 +652,6 @@ void QSpinBox::fixup(QString &input) const
The new text is passed in \a text with prefix() and suffix().
*/
-#if QT_DEPRECATED_SINCE(5, 14)
-/*!
- \fn void QDoubleSpinBox::valueChanged(const QString &text);
-
- \overload
- \obsolete Use textChanged(QString) instead
-
- The new value is passed in \a text with prefix() and suffix().
-*/
-#endif
-
/*!
Constructs a spin box with 0.0 as minimum value and 99.99 as maximum value,
a step value of 1.0 and a precision of 2 decimal places. The value is
@@ -1095,12 +1073,6 @@ void QSpinBoxPrivate::emitSignals(EmitPolicy ep, const QVariant &old)
if (ep != NeverEmit) {
pendingEmit = false;
if (ep == AlwaysEmit || value != old) {
-#if QT_DEPRECATED_SINCE(5, 14)
-QT_WARNING_PUSH
-QT_WARNING_DISABLE_DEPRECATED
- emit q->valueChanged(edit->displayText());
-QT_WARNING_POP
-#endif
emit q->textChanged(edit->displayText());
emit q->valueChanged(value.toInt());
}
@@ -1252,12 +1224,6 @@ void QDoubleSpinBoxPrivate::emitSignals(EmitPolicy ep, const QVariant &old)
if (ep != NeverEmit) {
pendingEmit = false;
if (ep == AlwaysEmit || value != old) {
-#if QT_DEPRECATED_SINCE(5, 14)
-QT_WARNING_PUSH
-QT_WARNING_DISABLE_DEPRECATED
- emit q->valueChanged(edit->displayText());
-QT_WARNING_POP
-#endif
emit q->textChanged(edit->displayText());
emit q->valueChanged(value.toDouble());
}
diff --git a/src/widgets/widgets/qspinbox.h b/src/widgets/widgets/qspinbox.h
index 762dd4a46a..be5357b028 100644
--- a/src/widgets/widgets/qspinbox.h
+++ b/src/widgets/widgets/qspinbox.h
@@ -107,10 +107,6 @@ public Q_SLOTS:
Q_SIGNALS:
void valueChanged(int);
void textChanged(const QString &);
-#if QT_DEPRECATED_SINCE(5, 14)
- QT_DEPRECATED_X("Use textChanged(QString) instead")
- void valueChanged(const QString &);
-#endif
private:
Q_DISABLE_COPY(QSpinBox)
@@ -173,10 +169,6 @@ public Q_SLOTS:
Q_SIGNALS:
void valueChanged(double);
void textChanged(const QString &);
-#if QT_DEPRECATED_SINCE(5, 14)
- QT_DEPRECATED_X("Use textChanged(QString) instead")
- void valueChanged(const QString &);
-#endif
private:
Q_DISABLE_COPY(QDoubleSpinBox)
diff --git a/src/widgets/widgets/qsplitter.h b/src/widgets/widgets/qsplitter.h
index ec980d9ee3..658914ae39 100644
--- a/src/widgets/widgets/qsplitter.h
+++ b/src/widgets/widgets/qsplitter.h
@@ -50,7 +50,6 @@ QT_BEGIN_NAMESPACE
class QSplitterPrivate;
class QTextStream;
-template <typename T> class QList;
class QSplitterHandle;
diff --git a/src/widgets/widgets/qtextbrowser.cpp b/src/widgets/widgets/qtextbrowser.cpp
index 78fde94fad..dac7a9a608 100644
--- a/src/widgets/widgets/qtextbrowser.cpp
+++ b/src/widgets/widgets/qtextbrowser.cpp
@@ -156,11 +156,6 @@ public:
{
Q_Q(QTextBrowser);
emit q->highlighted(url);
-#if QT_DEPRECATED_SINCE(5, 15)
-QT_WARNING_PUSH
-QT_WARNING_DISABLE_DEPRECATED
- emit q->highlighted(url.toString());
-#endif
}
};
Q_DECLARE_TYPEINFO(QTextBrowserPrivate::HistoryEntry, Q_MOVABLE_TYPE);
@@ -927,16 +922,6 @@ void QTextBrowser::doSetSource(const QUrl &url, QTextDocument::ResourceType type
anchor is passed in \a link.
*/
-/*! \fn void QTextBrowser::highlighted(const QString &link)
- \overload
- \obsolete
-
- Convenience signal that allows connecting to a slot
- that takes just a QString, like for example QStatusBar's
- message().
-*/
-
-
/*!
\fn void QTextBrowser::anchorClicked(const QUrl &link)
diff --git a/src/widgets/widgets/qtextbrowser.h b/src/widgets/widgets/qtextbrowser.h
index 4b3ec491ee..7f02999b02 100644
--- a/src/widgets/widgets/qtextbrowser.h
+++ b/src/widgets/widgets/qtextbrowser.h
@@ -107,10 +107,6 @@ Q_SIGNALS:
void historyChanged();
void sourceChanged(const QUrl &);
void highlighted(const QUrl &);
-#if QT_DEPRECATED_SINCE(5, 15)
- QT_DEPRECATED_VERSION_X_5_15("Use QTextBrowser::highlighted(QUrl) instead")
- void highlighted(const QString &);
-#endif
void anchorClicked(const QUrl &);
protected:
diff --git a/src/widgets/widgets/qtoolbar.cpp b/src/widgets/widgets/qtoolbar.cpp
index b4e90c7d71..f35c02f2fb 100644
--- a/src/widgets/widgets/qtoolbar.cpp
+++ b/src/widgets/widgets/qtoolbar.cpp
@@ -961,7 +961,7 @@ QAction *QToolBar::actionAt(const QPoint &p) const
void QToolBar::actionEvent(QActionEvent *event)
{
Q_D(QToolBar);
- QAction *action = event->action();
+ auto action = static_cast<QAction *>(event->action());
QWidgetAction *widgetAction = qobject_cast<QWidgetAction *>(action);
switch (event->type()) {
diff --git a/src/widgets/widgets/qtoolbarlayout.cpp b/src/widgets/widgets/qtoolbarlayout.cpp
index d77ba3c13e..93aded6876 100644
--- a/src/widgets/widgets/qtoolbarlayout.cpp
+++ b/src/widgets/widgets/qtoolbarlayout.cpp
@@ -207,7 +207,7 @@ void QToolBarLayout::insertAction(int index, QAction *action)
}
}
-int QToolBarLayout::indexOf(QAction *action) const
+int QToolBarLayout::indexOf(const QGuiAction *action) const
{
for (int i = 0; i < items.count(); ++i) {
if (items.at(i)->action == action)
diff --git a/src/widgets/widgets/qtoolbarlayout_p.h b/src/widgets/widgets/qtoolbarlayout_p.h
index b5dc121b93..1a406a3d29 100644
--- a/src/widgets/widgets/qtoolbarlayout_p.h
+++ b/src/widgets/widgets/qtoolbarlayout_p.h
@@ -96,7 +96,7 @@ public:
QSize sizeHint() const override;
void insertAction(int index, QAction *action);
- int indexOf(QAction *action) const;
+ int indexOf(const QGuiAction *action) const;
using QLayout::indexOf; // bring back the hidden members
bool layoutActions(const QSize &size);
diff --git a/src/widgets/widgets/qtoolbutton.cpp b/src/widgets/widgets/qtoolbutton.cpp
index 314c6ab40c..cfa4782d78 100644
--- a/src/widgets/widgets/qtoolbutton.cpp
+++ b/src/widgets/widgets/qtoolbutton.cpp
@@ -466,7 +466,7 @@ void QToolButton::paintEvent(QPaintEvent *)
void QToolButton::actionEvent(QActionEvent *event)
{
Q_D(QToolButton);
- QAction *action = event->action();
+ auto action = static_cast<QAction *>(event->action());
switch (event->type()) {
case QEvent::ActionChanged:
if (action == d->defaultAction)
diff --git a/src/widgets/widgets/qwidgettextcontrol.cpp b/src/widgets/widgets/qwidgettextcontrol.cpp
index 45ab384036..b68a216af5 100644
--- a/src/widgets/widgets/qwidgettextcontrol.cpp
+++ b/src/widgets/widgets/qwidgettextcontrol.cpp
@@ -92,7 +92,7 @@
#include <QtGui/qaccessible.h>
#include <QtCore/qmetaobject.h>
-#ifndef QT_NO_SHORTCUT
+#if QT_CONFIG(shortcut)
#include "private/qapplication_p.h"
#include "private/qshortcutmap_p.h"
#include <qkeysequence.h>
@@ -2512,7 +2512,7 @@ void QWidgetTextControl::setExtraSelections(const QList<QTextEdit::ExtraSelectio
emit updateRequest(r);
}
- for (QHash<int, int>::iterator it = hash.begin(); it != hash.end(); ++it) {
+ for (auto it = hash.cbegin(); it != hash.cend(); ++it) {
const QAbstractTextDocumentLayout::Selection &esel = d->extraSelections.at(it.value());
QRectF r = selectionRect(esel.cursor);
if (esel.format.boolProperty(QTextFormat::FullWidthSelection)) {