summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/CMakeLists.txt22
-rw-r--r--examples/corelib/CMakeLists.txt9
-rw-r--r--examples/corelib/bindableproperties/bindablesubscription/CMakeLists.txt13
-rw-r--r--examples/corelib/bindableproperties/subscription/CMakeLists.txt13
-rw-r--r--examples/corelib/ipc/CMakeLists.txt6
-rw-r--r--examples/corelib/ipc/localfortuneclient/CMakeLists.txt14
-rw-r--r--examples/corelib/ipc/localfortuneserver/CMakeLists.txt14
-rw-r--r--examples/corelib/ipc/sharedmemory/CMakeLists.txt13
-rw-r--r--examples/corelib/ipc/sharedmemory/dialog.cpp9
-rw-r--r--examples/corelib/mimetypes/CMakeLists.txt4
-rw-r--r--examples/corelib/mimetypes/mimetypebrowser/CMakeLists.txt12
-rw-r--r--examples/corelib/permissions/CMakeLists.txt45
-rw-r--r--examples/corelib/permissions/Info.plist59
-rw-r--r--examples/corelib/permissions/android/AndroidManifest.xml53
-rw-r--r--examples/corelib/permissions/main.cpp84
-rw-r--r--examples/corelib/platform/CMakeLists.txt2
-rw-r--r--examples/corelib/platform/androidnotifier/CMakeLists.txt6
-rw-r--r--examples/corelib/serialization/CMakeLists.txt2
-rw-r--r--examples/corelib/serialization/cbordump/CMakeLists.txt8
-rw-r--r--examples/corelib/serialization/cbordump/doc/images/cbordump.pngbin0 -> 48004 bytes
-rw-r--r--examples/corelib/serialization/cbordump/doc/src/cbordump.qdoc52
-rw-r--r--examples/corelib/serialization/cbordump/main.cpp4
-rw-r--r--examples/corelib/serialization/convert/CMakeLists.txt8
-rw-r--r--examples/corelib/serialization/convert/cborconverter.cpp14
-rw-r--r--examples/corelib/serialization/convert/doc/images/convert.pngbin0 -> 49201 bytes
-rw-r--r--examples/corelib/serialization/convert/doc/src/convert.qdoc80
-rw-r--r--examples/corelib/serialization/convert/main.cpp12
-rw-r--r--examples/corelib/serialization/savegame/CMakeLists.txt8
-rw-r--r--examples/corelib/serialization/savegame/doc/src/savegame.qdoc2
-rw-r--r--examples/corelib/threads/CMakeLists.txt4
-rw-r--r--examples/corelib/threads/mandelbrot/CMakeLists.txt12
-rw-r--r--examples/corelib/threads/queuedcustomtype/CMakeLists.txt12
-rw-r--r--examples/corelib/threads/semaphores/CMakeLists.txt8
-rw-r--r--examples/corelib/threads/waitconditions/CMakeLists.txt8
-rw-r--r--examples/corelib/tools/CMakeLists.txt4
-rw-r--r--examples/corelib/tools/contiguouscache/CMakeLists.txt12
-rw-r--r--examples/corelib/tools/customtype/CMakeLists.txt12
-rw-r--r--examples/corelib/tools/customtypesending/CMakeLists.txt12
-rw-r--r--examples/dbus/CMakeLists.txt6
-rw-r--r--examples/dbus/chat/CMakeLists.txt15
-rw-r--r--examples/dbus/chat/chat.cpp19
-rw-r--r--examples/dbus/complexpingpong/CMakeLists.txt6
-rw-r--r--examples/dbus/listnames/CMakeLists.txt10
-rw-r--r--examples/dbus/pingpong/CMakeLists.txt6
-rw-r--r--examples/dbus/remotecontrolledcar/car/CMakeLists.txt14
-rw-r--r--examples/dbus/remotecontrolledcar/controller/CMakeLists.txt15
-rw-r--r--examples/embedded/CMakeLists.txt4
-rw-r--r--examples/embedded/digiflip/CMakeLists.txt12
-rw-r--r--examples/embedded/flickable/CMakeLists.txt12
-rw-r--r--examples/embedded/flightinfo/CMakeLists.txt15
-rw-r--r--examples/embedded/lightmaps/CMakeLists.txt14
-rw-r--r--examples/embedded/raycasting/CMakeLists.txt12
-rw-r--r--examples/embedded/styleexample/CMakeLists.txt13
-rw-r--r--examples/gui/CMakeLists.txt4
-rw-r--r--examples/gui/analogclock/CMakeLists.txt10
-rw-r--r--examples/gui/rasterwindow/CMakeLists.txt10
-rw-r--r--examples/network/CMakeLists.txt14
-rw-r--r--examples/network/blockingfortuneclient/CMakeLists.txt14
-rw-r--r--examples/network/broadcastreceiver/CMakeLists.txt14
-rw-r--r--examples/network/broadcastsender/CMakeLists.txt14
-rw-r--r--examples/network/dnslookup/CMakeLists.txt10
-rw-r--r--examples/network/download/CMakeLists.txt10
-rw-r--r--examples/network/download/main.cpp2
-rw-r--r--examples/network/downloadmanager/CMakeLists.txt10
-rw-r--r--examples/network/fortuneclient/CMakeLists.txt14
-rw-r--r--examples/network/fortuneserver/CMakeLists.txt14
-rw-r--r--examples/network/googlesuggest/CMakeLists.txt14
-rw-r--r--examples/network/http/CMakeLists.txt15
-rw-r--r--examples/network/loopback/CMakeLists.txt14
-rw-r--r--examples/network/multicastreceiver/CMakeLists.txt14
-rw-r--r--examples/network/multicastsender/CMakeLists.txt14
-rw-r--r--examples/network/multistreamclient/CMakeLists.txt14
-rw-r--r--examples/network/multistreamserver/CMakeLists.txt14
-rw-r--r--examples/network/network-chat/CMakeLists.txt15
-rw-r--r--examples/network/network-chat/client.cpp2
-rw-r--r--examples/network/network-chat/peermanager.cpp2
-rw-r--r--examples/network/securesocketclient/CMakeLists.txt15
-rw-r--r--examples/network/secureudpclient/CMakeLists.txt15
-rw-r--r--examples/network/secureudpserver/CMakeLists.txt15
-rw-r--r--examples/network/secureudpserver/server.cpp2
-rw-r--r--examples/network/threadedfortuneserver/CMakeLists.txt14
-rw-r--r--examples/network/torrent/CMakeLists.txt15
-rw-r--r--examples/network/torrent/filemanager.cpp4
-rw-r--r--examples/network/torrent/mainwindow.cpp4
-rw-r--r--examples/network/torrent/ratecontroller.cpp4
-rw-r--r--examples/network/torrent/torrentclient.cpp32
-rw-r--r--examples/network/torrent/torrentserver.cpp2
-rw-r--r--examples/opengl/2dpainting/CMakeLists.txt16
-rw-r--r--examples/opengl/CMakeLists.txt4
-rw-r--r--examples/opengl/computegles31/CMakeLists.txt12
-rw-r--r--examples/opengl/contextinfo/CMakeLists.txt14
-rw-r--r--examples/opengl/contextinfo/widget.cpp2
-rw-r--r--examples/opengl/cube/CMakeLists.txt16
-rw-r--r--examples/opengl/hellogl2/CMakeLists.txt16
-rw-r--r--examples/opengl/hellogles3/CMakeLists.txt12
-rw-r--r--examples/opengl/hellowindow/CMakeLists.txt16
-rw-r--r--examples/opengl/openglwindow/CMakeLists.txt12
-rw-r--r--examples/opengl/paintedwindow/CMakeLists.txt12
-rw-r--r--examples/opengl/qopenglwidget/CMakeLists.txt16
-rw-r--r--examples/opengl/qopenglwidget/glwidget.cpp4
-rw-r--r--examples/opengl/qopenglwidget/mainwindow.cpp2
-rw-r--r--examples/opengl/qopenglwindow/CMakeLists.txt12
-rw-r--r--examples/opengl/textures/CMakeLists.txt16
-rw-r--r--examples/opengl/threadedqopenglwidget/CMakeLists.txt16
-rw-r--r--examples/qpa/CMakeLists.txt4
-rw-r--r--examples/qpa/qrasterwindow/CMakeLists.txt10
-rw-r--r--examples/qpa/windows/CMakeLists.txt14
-rw-r--r--examples/qtconcurrent/CMakeLists.txt8
-rw-r--r--examples/qtconcurrent/imagescaling/CMakeLists.txt17
-rw-r--r--examples/qtconcurrent/map/CMakeLists.txt12
-rw-r--r--examples/qtconcurrent/progressdialog/CMakeLists.txt14
-rw-r--r--examples/qtconcurrent/runfunction/CMakeLists.txt14
-rw-r--r--examples/qtconcurrent/wordcount/CMakeLists.txt14
-rw-r--r--examples/qtestlib/CMakeLists.txt4
-rw-r--r--examples/qtestlib/tutorial1/CMakeLists.txt14
-rw-r--r--examples/qtestlib/tutorial2/CMakeLists.txt14
-rw-r--r--examples/qtestlib/tutorial2/testqstring.cpp4
-rw-r--r--examples/qtestlib/tutorial3/CMakeLists.txt14
-rw-r--r--examples/qtestlib/tutorial4/CMakeLists.txt14
-rw-r--r--examples/qtestlib/tutorial4/testgui.cpp2
-rw-r--r--examples/qtestlib/tutorial5/CMakeLists.txt14
-rw-r--r--examples/qtestlib/tutorial5/benchmarking.cpp9
-rw-r--r--examples/sql/CMakeLists.txt6
-rw-r--r--examples/sql/books/CMakeLists.txt15
-rw-r--r--examples/sql/cachedtable/CMakeLists.txt14
-rw-r--r--examples/sql/drilldown/CMakeLists.txt14
-rw-r--r--examples/sql/masterdetail/CMakeLists.txt16
-rw-r--r--examples/sql/querymodel/CMakeLists.txt14
-rw-r--r--examples/sql/relationaltablemodel/CMakeLists.txt14
-rw-r--r--examples/sql/sqlbrowser/CMakeLists.txt15
-rw-r--r--examples/sql/sqlwidgetmapper/CMakeLists.txt14
-rw-r--r--examples/sql/tablemodel/CMakeLists.txt14
-rw-r--r--examples/vulkan/CMakeLists.txt6
-rw-r--r--examples/vulkan/hellovulkancubes/CMakeLists.txt14
-rw-r--r--examples/vulkan/hellovulkantexture/CMakeLists.txt10
-rw-r--r--examples/vulkan/hellovulkantriangle/CMakeLists.txt10
-rw-r--r--examples/vulkan/hellovulkanwidget/CMakeLists.txt12
-rw-r--r--examples/vulkan/hellovulkanwindow/CMakeLists.txt10
-rw-r--r--examples/widgets/CMakeLists.txt6
-rw-r--r--examples/widgets/animation/easing/CMakeLists.txt13
-rw-r--r--examples/widgets/animation/easing/animation.h4
-rw-r--r--examples/widgets/animation/easing/window.cpp2
-rw-r--r--examples/widgets/desktop/screenshot/CMakeLists.txt12
-rw-r--r--examples/widgets/desktop/systray/CMakeLists.txt12
-rw-r--r--examples/widgets/dialogs/CMakeLists.txt4
-rw-r--r--examples/widgets/dialogs/classwizard/CMakeLists.txt12
-rw-r--r--examples/widgets/dialogs/extension/CMakeLists.txt12
-rw-r--r--examples/widgets/dialogs/findfiles/CMakeLists.txt12
-rw-r--r--examples/widgets/dialogs/licensewizard/CMakeLists.txt14
-rw-r--r--examples/widgets/dialogs/standarddialogs/CMakeLists.txt12
-rw-r--r--examples/widgets/dialogs/standarddialogs/dialog.cpp59
-rw-r--r--examples/widgets/dialogs/standarddialogs/main.mm47
-rw-r--r--examples/widgets/dialogs/tabdialog/CMakeLists.txt12
-rw-r--r--examples/widgets/dialogs/trivialwizard/CMakeLists.txt12
-rw-r--r--examples/widgets/doc/dropsite.qdoc4
-rw-r--r--examples/widgets/doc/src/i18n.qdoc16
-rw-r--r--examples/widgets/doc/src/shortcuteditor.qdoc230
-rw-r--r--examples/widgets/draganddrop/CMakeLists.txt2
-rw-r--r--examples/widgets/draganddrop/draggableicons/CMakeLists.txt12
-rw-r--r--examples/widgets/draganddrop/draggabletext/CMakeLists.txt12
-rw-r--r--examples/widgets/draganddrop/dropsite/CMakeLists.txt12
-rw-r--r--examples/widgets/draganddrop/dropsite/droparea.cpp10
-rw-r--r--examples/widgets/draganddrop/dropsite/droparea.h3
-rw-r--r--examples/widgets/draganddrop/dropsite/dropsitewindow.cpp40
-rw-r--r--examples/widgets/draganddrop/fridgemagnets/CMakeLists.txt12
-rw-r--r--examples/widgets/draganddrop/puzzle/CMakeLists.txt12
-rw-r--r--examples/widgets/effects/blurpicker/CMakeLists.txt12
-rw-r--r--examples/widgets/effects/fademessage/CMakeLists.txt12
-rw-r--r--examples/widgets/gallery/CMakeLists.txt12
-rw-r--r--examples/widgets/gestures/CMakeLists.txt4
-rw-r--r--examples/widgets/gestures/imagegestures/CMakeLists.txt12
-rw-r--r--examples/widgets/graphicsview/CMakeLists.txt2
-rw-r--r--examples/widgets/graphicsview/anchorlayout/CMakeLists.txt12
-rw-r--r--examples/widgets/graphicsview/basicgraphicslayouts/CMakeLists.txt12
-rw-r--r--examples/widgets/graphicsview/chip/CMakeLists.txt16
-rw-r--r--examples/widgets/graphicsview/collidingmice/CMakeLists.txt12
-rw-r--r--examples/widgets/graphicsview/diagramscene/CMakeLists.txt12
-rw-r--r--examples/widgets/graphicsview/diagramscene/diagramitem.cpp4
-rw-r--r--examples/widgets/graphicsview/diagramscene/mainwindow.cpp4
-rw-r--r--examples/widgets/graphicsview/dragdroprobot/CMakeLists.txt12
-rw-r--r--examples/widgets/graphicsview/elasticnodes/CMakeLists.txt12
-rw-r--r--examples/widgets/graphicsview/elasticnodes/graphwidget.cpp4
-rw-r--r--examples/widgets/graphicsview/elasticnodes/node.cpp4
-rw-r--r--examples/widgets/graphicsview/embeddeddialogs/CMakeLists.txt13
-rw-r--r--examples/widgets/graphicsview/flowlayout/CMakeLists.txt12
-rw-r--r--examples/widgets/graphicsview/flowlayout/flowlayout.cpp6
-rw-r--r--examples/widgets/graphicsview/simpleanchorlayout/CMakeLists.txt12
-rw-r--r--examples/widgets/graphicsview/weatheranchorlayout/CMakeLists.txt12
-rw-r--r--examples/widgets/itemviews/CMakeLists.txt4
-rw-r--r--examples/widgets/itemviews/addressbook/CMakeLists.txt12
-rw-r--r--examples/widgets/itemviews/addressbook/addresswidget.cpp2
-rw-r--r--examples/widgets/itemviews/basicsortfiltermodel/CMakeLists.txt12
-rw-r--r--examples/widgets/itemviews/chart/CMakeLists.txt12
-rw-r--r--examples/widgets/itemviews/coloreditorfactory/CMakeLists.txt12
-rw-r--r--examples/widgets/itemviews/combowidgetmapper/CMakeLists.txt12
-rw-r--r--examples/widgets/itemviews/customsortfiltermodel/CMakeLists.txt12
-rw-r--r--examples/widgets/itemviews/dirview/CMakeLists.txt12
-rw-r--r--examples/widgets/itemviews/editabletreemodel/CMakeLists.txt13
-rw-r--r--examples/widgets/itemviews/editabletreemodel/treeitem.cpp4
-rw-r--r--examples/widgets/itemviews/fetchmore/CMakeLists.txt12
-rw-r--r--examples/widgets/itemviews/flattreeview/CMakeLists.txt12
-rw-r--r--examples/widgets/itemviews/frozencolumn/CMakeLists.txt12
-rw-r--r--examples/widgets/itemviews/interview/CMakeLists.txt12
-rw-r--r--examples/widgets/itemviews/pixelator/CMakeLists.txt16
-rw-r--r--examples/widgets/itemviews/puzzle/CMakeLists.txt12
-rw-r--r--examples/widgets/itemviews/simpledommodel/CMakeLists.txt14
-rw-r--r--examples/widgets/itemviews/simpletreemodel/CMakeLists.txt12
-rw-r--r--examples/widgets/itemviews/simplewidgetmapper/CMakeLists.txt12
-rw-r--r--examples/widgets/itemviews/spinboxdelegate/CMakeLists.txt12
-rw-r--r--examples/widgets/itemviews/spreadsheet/CMakeLists.txt20
-rw-r--r--examples/widgets/itemviews/stardelegate/CMakeLists.txt12
-rw-r--r--examples/widgets/itemviews/storageview/CMakeLists.txt12
-rw-r--r--examples/widgets/layouts/CMakeLists.txt2
-rw-r--r--examples/widgets/layouts/basiclayouts/CMakeLists.txt12
-rw-r--r--examples/widgets/layouts/borderlayout/CMakeLists.txt12
-rw-r--r--examples/widgets/layouts/dynamiclayouts/CMakeLists.txt12
-rw-r--r--examples/widgets/layouts/dynamiclayouts/dialog.cpp2
-rw-r--r--examples/widgets/layouts/flowlayout/CMakeLists.txt12
-rw-r--r--examples/widgets/layouts/flowlayout/flowlayout.cpp4
-rw-r--r--examples/widgets/mainwindows/CMakeLists.txt2
-rw-r--r--examples/widgets/mainwindows/application/CMakeLists.txt12
-rw-r--r--examples/widgets/mainwindows/dockwidgets/CMakeLists.txt20
-rw-r--r--examples/widgets/mainwindows/mainwindow/CMakeLists.txt12
-rw-r--r--examples/widgets/mainwindows/mainwindow/colorswatch.cpp2
-rw-r--r--examples/widgets/mainwindows/mdi/CMakeLists.txt12
-rw-r--r--examples/widgets/mainwindows/menus/CMakeLists.txt12
-rw-r--r--examples/widgets/mainwindows/sdi/CMakeLists.txt12
-rw-r--r--examples/widgets/painting/CMakeLists.txt2
-rw-r--r--examples/widgets/painting/affine/CMakeLists.txt14
-rw-r--r--examples/widgets/painting/basicdrawing/CMakeLists.txt12
-rw-r--r--examples/widgets/painting/composition/CMakeLists.txt14
-rw-r--r--examples/widgets/painting/concentriccircles/CMakeLists.txt12
-rw-r--r--examples/widgets/painting/deform/CMakeLists.txt14
-rw-r--r--examples/widgets/painting/fontsampler/CMakeLists.txt17
-rw-r--r--examples/widgets/painting/fontsampler/mainwindow.cpp4
-rw-r--r--examples/widgets/painting/gradients/CMakeLists.txt14
-rw-r--r--examples/widgets/painting/gradients/gradients.cpp2
-rw-r--r--examples/widgets/painting/imagecomposition/CMakeLists.txt12
-rw-r--r--examples/widgets/painting/painterpaths/CMakeLists.txt12
-rw-r--r--examples/widgets/painting/painterpaths/window.cpp10
-rw-r--r--examples/widgets/painting/pathstroke/CMakeLists.txt14
-rw-r--r--examples/widgets/painting/shared/CMakeLists.txt8
-rw-r--r--examples/widgets/painting/shared/hoverpoints.cpp2
-rw-r--r--examples/widgets/painting/shared/use_lib.cmake2
-rw-r--r--examples/widgets/painting/transformations/CMakeLists.txt12
-rw-r--r--examples/widgets/richtext/CMakeLists.txt2
-rw-r--r--examples/widgets/richtext/calendar/CMakeLists.txt12
-rw-r--r--examples/widgets/richtext/orderform/CMakeLists.txt16
-rw-r--r--examples/widgets/richtext/syntaxhighlighter/CMakeLists.txt12
-rw-r--r--examples/widgets/richtext/syntaxhighlighter/highlighter.cpp2
-rw-r--r--examples/widgets/richtext/textedit/CMakeLists.txt18
-rw-r--r--examples/widgets/scroller/graphicsview/CMakeLists.txt12
-rw-r--r--examples/widgets/tools/CMakeLists.txt5
-rw-r--r--examples/widgets/tools/completer/CMakeLists.txt12
-rw-r--r--examples/widgets/tools/customcompleter/CMakeLists.txt12
-rw-r--r--examples/widgets/tools/echoplugin/CMakeLists.txt6
-rw-r--r--examples/widgets/tools/echoplugin/echowindow/CMakeLists.txt8
-rw-r--r--examples/widgets/tools/echoplugin/plugin/CMakeLists.txt8
-rw-r--r--examples/widgets/tools/i18n/CMakeLists.txt63
-rw-r--r--examples/widgets/tools/i18n/i18n.pro27
-rw-r--r--examples/widgets/tools/i18n/i18n.qrc18
-rw-r--r--examples/widgets/tools/i18n/languagechooser.cpp139
-rw-r--r--examples/widgets/tools/i18n/languagechooser.h49
-rw-r--r--examples/widgets/tools/i18n/main.cpp17
-rw-r--r--examples/widgets/tools/i18n/mainwindow.cpp66
-rw-r--r--examples/widgets/tools/i18n/mainwindow.h39
-rw-r--r--examples/widgets/tools/i18n/translations/i18n_ar.qmbin736 -> 0 bytes
-rw-r--r--examples/widgets/tools/i18n/translations/i18n_ar.ts57
-rw-r--r--examples/widgets/tools/i18n/translations/i18n_cs.qmbin796 -> 0 bytes
-rw-r--r--examples/widgets/tools/i18n/translations/i18n_cs.ts57
-rw-r--r--examples/widgets/tools/i18n/translations/i18n_de.qmbin848 -> 0 bytes
-rw-r--r--examples/widgets/tools/i18n/translations/i18n_de.ts57
-rw-r--r--examples/widgets/tools/i18n/translations/i18n_el.qmbin804 -> 0 bytes
-rw-r--r--examples/widgets/tools/i18n/translations/i18n_el.ts57
-rw-r--r--examples/widgets/tools/i18n/translations/i18n_en.qmbin810 -> 0 bytes
-rw-r--r--examples/widgets/tools/i18n/translations/i18n_en.ts57
-rw-r--r--examples/widgets/tools/i18n/translations/i18n_eo.qmbin806 -> 0 bytes
-rw-r--r--examples/widgets/tools/i18n/translations/i18n_eo.ts57
-rw-r--r--examples/widgets/tools/i18n/translations/i18n_fr.qmbin844 -> 0 bytes
-rw-r--r--examples/widgets/tools/i18n/translations/i18n_fr.ts57
-rw-r--r--examples/widgets/tools/i18n/translations/i18n_it.qmbin808 -> 0 bytes
-rw-r--r--examples/widgets/tools/i18n/translations/i18n_it.ts57
-rw-r--r--examples/widgets/tools/i18n/translations/i18n_jp.qmbin722 -> 0 bytes
-rw-r--r--examples/widgets/tools/i18n/translations/i18n_jp.ts57
-rw-r--r--examples/widgets/tools/i18n/translations/i18n_ko.qmbin690 -> 0 bytes
-rw-r--r--examples/widgets/tools/i18n/translations/i18n_ko.ts57
-rw-r--r--examples/widgets/tools/i18n/translations/i18n_no.qmbin804 -> 0 bytes
-rw-r--r--examples/widgets/tools/i18n/translations/i18n_no.ts57
-rw-r--r--examples/widgets/tools/i18n/translations/i18n_ru.qmbin806 -> 0 bytes
-rw-r--r--examples/widgets/tools/i18n/translations/i18n_ru.ts59
-rw-r--r--examples/widgets/tools/i18n/translations/i18n_sv.qmbin814 -> 0 bytes
-rw-r--r--examples/widgets/tools/i18n/translations/i18n_sv.ts57
-rw-r--r--examples/widgets/tools/i18n/translations/i18n_zh.qmbin700 -> 0 bytes
-rw-r--r--examples/widgets/tools/i18n/translations/i18n_zh.ts57
-rw-r--r--examples/widgets/tools/plugandpaint/CMakeLists.txt6
-rw-r--r--examples/widgets/tools/plugandpaint/app/CMakeLists.txt4
-rw-r--r--examples/widgets/tools/plugandpaint/plugins/basictools/CMakeLists.txt8
-rw-r--r--examples/widgets/tools/plugandpaint/plugins/extrafilters/CMakeLists.txt8
-rw-r--r--examples/widgets/tools/regularexpression/CMakeLists.txt12
-rw-r--r--examples/widgets/tools/settingseditor/CMakeLists.txt12
-rw-r--r--examples/widgets/tools/styleplugin/CMakeLists.txt6
-rw-r--r--examples/widgets/tools/styleplugin/plugin/CMakeLists.txt8
-rw-r--r--examples/widgets/tools/styleplugin/stylewindow/CMakeLists.txt8
-rw-r--r--examples/widgets/tools/tools.pro3
-rw-r--r--examples/widgets/tools/treemodelcompleter/CMakeLists.txt12
-rw-r--r--examples/widgets/tools/undo/CMakeLists.txt13
-rw-r--r--examples/widgets/tools/undoframework/CMakeLists.txt12
-rw-r--r--examples/widgets/touch/CMakeLists.txt4
-rw-r--r--examples/widgets/touch/dials/CMakeLists.txt13
-rw-r--r--examples/widgets/touch/fingerpaint/CMakeLists.txt20
-rw-r--r--examples/widgets/touch/knobs/CMakeLists.txt12
-rw-r--r--examples/widgets/touch/pinchzoom/CMakeLists.txt12
-rw-r--r--examples/widgets/tutorials/CMakeLists.txt2
-rw-r--r--examples/widgets/tutorials/addressbook/CMakeLists.txt2
-rw-r--r--examples/widgets/tutorials/addressbook/part1/CMakeLists.txt12
-rw-r--r--examples/widgets/tutorials/addressbook/part2/CMakeLists.txt12
-rw-r--r--examples/widgets/tutorials/addressbook/part3/CMakeLists.txt12
-rw-r--r--examples/widgets/tutorials/addressbook/part4/CMakeLists.txt12
-rw-r--r--examples/widgets/tutorials/addressbook/part5/CMakeLists.txt12
-rw-r--r--examples/widgets/tutorials/addressbook/part6/CMakeLists.txt12
-rw-r--r--examples/widgets/tutorials/addressbook/part7/CMakeLists.txt12
-rw-r--r--examples/widgets/tutorials/gettingStarted/gsQt/CMakeLists.txt2
-rw-r--r--examples/widgets/tutorials/gettingStarted/gsQt/part1/CMakeLists.txt12
-rw-r--r--examples/widgets/tutorials/gettingStarted/gsQt/part2/CMakeLists.txt12
-rw-r--r--examples/widgets/tutorials/gettingStarted/gsQt/part3/CMakeLists.txt12
-rw-r--r--examples/widgets/tutorials/gettingStarted/gsQt/part4/CMakeLists.txt12
-rw-r--r--examples/widgets/tutorials/gettingStarted/gsQt/part5/CMakeLists.txt12
-rw-r--r--examples/widgets/tutorials/modelview/1_readonly/CMakeLists.txt12
-rw-r--r--examples/widgets/tutorials/modelview/2_formatting/CMakeLists.txt12
-rw-r--r--examples/widgets/tutorials/modelview/3_changingmodel/CMakeLists.txt12
-rw-r--r--examples/widgets/tutorials/modelview/4_headers/CMakeLists.txt12
-rw-r--r--examples/widgets/tutorials/modelview/5_edit/CMakeLists.txt12
-rw-r--r--examples/widgets/tutorials/modelview/6_treeview/CMakeLists.txt12
-rw-r--r--examples/widgets/tutorials/modelview/7_selections/CMakeLists.txt12
-rw-r--r--examples/widgets/tutorials/modelview/CMakeLists.txt2
-rw-r--r--examples/widgets/tutorials/notepad/CMakeLists.txt17
-rw-r--r--examples/widgets/tutorials/widgets/CMakeLists.txt2
-rw-r--r--examples/widgets/tutorials/widgets/childwidget/CMakeLists.txt12
-rw-r--r--examples/widgets/tutorials/widgets/nestedlayouts/CMakeLists.txt12
-rw-r--r--examples/widgets/tutorials/widgets/toplevel/CMakeLists.txt12
-rw-r--r--examples/widgets/tutorials/widgets/windowlayout/CMakeLists.txt12
-rw-r--r--examples/widgets/widgets/CMakeLists.txt3
-rw-r--r--examples/widgets/widgets/analogclock/CMakeLists.txt12
-rw-r--r--examples/widgets/widgets/calculator/CMakeLists.txt12
-rw-r--r--examples/widgets/widgets/calendarwidget/CMakeLists.txt12
-rw-r--r--examples/widgets/widgets/charactermap/CMakeLists.txt12
-rw-r--r--examples/widgets/widgets/codeeditor/CMakeLists.txt12
-rw-r--r--examples/widgets/widgets/digitalclock/CMakeLists.txt12
-rw-r--r--examples/widgets/widgets/elidedlabel/CMakeLists.txt12
-rw-r--r--examples/widgets/widgets/groupbox/CMakeLists.txt12
-rw-r--r--examples/widgets/widgets/icons/CMakeLists.txt12
-rw-r--r--examples/widgets/widgets/imageviewer/CMakeLists.txt20
-rw-r--r--examples/widgets/widgets/lineedits/CMakeLists.txt12
-rw-r--r--examples/widgets/widgets/mousebuttons/CMakeLists.txt12
-rw-r--r--examples/widgets/widgets/movie/CMakeLists.txt12
-rw-r--r--examples/widgets/widgets/scribble/CMakeLists.txt20
-rw-r--r--examples/widgets/widgets/scribble/mainwindow.cpp2
-rw-r--r--examples/widgets/widgets/shapedclock/CMakeLists.txt12
-rw-r--r--examples/widgets/widgets/shortcuteditor/CMakeLists.txt39
-rw-r--r--examples/widgets/widgets/shortcuteditor/actionmanager.cpp57
-rw-r--r--examples/widgets/widgets/shortcuteditor/actionmanager.h33
-rw-r--r--examples/widgets/widgets/shortcuteditor/application.cpp15
-rw-r--r--examples/widgets/widgets/shortcuteditor/application.h27
-rw-r--r--examples/widgets/widgets/shortcuteditor/main.cpp13
-rw-r--r--examples/widgets/widgets/shortcuteditor/mainwindow.cpp46
-rw-r--r--examples/widgets/widgets/shortcuteditor/mainwindow.h22
-rw-r--r--examples/widgets/widgets/shortcuteditor/shortcuteditordelegate.cpp71
-rw-r--r--examples/widgets/widgets/shortcuteditor/shortcuteditordelegate.h34
-rw-r--r--examples/widgets/widgets/shortcuteditor/shortcuteditormodel.cpp273
-rw-r--r--examples/widgets/widgets/shortcuteditor/shortcuteditormodel.h71
-rw-r--r--examples/widgets/widgets/shortcuteditor/shortcuteditorwidget.cpp33
-rw-r--r--examples/widgets/widgets/shortcuteditor/shortcuteditorwidget.h32
-rw-r--r--examples/widgets/widgets/sliders/CMakeLists.txt12
-rw-r--r--examples/widgets/widgets/spinboxes/CMakeLists.txt12
-rw-r--r--examples/widgets/widgets/styles/CMakeLists.txt12
-rw-r--r--examples/widgets/widgets/stylesheet/CMakeLists.txt13
-rw-r--r--examples/widgets/widgets/stylesheet/mainwindow.cpp1
-rw-r--r--examples/widgets/widgets/stylesheet/qss/coffee.qss5
-rw-r--r--examples/widgets/widgets/tablet/CMakeLists.txt12
-rw-r--r--examples/widgets/widgets/tetrix/CMakeLists.txt12
-rw-r--r--examples/widgets/widgets/tooltips/CMakeLists.txt12
-rw-r--r--examples/widgets/widgets/tooltips/sortingbox.cpp2
-rw-r--r--examples/widgets/widgets/validators/CMakeLists.txt13
-rw-r--r--examples/widgets/widgets/wiggly/CMakeLists.txt12
-rw-r--r--examples/widgets/widgets/windowflags/CMakeLists.txt12
-rw-r--r--examples/widgets/windowcontainer/CMakeLists.txt14
-rw-r--r--examples/xml/CMakeLists.txt6
-rw-r--r--examples/xml/dombookmarks/CMakeLists.txt14
-rw-r--r--examples/xml/htmlinfo/CMakeLists.txt8
-rw-r--r--examples/xml/htmlinfo/main.cpp2
-rw-r--r--examples/xml/rsslisting/CMakeLists.txt16
-rw-r--r--examples/xml/streambookmarks/CMakeLists.txt14
-rw-r--r--examples/xml/xmlstreamlint/CMakeLists.txt10
393 files changed, 3202 insertions, 3012 deletions
diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt
index 3e75b65f6e..2bc1e4d378 100644
--- a/examples/CMakeLists.txt
+++ b/examples/CMakeLists.txt
@@ -1,39 +1,39 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
qt_examples_build_begin(EXTERNAL_BUILD)
add_subdirectory(corelib)
add_subdirectory(embedded)
add_subdirectory(qpa)
-if(TARGET Qt::DBus)
+if(TARGET Qt6::DBus)
add_subdirectory(dbus)
endif()
-if(TARGET Qt::Network)
+if(TARGET Qt6::Network)
add_subdirectory(network)
endif()
-if(TARGET Qt::Test)
+if(TARGET Qt6::Test)
add_subdirectory(qtestlib)
endif()
-if(TARGET Qt::Concurrent)
+if(TARGET Qt6::Concurrent)
add_subdirectory(qtconcurrent)
endif()
-if(TARGET Qt::Sql)
+if(TARGET Qt6::Sql)
add_subdirectory(sql)
endif()
-if(TARGET Qt::Widgets)
+if(TARGET Qt6::Widgets)
add_subdirectory(widgets)
endif()
-if(TARGET Qt::Xml)
+if(TARGET Qt6::Xml)
add_subdirectory(xml)
endif()
-if(TARGET Qt::Gui)
+if(TARGET Qt6::Gui)
add_subdirectory(gui)
endif()
-if(QT_FEATURE_opengl AND TARGET Qt::Gui)
+if(QT_FEATURE_opengl AND TARGET Qt6::Gui)
add_subdirectory(opengl)
endif()
-if(QT_FEATURE_vulkan AND TARGET Qt::Gui)
+if(QT_FEATURE_vulkan AND TARGET Qt6::Gui)
add_subdirectory(vulkan)
endif()
diff --git a/examples/corelib/CMakeLists.txt b/examples/corelib/CMakeLists.txt
index e176d9aede..638db2dda9 100644
--- a/examples/corelib/CMakeLists.txt
+++ b/examples/corelib/CMakeLists.txt
@@ -1,12 +1,17 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
-add_subdirectory(bindableproperties)
add_subdirectory(ipc)
add_subdirectory(mimetypes)
add_subdirectory(serialization)
add_subdirectory(tools)
add_subdirectory(platform)
+if(QT_FEATURE_permissions)
+ add_subdirectory(permissions)
+endif()
if(QT_FEATURE_thread)
add_subdirectory(threads)
endif()
+if(QT_FEATURE_widgets)
+ add_subdirectory(bindableproperties)
+endif()
diff --git a/examples/corelib/bindableproperties/bindablesubscription/CMakeLists.txt b/examples/corelib/bindableproperties/bindablesubscription/CMakeLists.txt
index bfc794b4b5..28bf806c4f 100644
--- a/examples/corelib/bindableproperties/bindablesubscription/CMakeLists.txt
+++ b/examples/corelib/bindableproperties/bindablesubscription/CMakeLists.txt
@@ -1,12 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(bindablesubscription LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTOUIC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -15,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/corelib/bindableproperties/bindab
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(bindablesubscription
../shared/subscriptionwindow.cpp ../shared/subscriptionwindow.h ../shared/subscriptionwindow.ui
main.cpp
@@ -23,9 +22,9 @@ qt_add_executable(bindablesubscription
)
target_link_libraries(bindablesubscription PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
# Resources:
diff --git a/examples/corelib/bindableproperties/subscription/CMakeLists.txt b/examples/corelib/bindableproperties/subscription/CMakeLists.txt
index b4d5923b43..116eb2d9ea 100644
--- a/examples/corelib/bindableproperties/subscription/CMakeLists.txt
+++ b/examples/corelib/bindableproperties/subscription/CMakeLists.txt
@@ -1,12 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(subscription LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTOUIC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -15,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/corelib/bindableproperties/subscr
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(subscription
../shared/subscriptionwindow.cpp ../shared/subscriptionwindow.h ../shared/subscriptionwindow.ui
main.cpp
@@ -23,9 +22,9 @@ qt_add_executable(subscription
)
target_link_libraries(subscription PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
# Resources:
diff --git a/examples/corelib/ipc/CMakeLists.txt b/examples/corelib/ipc/CMakeLists.txt
index 4b799fc429..d1cfc7bc1b 100644
--- a/examples/corelib/ipc/CMakeLists.txt
+++ b/examples/corelib/ipc/CMakeLists.txt
@@ -1,13 +1,13 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
-if(NOT TARGET Qt::Widgets)
+if(NOT TARGET Qt6::Widgets)
return()
endif()
if(QT_FEATURE_sharedmemory)
qt_internal_add_example(sharedmemory)
endif()
-if(QT_FEATURE_localserver AND TARGET Qt::Network)
+if(QT_FEATURE_localserver AND TARGET Qt6::Network)
qt_internal_add_example(localfortuneserver)
qt_internal_add_example(localfortuneclient)
endif()
diff --git a/examples/corelib/ipc/localfortuneclient/CMakeLists.txt b/examples/corelib/ipc/localfortuneclient/CMakeLists.txt
index 5f0cdc288a..e8c434df08 100644
--- a/examples/corelib/ipc/localfortuneclient/CMakeLists.txt
+++ b/examples/corelib/ipc/localfortuneclient/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(localfortuneclient LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/corelib/ipc/localfortuneclient")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Network Widgets)
+qt_standard_project_setup()
+
qt_add_executable(localfortuneclient
client.cpp client.h
main.cpp
@@ -25,10 +25,10 @@ set_target_properties(localfortuneclient PROPERTIES
)
target_link_libraries(localfortuneclient PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Network
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Network
+ Qt6::Widgets
)
install(TARGETS localfortuneclient
diff --git a/examples/corelib/ipc/localfortuneserver/CMakeLists.txt b/examples/corelib/ipc/localfortuneserver/CMakeLists.txt
index 8119e066ea..75ba716c37 100644
--- a/examples/corelib/ipc/localfortuneserver/CMakeLists.txt
+++ b/examples/corelib/ipc/localfortuneserver/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(localfortuneserver LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/corelib/ipc/localfortuneserver")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Network Widgets)
+qt_standard_project_setup()
+
qt_add_executable(localfortuneserver
main.cpp
server.cpp server.h
@@ -25,10 +25,10 @@ set_target_properties(localfortuneserver PROPERTIES
)
target_link_libraries(localfortuneserver PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Network
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Network
+ Qt6::Widgets
)
install(TARGETS localfortuneserver
diff --git a/examples/corelib/ipc/sharedmemory/CMakeLists.txt b/examples/corelib/ipc/sharedmemory/CMakeLists.txt
index b75a350beb..a3d9acee1d 100644
--- a/examples/corelib/ipc/sharedmemory/CMakeLists.txt
+++ b/examples/corelib/ipc/sharedmemory/CMakeLists.txt
@@ -1,12 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(sharedmemory LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTOUIC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -15,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/corelib/ipc/sharedmemory")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(sharedmemory
dialog.cpp dialog.h dialog.ui
main.cpp
@@ -26,9 +25,9 @@ set_target_properties(sharedmemory PROPERTIES
)
target_link_libraries(sharedmemory PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
install(TARGETS sharedmemory
diff --git a/examples/corelib/ipc/sharedmemory/dialog.cpp b/examples/corelib/ipc/sharedmemory/dialog.cpp
index 67e4f012a3..b656cc0c67 100644
--- a/examples/corelib/ipc/sharedmemory/dialog.cpp
+++ b/examples/corelib/ipc/sharedmemory/dialog.cpp
@@ -89,8 +89,13 @@ void Dialog::loadFromFile()
int size = buffer.size();
if (!sharedMemory.create(size)) {
- ui.label->setText(tr("Unable to create shared memory segment."));
- return;
+ if (sharedMemory.error() == QSharedMemory::AlreadyExists) {
+ sharedMemory.attach();
+ } else {
+ ui.label->setText(tr("Unable to create or attach to shared memory segment: %1")
+ .arg(sharedMemory.errorString()));
+ return;
+ }
}
sharedMemory.lock();
char *to = (char*)sharedMemory.data();
diff --git a/examples/corelib/mimetypes/CMakeLists.txt b/examples/corelib/mimetypes/CMakeLists.txt
index fbdf742435..9ba3873bf4 100644
--- a/examples/corelib/mimetypes/CMakeLists.txt
+++ b/examples/corelib/mimetypes/CMakeLists.txt
@@ -1,6 +1,6 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
-if(TARGET Qt::Widgets)
+if(TARGET Qt6::Widgets)
qt_internal_add_example(mimetypebrowser)
endif()
diff --git a/examples/corelib/mimetypes/mimetypebrowser/CMakeLists.txt b/examples/corelib/mimetypes/mimetypebrowser/CMakeLists.txt
index 0df4aa7000..4865847fb7 100644
--- a/examples/corelib/mimetypes/mimetypebrowser/CMakeLists.txt
+++ b/examples/corelib/mimetypes/mimetypebrowser/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(mimetypebrowser LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/corelib/mimetypes/mimetypebrowser
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(mimetypebrowser
main.cpp
mainwindow.cpp mainwindow.h
@@ -26,9 +26,9 @@ set_target_properties(mimetypebrowser PROPERTIES
)
target_link_libraries(mimetypebrowser PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
install(TARGETS mimetypebrowser
diff --git a/examples/corelib/permissions/CMakeLists.txt b/examples/corelib/permissions/CMakeLists.txt
new file mode 100644
index 0000000000..e0e4779097
--- /dev/null
+++ b/examples/corelib/permissions/CMakeLists.txt
@@ -0,0 +1,45 @@
+# Copyright (C) 2022 The Qt Company Ltd.
+# SPDX-License-Identifier: BSD-3-Clause
+
+cmake_minimum_required(VERSION 3.16)
+project(permissions LANGUAGES CXX)
+
+if(NOT DEFINED INSTALL_EXAMPLESDIR)
+ set(INSTALL_EXAMPLESDIR "examples")
+endif()
+
+set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/corelib/permissions")
+
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+
+qt_standard_project_setup()
+
+qt_add_executable(permissions
+ MANUAL_FINALIZATION
+ main.cpp
+)
+
+set_target_properties(permissions PROPERTIES
+ MACOSX_BUNDLE TRUE
+ MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/Info.plist"
+ QT_ANDROID_PACKAGE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/android"
+)
+
+qt_finalize_executable(permissions)
+
+target_link_libraries(permissions PUBLIC
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
+)
+
+install(TARGETS permissions
+ RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
+ BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
+ LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
+)
+
+if(APPLE AND NOT CMAKE_GENERATOR STREQUAL "Xcode")
+ add_custom_command(TARGET permissions
+ POST_BUILD COMMAND codesign -s - permissions.app)
+endif()
diff --git a/examples/corelib/permissions/Info.plist b/examples/corelib/permissions/Info.plist
new file mode 100644
index 0000000000..dce43caf12
--- /dev/null
+++ b/examples/corelib/permissions/Info.plist
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundlePackageType</key>
+ <string>APPL</string>
+
+ <key>CFBundleName</key>
+ <string>${MACOSX_BUNDLE_BUNDLE_NAME}</string>
+ <key>CFBundleIdentifier</key>
+ <string>${MACOSX_BUNDLE_GUI_IDENTIFIER}</string>
+ <key>CFBundleExecutable</key>
+ <string>${MACOSX_BUNDLE_EXECUTABLE_NAME}</string>
+
+ <key>CFBundleVersion</key>
+ <string>${MACOSX_BUNDLE_BUNDLE_VERSION}</string>
+ <key>CFBundleShortVersionString</key>
+ <string>${MACOSX_BUNDLE_SHORT_VERSION_STRING}</string>
+
+ <key>LSMinimumSystemVersion</key>
+ <string>${CMAKE_OSX_DEPLOYMENT_TARGET}</string>
+
+ <key>NSHumanReadableCopyright</key>
+ <string>${MACOSX_BUNDLE_COPYRIGHT}</string>
+
+ <key>CFBundleIconFile</key>
+ <string>${MACOSX_BUNDLE_ICON_FILE}</string>
+
+ <key>CFBundleDevelopmentRegion</key>
+ <string>English</string>
+
+ <key>NSSupportsAutomaticGraphicsSwitching</key>
+ <true/>
+
+ <key>NSBluetoothAlwaysUsageDescription</key>
+ <string>Testing BluetoothAlways</string>
+ <key>NSCalendarsUsageDescription</key>
+ <string>Testing Calendars</string>
+ <key>NSCameraUsageDescription</key>
+ <string>Testing Camera</string>
+ <key>NSContactsUsageDescription</key>
+ <string>Testing Contacts</string>
+ <key>NSHealthShareUsageDescription</key>
+ <string>Testing HealthShare</string>
+ <key>NSHealthUpdateUsageDescription</key>
+ <string>Testing HealthUpdate</string>
+ <key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
+ <string>Testing LocationAlwaysAndWhenInUse</string>
+ <key>NSLocationAlwaysUsageDescription</key>
+ <string>Testing LocationAlways</string>
+ <key>NSLocationWhenInUseUsageDescription</key>
+ <string>Testing LocationWhenInUse</string>
+ <key>NSMicrophoneUsageDescription</key>
+ <string>Testing Microphone</string>
+
+</dict>
+</plist>
diff --git a/examples/corelib/permissions/android/AndroidManifest.xml b/examples/corelib/permissions/android/AndroidManifest.xml
new file mode 100644
index 0000000000..557ec8007e
--- /dev/null
+++ b/examples/corelib/permissions/android/AndroidManifest.xml
@@ -0,0 +1,53 @@
+<?xml version="1.0"?>
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="org.qtproject.example"
+ android:installLocation="auto"
+ android:versionCode="-- %%INSERT_VERSION_CODE%% --"
+ android:versionName="-- %%INSERT_VERSION_NAME%% --">
+ <uses-permission android:name="android.permission.CAMERA" />
+ <uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />
+ <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
+ <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
+ <uses-permission android:name="android.permission.RECORD_AUDIO" />
+ <uses-permission android:name="android.permission.BLUETOOTH" />
+ <uses-permission android:name="android.permission.READ_CONTACTS" />
+ <uses-permission android:name="android.permission.WRITE_CONTACTS" />
+ <uses-permission android:name="android.permission.READ_CALENDAR" />
+ <uses-permission android:name="android.permission.WRITE_CALENDAR" />
+ <!-- %%INSERT_PERMISSIONS -->
+ <!-- %%INSERT_FEATURES -->
+ <supports-screens
+ android:anyDensity="true"
+ android:largeScreens="true"
+ android:normalScreens="true"
+ android:smallScreens="true" />
+ <application
+ android:name="org.qtproject.qt.android.bindings.QtApplication"
+ android:hardwareAccelerated="true"
+ android:label="-- %%INSERT_APP_NAME%% --"
+ android:requestLegacyExternalStorage="true"
+ android:allowNativeHeapPointerTagging="false"
+ android:allowBackup="true"
+ android:fullBackupOnly="false">
+ <activity
+ android:name="org.qtproject.qt.android.bindings.QtActivity"
+ android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|layoutDirection|locale|fontScale|keyboard|keyboardHidden|navigation|mcc|mnc|density"
+ android:label="-- %%INSERT_APP_NAME%% --"
+ android:launchMode="singleTop"
+ android:screenOrientation="unspecified"
+ android:exported="true">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+
+ <meta-data
+ android:name="android.app.lib_name"
+ android:value="-- %%INSERT_APP_LIB_NAME%% --" />
+
+ <meta-data
+ android:name="android.app.extract_android_style"
+ android:value="minimal" />
+ </activity>
+ </application>
+</manifest>
diff --git a/examples/corelib/permissions/main.cpp b/examples/corelib/permissions/main.cpp
new file mode 100644
index 0000000000..b2f4d942f1
--- /dev/null
+++ b/examples/corelib/permissions/main.cpp
@@ -0,0 +1,84 @@
+// Copyright (C) 2022 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+#include <QtCore/qmetaobject.h>
+#include <QtWidgets/qapplication.h>
+#include <QtWidgets/qwidget.h>
+#include <QtWidgets/qpushbutton.h>
+#include <QtWidgets/qlayout.h>
+#include <QtWidgets/qmessagebox.h>
+
+QT_REQUIRE_CONFIG(permissions);
+#include <QtCore/qpermissions.h>
+
+class PermissionWidget : public QWidget
+{
+ Q_OBJECT
+public:
+ explicit PermissionWidget(QWidget *parent = nullptr) : QWidget(parent)
+ {
+ QVBoxLayout *layout = new QVBoxLayout(this);
+
+ static const QPermission permissions[] = {
+ QCameraPermission{},
+ QMicrophonePermission{},
+ QBluetoothPermission{},
+ QContactsPermission{},
+ QCalendarPermission{},
+ QLocationPermission{}
+ };
+
+ for (auto permission : permissions) {
+ auto permissionName = QString::fromLatin1(permission.type().name());
+ QPushButton *button = new QPushButton(permissionName.sliced(1, permissionName.length() - 11));
+ connect(button, &QPushButton::clicked, this, &PermissionWidget::buttonClicked);
+ button->setProperty("permission", QVariant::fromValue(permission));
+ layout->addWidget(button);
+ }
+
+ QPalette pal = palette();
+ pal.setBrush(QPalette::Window, QGradient(QGradient::HappyAcid));
+ setPalette(pal);
+ }
+
+private:
+ void buttonClicked()
+ {
+ auto *button = static_cast<QPushButton*>(sender());
+
+ auto permission = button->property("permission").value<QPermission>();
+ Q_ASSERT(permission.type().isValid());
+
+ switch (qApp->checkPermission(permission)) {
+ case Qt::PermissionStatus::Undetermined:
+ qApp->requestPermission(permission, this,
+ [button](const QPermission &permission) {
+ Q_UNUSED(permission);
+ emit button->clicked(); // Try again
+ }
+ );
+ return;
+ case Qt::PermissionStatus::Denied:
+ QMessageBox::warning(this, button->text(),
+ tr("Permission is needed to use %1. Please grant permission "\
+ "to this application in the system settings.").arg(button->text()));
+ return;
+ case Qt::PermissionStatus::Granted:
+ break; // Proceed
+ }
+
+ // All good, can use the feature
+ QMessageBox::information(this, button->text(),
+ tr("Accessing %1").arg(button->text()));
+ }
+};
+
+int main(int argc, char **argv)
+{
+ QApplication app(argc, argv);
+ PermissionWidget widget;
+ widget.show();
+ return app.exec();
+}
+
+#include "main.moc"
diff --git a/examples/corelib/platform/CMakeLists.txt b/examples/corelib/platform/CMakeLists.txt
index f5b77c62b3..8eeda13095 100644
--- a/examples/corelib/platform/CMakeLists.txt
+++ b/examples/corelib/platform/CMakeLists.txt
@@ -1,5 +1,5 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
if(ANDROID)
add_subdirectory(androidnotifier)
diff --git a/examples/corelib/platform/androidnotifier/CMakeLists.txt b/examples/corelib/platform/androidnotifier/CMakeLists.txt
index f6187f1d4c..e05afc2901 100644
--- a/examples/corelib/platform/androidnotifier/CMakeLists.txt
+++ b/examples/corelib/platform/androidnotifier/CMakeLists.txt
@@ -1,5 +1,5 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(androidnotifier LANGUAGES CXX)
@@ -8,14 +8,14 @@ if(NOT ANDROID)
message(FATAL_ERROR "Example only works on Android")
endif()
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
find_package(Qt6 REQUIRED COMPONENTS Widgets)
+qt_standard_project_setup()
+
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/corelib/platform/androidnotifier")
qt_add_executable(androidnotifier
diff --git a/examples/corelib/serialization/CMakeLists.txt b/examples/corelib/serialization/CMakeLists.txt
index 6778e4b460..9609b0a107 100644
--- a/examples/corelib/serialization/CMakeLists.txt
+++ b/examples/corelib/serialization/CMakeLists.txt
@@ -1,5 +1,5 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
qt_internal_add_example(cbordump)
qt_internal_add_example(convert)
diff --git a/examples/corelib/serialization/cbordump/CMakeLists.txt b/examples/corelib/serialization/cbordump/CMakeLists.txt
index 91e88875c1..2b175b1805 100644
--- a/examples/corelib/serialization/cbordump/CMakeLists.txt
+++ b/examples/corelib/serialization/cbordump/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(cbordump LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,12 +12,14 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/corelib/serialization/cbordump")
find_package(Qt6 REQUIRED COMPONENTS Core)
+qt_standard_project_setup()
+
qt_add_executable(cbordump
main.cpp
)
target_link_libraries(cbordump PUBLIC
- Qt::Core
+ Qt6::Core
)
install(TARGETS cbordump
diff --git a/examples/corelib/serialization/cbordump/doc/images/cbordump.png b/examples/corelib/serialization/cbordump/doc/images/cbordump.png
new file mode 100644
index 0000000000..72232c1a95
--- /dev/null
+++ b/examples/corelib/serialization/cbordump/doc/images/cbordump.png
Binary files differ
diff --git a/examples/corelib/serialization/cbordump/doc/src/cbordump.qdoc b/examples/corelib/serialization/cbordump/doc/src/cbordump.qdoc
new file mode 100644
index 0000000000..c3565e184d
--- /dev/null
+++ b/examples/corelib/serialization/cbordump/doc/src/cbordump.qdoc
@@ -0,0 +1,52 @@
+// Copyright (C) 2022 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
+
+/*!
+ \example serialization/cbordump
+ \title Cbordump Example
+
+ \brief The Cbordump example demonstrates how to parse files in CBOR-format.
+
+ The Cbordump example reads from files or stdin content in CBOR-format and
+ dumps the decoded content to stdout. The cbordump utility can output in
+ CBOR diagnostic notation (which is similar to JSON), or it can have a
+ verbose output where each byte input is displayed with the encoding beside
+ it. This example shows how to use the QCborStreamReader class directly to
+ parse CBOR content.
+
+ \sa QCborStreamReader
+
+ \image cbordump.png
+
+ \section1 The Cbordumper Class
+
+ The Cbordumper class contains a QCborStreamReader object that is
+ initialized using the QFile object argument passed to the CborDumper
+ constructor. Based on the arguments the dump function calls either
+ dumpOne() or dumpOneDetailed() to dump the contents to stdout,
+
+ \snippet serialization/cbordump/main.cpp 0
+
+ \section2 The dumpOne() Function
+
+ The type() function of the QCborStreamReader is used in a switch statement
+ to print out for each type. If the type is an array or map, the content is
+ iterated upon, and for each entry the dumpOne() function is called
+ recursively with a higher indentation argument. If the type is a tag, it
+ is printed out and dumpOne() is called once without increasing the
+ indentation argument.
+
+ \section2 The dumpOneDetailed() Function
+
+ This function dumps out both the incoming bytes and the decoded contents
+ on the same line. It uses lambda functions to print out the bytes and
+ decoded content, but otherwise has a similar structure as dumpOne().
+
+ \section1 CborDescription
+
+ The tagDescriptions table, describing the CBOR-tags available, is
+ automatically generated from an XML-file available from the iana.org
+ website.
+
+ \sa {CBOR Support in Qt}
+ */
diff --git a/examples/corelib/serialization/cbordump/main.cpp b/examples/corelib/serialization/cbordump/main.cpp
index 126a5c5833..ed079d6a97 100644
--- a/examples/corelib/serialization/cbordump/main.cpp
+++ b/examples/corelib/serialization/cbordump/main.cpp
@@ -87,6 +87,7 @@ enum {
Value64Bit = 27
};
+//! [0]
struct CborDumper
{
enum DumpOption {
@@ -113,6 +114,7 @@ private:
qint64 offset = 0;
DumpOptions opts;
};
+//! [0]
Q_DECLARE_OPERATORS_FOR_FLAGS(CborDumper::DumpOptions)
static int cborNumberSize(quint64 value)
@@ -701,7 +703,7 @@ int main(int argc, char *argv[])
QStringList files = parser.positionalArguments();
if (files.isEmpty())
files << "-";
- for (const QString &file : qAsConst(files)) {
+ for (const QString &file : std::as_const(files)) {
QFile f(file);
if (file == "-" ? f.open(stdin, QIODevice::ReadOnly) : f.open(QIODevice::ReadOnly)) {
if (files.size() > 1)
diff --git a/examples/corelib/serialization/convert/CMakeLists.txt b/examples/corelib/serialization/convert/CMakeLists.txt
index 4a647c90f8..9d76c589ce 100644
--- a/examples/corelib/serialization/convert/CMakeLists.txt
+++ b/examples/corelib/serialization/convert/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(convert LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/corelib/serialization/convert")
find_package(Qt6 REQUIRED COMPONENTS Core)
+qt_standard_project_setup()
+
qt_add_executable(convert
cborconverter.cpp cborconverter.h
converter.h
@@ -26,7 +26,7 @@ qt_add_executable(convert
)
target_link_libraries(convert PUBLIC
- Qt::Core
+ Qt6::Core
)
install(TARGETS convert
diff --git a/examples/corelib/serialization/convert/cborconverter.cpp b/examples/corelib/serialization/convert/cborconverter.cpp
index 0f49de2551..8c88d42af3 100644
--- a/examples/corelib/serialization/convert/cborconverter.cpp
+++ b/examples/corelib/serialization/convert/cborconverter.cpp
@@ -57,6 +57,7 @@ QT_END_NAMESPACE
static QVariant convertCborValue(const QCborValue &value);
+//! [0]
static QVariant convertCborMap(const QCborMap &map)
{
VariantOrderedMap result;
@@ -83,8 +84,9 @@ static QVariant convertCborValue(const QCborValue &value)
return convertCborMap(value.toMap());
return value.toVariant();
}
-
+//! [0]
enum TrimFloatingPoint { Double, Float, Float16 };
+//! [1]
static QCborValue convertFromVariant(const QVariant &v, TrimFloatingPoint fpTrimming)
{
if (v.userType() == QMetaType::QVariantList) {
@@ -114,6 +116,7 @@ static QCborValue convertFromVariant(const QVariant &v, TrimFloatingPoint fpTrim
return QCborValue::fromVariant(v);
}
+//! [1]
QString CborDiagnosticDumper::name()
{
@@ -216,6 +219,7 @@ bool CborConverter::probeFile(QIODevice *f)
return f->isReadable() && f->peek(3) == QByteArray("\xd9\xd9\xf7", 3);
}
+//! [2]
QVariant CborConverter::loadFile(QIODevice *f, Converter *&outputConverter)
{
const char *ptr = nullptr;
@@ -250,9 +254,11 @@ QVariant CborConverter::loadFile(QIODevice *f, Converter *&outputConverter)
return contents.toVariant();
return convertCborValue(contents);
}
-
+//! [2]
+//! [3]
void CborConverter::saveFile(QIODevice *f, const QVariant &contents, const QStringList &options)
{
+ //! [3]
bool useSignature = true;
bool useIntegers = true;
enum { Yes, No, Always } useFloat16 = Yes, useFloat = Yes;
@@ -311,7 +317,7 @@ void CborConverter::saveFile(QIODevice *f, const QVariant &contents, const QStri
qPrintable(s), optionHelp);
exit(EXIT_FAILURE);
}
-
+ //! [4]
QCborValue v = convertFromVariant(contents,
useFloat16 == Always ? Float16 : useFloat == Always ? Float : Double);
QCborStreamWriter writer(f);
@@ -327,4 +333,4 @@ void CborConverter::saveFile(QIODevice *f, const QVariant &contents, const QStri
opts |= QCborValue::UseFloat16;
v.toCbor(writer, opts);
}
-
+//! [4]
diff --git a/examples/corelib/serialization/convert/doc/images/convert.png b/examples/corelib/serialization/convert/doc/images/convert.png
new file mode 100644
index 0000000000..8d6816a626
--- /dev/null
+++ b/examples/corelib/serialization/convert/doc/images/convert.png
Binary files differ
diff --git a/examples/corelib/serialization/convert/doc/src/convert.qdoc b/examples/corelib/serialization/convert/doc/src/convert.qdoc
new file mode 100644
index 0000000000..dc3264a469
--- /dev/null
+++ b/examples/corelib/serialization/convert/doc/src/convert.qdoc
@@ -0,0 +1,80 @@
+// Copyright (C) 2022 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
+
+/*!
+ \example serialization/convert
+ \title Convert Example
+
+ \brief The Convert example demonstrates how to convert between different
+ serialization formats.
+
+ The Convert example converts between the serialization formats JSON, CBOR,
+ XML, QDataStream and text. It can also auto detect the format being used.
+ Not all formats support both input and output, and they have different
+ sets of which types they support. QDataStream and XML are the richest,
+ followed by CBOR, then JSON, and then the plain text one.
+
+ \image convert.png
+
+ \section1 The Converter Class
+
+ The Converter class is the abstract superclass for all the converters to
+ and from all the formats. They all convert to and from the QVariant class,
+ which is used to represent all the datastructures internally.
+ The name() function returns the name of the converter. The directions()
+ function is used to determine if a converter can be used for input, output,
+ or both. The outputOptions() and optionsHelp() functions are used to get
+ and query which options are used by the different converters. The
+ probeFile() function is used to determine if a file has the same file
+ format as the converter. The loadFile() function deserializes the given
+ file, while the saveFile() serializes to the given file.
+
+ \section1 The CborConverter Class
+
+ The CborConverter class shows how to serialize to and from the CBOR-format.
+ There is also a CborDiagnosticDumper class to output in CBOR diagnostic
+ notation. That is similar to JSON, but not exactly, because it allows
+ displaying the contents of a CBOR stream losslessly, while a conversion
+ to JSON is lossy.
+
+ The convertCborValue() function is used to convert a QCborValue to a
+ QVariant. It uses the helper functions convertCborMap() and
+ convertCborArray().
+ \snippet serialization/convert/cborconverter.cpp 0
+
+ A CBOR-file is read using loadFile() function.
+ \snippet serialization/convert/cborconverter.cpp 2
+
+ The convertFromVariant() function is used to convert a QVariant to a
+ QCborValue.
+ \snippet serialization/convert/cborconverter.cpp 1
+
+ A CBOR-file is written using the saveFile() function.
+ \snippet serialization/convert/cborconverter.cpp 3
+ \snippet serialization/convert/cborconverter.cpp 4
+
+ \sa {CBOR Support in Qt}
+
+ \section1 The DataStreamConverter Class
+
+ The DataStreamConverter class is used to serialize to and from the
+ QDataStream format. There is also the DataStreamDumper class for outputting
+ the data lossless in a non-standardized human readable format.
+
+ \section1 The JsonConverter Class
+
+ The JsonConverter class is used to serialize to and from the JSON-format.
+ \sa {JSON Support in Qt}
+
+ \section1 The XmlConverter Class
+
+ The XmlConverter class is used to serialize to and from the XML-format.
+
+ \section1 The TextConverter Class
+
+ The TextConverter class is used to serialize to and from a text format.
+
+ \section1 The NullConverter Class
+
+ The NullConverter class is an output serializer that does nothing.
+*/
diff --git a/examples/corelib/serialization/convert/main.cpp b/examples/corelib/serialization/convert/main.cpp
index c234a28f1b..00c626e1c8 100644
--- a/examples/corelib/serialization/convert/main.cpp
+++ b/examples/corelib/serialization/convert/main.cpp
@@ -31,7 +31,7 @@ int main(int argc, char *argv[])
QStringList inputFormats;
QStringList outputFormats;
- for (Converter *conv : qAsConst(*availableConverters)) {
+ for (Converter *conv : std::as_const(*availableConverters)) {
auto direction = conv->directions();
QString name = conv->name();
if (direction & Converter::In)
@@ -82,7 +82,7 @@ int main(int argc, char *argv[])
if (parser.isSet(formatOptionsOption)) {
QString format = parser.value(formatOptionsOption);
- for (Converter *conv : qAsConst(*availableConverters)) {
+ for (Converter *conv : std::as_const(*availableConverters)) {
if (conv->name() == format) {
const char *help = conv->optionsHelp();
if (help)
@@ -100,7 +100,7 @@ int main(int argc, char *argv[])
Converter *inconv = nullptr;
QString format = parser.value(inputFormatOption);
if (format != "auto") {
- for (Converter *conv : qAsConst(*availableConverters)) {
+ for (Converter *conv : std::as_const(*availableConverters)) {
if (conv->name() == format) {
inconv = conv;
break;
@@ -116,7 +116,7 @@ int main(int argc, char *argv[])
Converter *outconv = nullptr;
format = parser.value(outputFormatOption);
if (format != "auto") {
- for (Converter *conv : qAsConst(*availableConverters)) {
+ for (Converter *conv : std::as_const(*availableConverters)) {
if (conv->name() == format) {
outconv = conv;
break;
@@ -155,7 +155,7 @@ int main(int argc, char *argv[])
if (!inconv) {
// probe the input to find a file format
- for (Converter *conv : qAsConst(*availableConverters)) {
+ for (Converter *conv : std::as_const(*availableConverters)) {
if (conv->directions() & Converter::In && conv->probeFile(&input)) {
inconv = conv;
break;
@@ -170,7 +170,7 @@ int main(int argc, char *argv[])
if (!outconv) {
// probe the output to find a file format
- for (Converter *conv : qAsConst(*availableConverters)) {
+ for (Converter *conv : std::as_const(*availableConverters)) {
if (conv->directions() & Converter::Out && conv->probeFile(&output)) {
outconv = conv;
break;
diff --git a/examples/corelib/serialization/savegame/CMakeLists.txt b/examples/corelib/serialization/savegame/CMakeLists.txt
index 5ccc14ad31..723a9e66f0 100644
--- a/examples/corelib/serialization/savegame/CMakeLists.txt
+++ b/examples/corelib/serialization/savegame/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(savegame LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/corelib/serialization/savegame")
find_package(Qt6 REQUIRED COMPONENTS Core)
+qt_standard_project_setup()
+
qt_add_executable(savegame
character.cpp character.h
game.cpp game.h
@@ -22,7 +22,7 @@ qt_add_executable(savegame
)
target_link_libraries(savegame PUBLIC
- Qt::Core
+ Qt6::Core
)
install(TARGETS savegame
diff --git a/examples/corelib/serialization/savegame/doc/src/savegame.qdoc b/examples/corelib/serialization/savegame/doc/src/savegame.qdoc
index 0246ae48bb..233c81dd8b 100644
--- a/examples/corelib/serialization/savegame/doc/src/savegame.qdoc
+++ b/examples/corelib/serialization/savegame/doc/src/savegame.qdoc
@@ -158,5 +158,5 @@
human-readable JSON files, but you also have the option to use a binary
format if it's required, \e without rewriting any code.
- \sa {JSON Support in Qt}, {Data Storage}
+ \sa {JSON Support in Qt}, {CBOR Support in Qt}, {Data Storage}
*/
diff --git a/examples/corelib/threads/CMakeLists.txt b/examples/corelib/threads/CMakeLists.txt
index b5d42044fc..4ced9a50e5 100644
--- a/examples/corelib/threads/CMakeLists.txt
+++ b/examples/corelib/threads/CMakeLists.txt
@@ -1,9 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
qt_internal_add_example(semaphores)
qt_internal_add_example(waitconditions)
-if(TARGET Qt::Widgets)
+if(TARGET Qt6::Widgets)
qt_internal_add_example(mandelbrot)
qt_internal_add_example(queuedcustomtype)
endif()
diff --git a/examples/corelib/threads/mandelbrot/CMakeLists.txt b/examples/corelib/threads/mandelbrot/CMakeLists.txt
index 7d9b78932c..38028e0188 100644
--- a/examples/corelib/threads/mandelbrot/CMakeLists.txt
+++ b/examples/corelib/threads/mandelbrot/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(mandelbrot LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/corelib/threads/mandelbrot")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(mandelbrot
main.cpp
mandelbrotwidget.cpp mandelbrotwidget.h
@@ -26,9 +26,9 @@ set_target_properties(mandelbrot PROPERTIES
)
target_link_libraries(mandelbrot PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
install(TARGETS mandelbrot
diff --git a/examples/corelib/threads/queuedcustomtype/CMakeLists.txt b/examples/corelib/threads/queuedcustomtype/CMakeLists.txt
index 2a5638eeec..8cdef289e8 100644
--- a/examples/corelib/threads/queuedcustomtype/CMakeLists.txt
+++ b/examples/corelib/threads/queuedcustomtype/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(queuedcustomtype LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/corelib/threads/queuedcustomtype"
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(queuedcustomtype
block.cpp block.h
main.cpp
@@ -27,9 +27,9 @@ set_target_properties(queuedcustomtype PROPERTIES
)
target_link_libraries(queuedcustomtype PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
install(TARGETS queuedcustomtype
diff --git a/examples/corelib/threads/semaphores/CMakeLists.txt b/examples/corelib/threads/semaphores/CMakeLists.txt
index 2c17d2d2e0..61101ec6c4 100644
--- a/examples/corelib/threads/semaphores/CMakeLists.txt
+++ b/examples/corelib/threads/semaphores/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(semaphores LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,12 +12,14 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/corelib/threads/semaphores")
find_package(Qt6 REQUIRED COMPONENTS Core)
+qt_standard_project_setup()
+
qt_add_executable(semaphores
semaphores.cpp
)
target_link_libraries(semaphores PUBLIC
- Qt::Core
+ Qt6::Core
)
install(TARGETS semaphores
diff --git a/examples/corelib/threads/waitconditions/CMakeLists.txt b/examples/corelib/threads/waitconditions/CMakeLists.txt
index 4d6ce268b7..13622c522a 100644
--- a/examples/corelib/threads/waitconditions/CMakeLists.txt
+++ b/examples/corelib/threads/waitconditions/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(waitconditions LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,12 +12,14 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/corelib/threads/waitconditions")
find_package(Qt6 REQUIRED COMPONENTS Core)
+qt_standard_project_setup()
+
qt_add_executable(waitconditions
waitconditions.cpp
)
target_link_libraries(waitconditions PUBLIC
- Qt::Core
+ Qt6::Core
)
install(TARGETS waitconditions
diff --git a/examples/corelib/tools/CMakeLists.txt b/examples/corelib/tools/CMakeLists.txt
index 52daa9bd77..0ec145da29 100644
--- a/examples/corelib/tools/CMakeLists.txt
+++ b/examples/corelib/tools/CMakeLists.txt
@@ -1,7 +1,7 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
-if(NOT TARGET Qt::Widgets)
+if(NOT TARGET Qt6::Widgets)
return()
endif()
qt_internal_add_example(contiguouscache)
diff --git a/examples/corelib/tools/contiguouscache/CMakeLists.txt b/examples/corelib/tools/contiguouscache/CMakeLists.txt
index bf5e902620..c2b52f1426 100644
--- a/examples/corelib/tools/contiguouscache/CMakeLists.txt
+++ b/examples/corelib/tools/contiguouscache/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(contiguouscache LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/corelib/tools/contiguouscache")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(contiguouscache
main.cpp
randomlistmodel.cpp randomlistmodel.h
@@ -25,9 +25,9 @@ set_target_properties(contiguouscache PROPERTIES
)
target_link_libraries(contiguouscache PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
install(TARGETS contiguouscache
diff --git a/examples/corelib/tools/customtype/CMakeLists.txt b/examples/corelib/tools/customtype/CMakeLists.txt
index cd92911eaa..d03b961f4c 100644
--- a/examples/corelib/tools/customtype/CMakeLists.txt
+++ b/examples/corelib/tools/customtype/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(customtype LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/corelib/tools/customtype")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(customtype
main.cpp
message.cpp message.h
@@ -25,9 +25,9 @@ set_target_properties(customtype PROPERTIES
)
target_link_libraries(customtype PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
install(TARGETS customtype
diff --git a/examples/corelib/tools/customtypesending/CMakeLists.txt b/examples/corelib/tools/customtypesending/CMakeLists.txt
index 83c2ebfd4f..8a72ef091b 100644
--- a/examples/corelib/tools/customtypesending/CMakeLists.txt
+++ b/examples/corelib/tools/customtypesending/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(customtypesending LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/corelib/tools/customtypesending")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(customtypesending
main.cpp
message.cpp message.h
@@ -26,9 +26,9 @@ set_target_properties(customtypesending PROPERTIES
)
target_link_libraries(customtypesending PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
install(TARGETS customtypesending
diff --git a/examples/dbus/CMakeLists.txt b/examples/dbus/CMakeLists.txt
index 582978d5bd..bd9d232f90 100644
--- a/examples/dbus/CMakeLists.txt
+++ b/examples/dbus/CMakeLists.txt
@@ -1,7 +1,7 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
-if(NOT TARGET Qt::DBus)
+if(NOT TARGET Qt6::DBus)
return()
endif()
qt_internal_add_example(listnames)
@@ -9,7 +9,7 @@ qt_internal_add_example(pingpong)
if(QT_FEATURE_process)
qt_internal_add_example(complexpingpong)
endif()
-if(TARGET Qt::Widgets)
+if(TARGET Qt6::Widgets)
qt_internal_add_example(chat)
add_subdirectory(remotecontrolledcar)
endif()
diff --git a/examples/dbus/chat/CMakeLists.txt b/examples/dbus/chat/CMakeLists.txt
index f1dcfbf88d..3da97fd268 100644
--- a/examples/dbus/chat/CMakeLists.txt
+++ b/examples/dbus/chat/CMakeLists.txt
@@ -1,14 +1,11 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(chat LANGUAGES CXX)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
-set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTOUIC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -17,6 +14,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/dbus/chat")
find_package(Qt6 REQUIRED COMPONENTS Core DBus Gui Widgets)
+qt_standard_project_setup()
+
set(chat_SRCS)
qt_add_dbus_interface(chat_SRCS
org.example.chat.xml
@@ -43,10 +42,10 @@ set_target_properties(chat PROPERTIES
)
target_link_libraries(chat PUBLIC
- Qt::Core
- Qt::DBus
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::DBus
+ Qt6::Gui
+ Qt6::Widgets
)
install(TARGETS chat
diff --git a/examples/dbus/chat/chat.cpp b/examples/dbus/chat/chat.cpp
index 41a9f55120..6e7c670834 100644
--- a/examples/dbus/chat/chat.cpp
+++ b/examples/dbus/chat/chat.cpp
@@ -14,12 +14,16 @@ ChatMainWindow::ChatMainWindow()
setupUi(this);
sendButton->setEnabled(false);
- connect(messageLineEdit, SIGNAL(textChanged(QString)),
- this, SLOT(textChangedSlot(QString)));
- connect(sendButton, SIGNAL(clicked(bool)), this, SLOT(sendClickedSlot()));
- connect(actionChangeNickname, SIGNAL(triggered(bool)), this, SLOT(changeNickname()));
- connect(actionAboutQt, SIGNAL(triggered(bool)), this, SLOT(aboutQt()));
- connect(qApp, SIGNAL(lastWindowClosed()), this, SLOT(exiting()));
+ connect(messageLineEdit, &QLineEdit::textChanged,
+ this, &ChatMainWindow::textChangedSlot);
+ connect(sendButton, &QPushButton::clicked,
+ this, &ChatMainWindow::sendClickedSlot);
+ connect(actionChangeNickname, &QAction::triggered,
+ this, &ChatMainWindow::changeNickname);
+ connect(actionAboutQt, &QAction::triggered,
+ this, &ChatMainWindow::aboutQt);
+ connect(qApp, &QApplication::lastWindowClosed,
+ this, &ChatMainWindow::exiting);
// add our D-Bus interface and connect to D-Bus
new ChatAdaptor(this);
@@ -29,7 +33,8 @@ ChatMainWindow::ChatMainWindow()
iface = new org::example::chat(QString(), QString(), QDBusConnection::sessionBus(), this);
//connect(iface, SIGNAL(message(QString,QString)), this, SLOT(messageSlot(QString,QString)));
QDBusConnection::sessionBus().connect(QString(), QString(), "org.example.chat", "message", this, SLOT(messageSlot(QString,QString)));
- connect(iface, SIGNAL(action(QString,QString)), this, SLOT(actionSlot(QString,QString)));
+ connect(iface, &org::example::chat::action,
+ this, &ChatMainWindow::actionSlot);
NicknameDialog dialog;
dialog.cancelButton->setVisible(false);
diff --git a/examples/dbus/complexpingpong/CMakeLists.txt b/examples/dbus/complexpingpong/CMakeLists.txt
index c722ef38d0..377b56b1ab 100644
--- a/examples/dbus/complexpingpong/CMakeLists.txt
+++ b/examples/dbus/complexpingpong/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(complexpingpong LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/dbus/complexpingpong")
find_package(Qt6 REQUIRED COMPONENTS Core DBus)
+qt_standard_project_setup()
+
qt_add_executable(complexping
complexping.cpp complexping.h
ping-common.h
diff --git a/examples/dbus/listnames/CMakeLists.txt b/examples/dbus/listnames/CMakeLists.txt
index a1d108f7a5..dec2622ebd 100644
--- a/examples/dbus/listnames/CMakeLists.txt
+++ b/examples/dbus/listnames/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(listnames LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,13 +12,15 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/dbus/listnames")
find_package(Qt6 REQUIRED COMPONENTS Core DBus)
+qt_standard_project_setup()
+
qt_add_executable(listnames
listnames.cpp
)
target_link_libraries(listnames PUBLIC
- Qt::Core
- Qt::DBus
+ Qt6::Core
+ Qt6::DBus
)
install(TARGETS listnames
diff --git a/examples/dbus/pingpong/CMakeLists.txt b/examples/dbus/pingpong/CMakeLists.txt
index 08fc2bc4a6..4c87f7249a 100644
--- a/examples/dbus/pingpong/CMakeLists.txt
+++ b/examples/dbus/pingpong/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(pingpong LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/dbus/pingpong")
find_package(Qt6 REQUIRED COMPONENTS Core DBus)
+qt_standard_project_setup()
+
qt_add_executable(ping
ping.cpp
ping-common.h
diff --git a/examples/dbus/remotecontrolledcar/car/CMakeLists.txt b/examples/dbus/remotecontrolledcar/car/CMakeLists.txt
index 0c0b213e57..653d907434 100644
--- a/examples/dbus/remotecontrolledcar/car/CMakeLists.txt
+++ b/examples/dbus/remotecontrolledcar/car/CMakeLists.txt
@@ -1,13 +1,11 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(car LANGUAGES CXX)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -16,6 +14,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/dbus/remotecontrolledcar/car")
find_package(Qt6 REQUIRED COMPONENTS Core DBus Gui Widgets)
+qt_standard_project_setup()
+
set(car_SRCS)
qt_add_dbus_adaptor(car_SRCS
car.xml
@@ -36,10 +36,10 @@ set_target_properties(car PROPERTIES
)
target_link_libraries(car PUBLIC
- Qt::Core
- Qt::DBus
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::DBus
+ Qt6::Gui
+ Qt6::Widgets
)
install(TARGETS car
diff --git a/examples/dbus/remotecontrolledcar/controller/CMakeLists.txt b/examples/dbus/remotecontrolledcar/controller/CMakeLists.txt
index 1997afe8f0..0d46f00b32 100644
--- a/examples/dbus/remotecontrolledcar/controller/CMakeLists.txt
+++ b/examples/dbus/remotecontrolledcar/controller/CMakeLists.txt
@@ -1,14 +1,11 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(controller LANGUAGES CXX)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
-set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTOUIC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -17,6 +14,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/dbus/remotecontrolledcar/controll
find_package(Qt6 REQUIRED COMPONENTS Core DBus Gui Widgets)
+qt_standard_project_setup()
+
set(controller_SRCS)
qt_add_dbus_interface(controller_SRCS
car.xml
@@ -35,10 +34,10 @@ set_target_properties(controller PROPERTIES
)
target_link_libraries(controller PUBLIC
- Qt::Core
- Qt::DBus
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::DBus
+ Qt6::Gui
+ Qt6::Widgets
)
install(TARGETS controller
diff --git a/examples/embedded/CMakeLists.txt b/examples/embedded/CMakeLists.txt
index 7f9f7e4edf..1eb8bc7537 100644
--- a/examples/embedded/CMakeLists.txt
+++ b/examples/embedded/CMakeLists.txt
@@ -1,7 +1,7 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
-if(NOT TARGET Qt::Gui OR (NOT embedded AND NOT x11))
+if(NOT TARGET Qt6::Gui OR (NOT embedded AND NOT x11))
return()
endif()
qt_internal_add_example(styleexample)
diff --git a/examples/embedded/digiflip/CMakeLists.txt b/examples/embedded/digiflip/CMakeLists.txt
index 28643e610e..c54497cf15 100644
--- a/examples/embedded/digiflip/CMakeLists.txt
+++ b/examples/embedded/digiflip/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(digiflip LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/embedded/digiflip")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(digiflip
digiflip.cpp
)
@@ -24,9 +24,9 @@ set_target_properties(digiflip PROPERTIES
)
target_link_libraries(digiflip PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
install(TARGETS digiflip
diff --git a/examples/embedded/flickable/CMakeLists.txt b/examples/embedded/flickable/CMakeLists.txt
index fa98ef0eb8..b7a29b3805 100644
--- a/examples/embedded/flickable/CMakeLists.txt
+++ b/examples/embedded/flickable/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(flickable LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/embedded/flickable")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(flickable
flickable.cpp flickable.h
main.cpp
@@ -25,9 +25,9 @@ set_target_properties(flickable PROPERTIES
)
target_link_libraries(flickable PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
install(TARGETS flickable
diff --git a/examples/embedded/flightinfo/CMakeLists.txt b/examples/embedded/flightinfo/CMakeLists.txt
index 1f1c8675fa..0406d57730 100644
--- a/examples/embedded/flightinfo/CMakeLists.txt
+++ b/examples/embedded/flightinfo/CMakeLists.txt
@@ -1,12 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(flightinfo LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTOUIC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -15,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/embedded/flightinfo")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Network Widgets)
+qt_standard_project_setup()
+
qt_add_executable(flightinfo
flightinfo.cpp
form.ui
@@ -26,10 +25,10 @@ set_target_properties(flightinfo PROPERTIES
)
target_link_libraries(flightinfo PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Network
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Network
+ Qt6::Widgets
)
# Resources:
diff --git a/examples/embedded/lightmaps/CMakeLists.txt b/examples/embedded/lightmaps/CMakeLists.txt
index 28c7ef89c1..37cc527a6d 100644
--- a/examples/embedded/lightmaps/CMakeLists.txt
+++ b/examples/embedded/lightmaps/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(lightmaps LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/embedded/lightmaps")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Network Widgets)
+qt_standard_project_setup()
+
qt_add_executable(lightmaps
lightmaps.cpp lightmaps.h
main.cpp
@@ -27,10 +27,10 @@ set_target_properties(lightmaps PROPERTIES
)
target_link_libraries(lightmaps PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Network
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Network
+ Qt6::Widgets
)
install(TARGETS lightmaps
diff --git a/examples/embedded/raycasting/CMakeLists.txt b/examples/embedded/raycasting/CMakeLists.txt
index b9d5ca80cc..f8c8b8c0c1 100644
--- a/examples/embedded/raycasting/CMakeLists.txt
+++ b/examples/embedded/raycasting/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(raycasting LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/embedded/raycasting")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(raycasting
raycasting.cpp
)
@@ -24,9 +24,9 @@ set_target_properties(raycasting PROPERTIES
)
target_link_libraries(raycasting PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
# Resources:
diff --git a/examples/embedded/styleexample/CMakeLists.txt b/examples/embedded/styleexample/CMakeLists.txt
index 068d4e6b18..ffc652081f 100644
--- a/examples/embedded/styleexample/CMakeLists.txt
+++ b/examples/embedded/styleexample/CMakeLists.txt
@@ -1,12 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(styleexample LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTOUIC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -15,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/embedded/styleexample")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(styleexample
main.cpp
stylewidget.cpp stylewidget.h stylewidget.ui
@@ -26,9 +25,9 @@ set_target_properties(styleexample PROPERTIES
)
target_link_libraries(styleexample PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
# Resources:
diff --git a/examples/gui/CMakeLists.txt b/examples/gui/CMakeLists.txt
index a2a6c2d11f..83faae6765 100644
--- a/examples/gui/CMakeLists.txt
+++ b/examples/gui/CMakeLists.txt
@@ -1,7 +1,7 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
-if(NOT TARGET Qt::Gui)
+if(NOT TARGET Qt6::Gui)
return()
endif()
qt_internal_add_example(analogclock)
diff --git a/examples/gui/analogclock/CMakeLists.txt b/examples/gui/analogclock/CMakeLists.txt
index 1be4d80ef5..ddb1f8f93b 100644
--- a/examples/gui/analogclock/CMakeLists.txt
+++ b/examples/gui/analogclock/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(analogclock LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/gui/gui_analogclock")
find_package(Qt6 REQUIRED COMPONENTS Core Gui)
+qt_standard_project_setup()
+
qt_add_executable(gui_analogclock
../rasterwindow/rasterwindow.cpp ../rasterwindow/rasterwindow.h
main.cpp
@@ -29,8 +29,8 @@ target_include_directories(gui_analogclock PUBLIC
)
target_link_libraries(gui_analogclock PUBLIC
- Qt::Core
- Qt::Gui
+ Qt6::Core
+ Qt6::Gui
)
install(TARGETS gui_analogclock
diff --git a/examples/gui/rasterwindow/CMakeLists.txt b/examples/gui/rasterwindow/CMakeLists.txt
index bc9d1835bb..c09da49779 100644
--- a/examples/gui/rasterwindow/CMakeLists.txt
+++ b/examples/gui/rasterwindow/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(rasterwindow LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/gui/rasterwindow")
find_package(Qt6 REQUIRED COMPONENTS Core Gui)
+qt_standard_project_setup()
+
qt_add_executable(rasterwindow
main.cpp
rasterwindow.cpp rasterwindow.h
@@ -25,8 +25,8 @@ set_target_properties(rasterwindow PROPERTIES
)
target_link_libraries(rasterwindow PUBLIC
- Qt::Core
- Qt::Gui
+ Qt6::Core
+ Qt6::Gui
)
install(TARGETS rasterwindow
diff --git a/examples/network/CMakeLists.txt b/examples/network/CMakeLists.txt
index e6b35307de..59a97cca89 100644
--- a/examples/network/CMakeLists.txt
+++ b/examples/network/CMakeLists.txt
@@ -1,7 +1,7 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
-if(NOT TARGET Qt::Network)
+if(NOT TARGET Qt6::Network)
return()
endif()
qt_internal_add_example(download)
@@ -9,7 +9,7 @@ qt_internal_add_example(downloadmanager)
if(NOT INTEGRITY)
qt_internal_add_example(dnslookup)
endif()
-if(TARGET Qt::Widgets)
+if(TARGET Qt6::Widgets)
qt_internal_add_example(blockingfortuneclient)
qt_internal_add_example(broadcastreceiver)
qt_internal_add_example(broadcastsender)
@@ -23,17 +23,17 @@ if(TARGET Qt::Widgets)
qt_internal_add_example(fortuneclient)
qt_internal_add_example(fortuneserver)
endif()
-if(QT_FEATURE_processenvironment AND TARGET Qt::Widgets)
+if(QT_FEATURE_processenvironment AND TARGET Qt6::Widgets)
qt_internal_add_example(network-chat)
endif()
-if(QT_FEATURE_ssl AND TARGET Qt::Widgets)
+if(QT_FEATURE_ssl AND TARGET Qt6::Widgets)
qt_internal_add_example(securesocketclient)
endif()
-if(QT_FEATURE_dtls AND TARGET Qt::Widgets)
+if(QT_FEATURE_dtls AND TARGET Qt6::Widgets)
qt_internal_add_example(secureudpserver)
qt_internal_add_example(secureudpclient)
endif()
-if(QT_FEATURE_sctp AND TARGET Qt::Widgets)
+if(QT_FEATURE_sctp AND TARGET Qt6::Widgets)
qt_internal_add_example(multistreamserver)
qt_internal_add_example(multistreamclient)
endif()
diff --git a/examples/network/blockingfortuneclient/CMakeLists.txt b/examples/network/blockingfortuneclient/CMakeLists.txt
index aad6996101..dd11850c62 100644
--- a/examples/network/blockingfortuneclient/CMakeLists.txt
+++ b/examples/network/blockingfortuneclient/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(blockingfortuneclient LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/network/blockingfortuneclient")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Network Widgets)
+qt_standard_project_setup()
+
qt_add_executable(blockingfortuneclient
blockingclient.cpp blockingclient.h
fortunethread.cpp fortunethread.h
@@ -26,10 +26,10 @@ set_target_properties(blockingfortuneclient PROPERTIES
)
target_link_libraries(blockingfortuneclient PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Network
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Network
+ Qt6::Widgets
)
install(TARGETS blockingfortuneclient
diff --git a/examples/network/broadcastreceiver/CMakeLists.txt b/examples/network/broadcastreceiver/CMakeLists.txt
index d7ff099ebc..4d20e76268 100644
--- a/examples/network/broadcastreceiver/CMakeLists.txt
+++ b/examples/network/broadcastreceiver/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(broadcastreceiver LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/network/broadcastreceiver")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Network Widgets)
+qt_standard_project_setup()
+
qt_add_executable(broadcastreceiver
main.cpp
receiver.cpp receiver.h
@@ -25,10 +25,10 @@ set_target_properties(broadcastreceiver PROPERTIES
)
target_link_libraries(broadcastreceiver PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Network
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Network
+ Qt6::Widgets
)
install(TARGETS broadcastreceiver
diff --git a/examples/network/broadcastsender/CMakeLists.txt b/examples/network/broadcastsender/CMakeLists.txt
index 8019906beb..aff752b574 100644
--- a/examples/network/broadcastsender/CMakeLists.txt
+++ b/examples/network/broadcastsender/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(broadcastsender LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/network/broadcastsender")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Network Widgets)
+qt_standard_project_setup()
+
qt_add_executable(broadcastsender
main.cpp
sender.cpp sender.h
@@ -25,10 +25,10 @@ set_target_properties(broadcastsender PROPERTIES
)
target_link_libraries(broadcastsender PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Network
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Network
+ Qt6::Widgets
)
install(TARGETS broadcastsender
diff --git a/examples/network/dnslookup/CMakeLists.txt b/examples/network/dnslookup/CMakeLists.txt
index d460a6c851..c9668cc251 100644
--- a/examples/network/dnslookup/CMakeLists.txt
+++ b/examples/network/dnslookup/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(dnslookup LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,13 +12,15 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/network/dnslookup")
find_package(Qt6 REQUIRED COMPONENTS Core Network)
+qt_standard_project_setup()
+
qt_add_executable(dnslookup
dnslookup.cpp dnslookup.h
)
target_link_libraries(dnslookup PUBLIC
- Qt::Core
- Qt::Network
+ Qt6::Core
+ Qt6::Network
)
install(TARGETS dnslookup
diff --git a/examples/network/download/CMakeLists.txt b/examples/network/download/CMakeLists.txt
index fac34ff4ed..737b95f552 100644
--- a/examples/network/download/CMakeLists.txt
+++ b/examples/network/download/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(download LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,13 +12,15 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/network/download")
find_package(Qt6 REQUIRED COMPONENTS Core Network)
+qt_standard_project_setup()
+
qt_add_executable(download
main.cpp
)
target_link_libraries(download PUBLIC
- Qt::Core
- Qt::Network
+ Qt6::Core
+ Qt6::Network
)
install(TARGETS download
diff --git a/examples/network/download/main.cpp b/examples/network/download/main.cpp
index 32fccbad9c..227035af69 100644
--- a/examples/network/download/main.cpp
+++ b/examples/network/download/main.cpp
@@ -109,7 +109,7 @@ void DownloadManager::execute()
return;
}
- for (const QString &arg : qAsConst(args)) {
+ for (const QString &arg : std::as_const(args)) {
QUrl url = QUrl::fromEncoded(arg.toLocal8Bit());
doDownload(url);
}
diff --git a/examples/network/downloadmanager/CMakeLists.txt b/examples/network/downloadmanager/CMakeLists.txt
index 469940bf1a..ee24614866 100644
--- a/examples/network/downloadmanager/CMakeLists.txt
+++ b/examples/network/downloadmanager/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(downloadmanager LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/network/downloadmanager")
find_package(Qt6 REQUIRED COMPONENTS Core Network)
+qt_standard_project_setup()
+
qt_add_executable(downloadmanager
downloadmanager.cpp downloadmanager.h
main.cpp
@@ -21,8 +21,8 @@ qt_add_executable(downloadmanager
)
target_link_libraries(downloadmanager PUBLIC
- Qt::Core
- Qt::Network
+ Qt6::Core
+ Qt6::Network
)
install(TARGETS downloadmanager
diff --git a/examples/network/fortuneclient/CMakeLists.txt b/examples/network/fortuneclient/CMakeLists.txt
index 01a8ae4b48..09f5a1b1db 100644
--- a/examples/network/fortuneclient/CMakeLists.txt
+++ b/examples/network/fortuneclient/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(fortuneclient LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/network/fortuneclient")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Network Widgets)
+qt_standard_project_setup()
+
qt_add_executable(fortuneclient
client.cpp client.h
main.cpp
@@ -25,10 +25,10 @@ set_target_properties(fortuneclient PROPERTIES
)
target_link_libraries(fortuneclient PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Network
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Network
+ Qt6::Widgets
)
install(TARGETS fortuneclient
diff --git a/examples/network/fortuneserver/CMakeLists.txt b/examples/network/fortuneserver/CMakeLists.txt
index 80f2c74bde..fe7126f39f 100644
--- a/examples/network/fortuneserver/CMakeLists.txt
+++ b/examples/network/fortuneserver/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(fortuneserver LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/network/fortuneserver")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Network Widgets)
+qt_standard_project_setup()
+
qt_add_executable(fortuneserver
main.cpp
server.cpp server.h
@@ -25,10 +25,10 @@ set_target_properties(fortuneserver PROPERTIES
)
target_link_libraries(fortuneserver PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Network
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Network
+ Qt6::Widgets
)
install(TARGETS fortuneserver
diff --git a/examples/network/googlesuggest/CMakeLists.txt b/examples/network/googlesuggest/CMakeLists.txt
index 2cad46b8fd..5e1486b99d 100644
--- a/examples/network/googlesuggest/CMakeLists.txt
+++ b/examples/network/googlesuggest/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(googlesuggest LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/network/googlesuggest")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Network Widgets)
+qt_standard_project_setup()
+
qt_add_executable(googlesuggest
googlesuggest.cpp googlesuggest.h
main.cpp
@@ -26,10 +26,10 @@ set_target_properties(googlesuggest PROPERTIES
)
target_link_libraries(googlesuggest PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Network
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Network
+ Qt6::Widgets
)
install(TARGETS googlesuggest
diff --git a/examples/network/http/CMakeLists.txt b/examples/network/http/CMakeLists.txt
index 36bf303d7c..7c68d5156c 100644
--- a/examples/network/http/CMakeLists.txt
+++ b/examples/network/http/CMakeLists.txt
@@ -1,12 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(http LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTOUIC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -15,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/network/http")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Network Widgets)
+qt_standard_project_setup()
+
qt_add_executable(http
authenticationdialog.ui
httpwindow.cpp httpwindow.h
@@ -27,10 +26,10 @@ set_target_properties(http PROPERTIES
)
target_link_libraries(http PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Network
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Network
+ Qt6::Widgets
)
install(TARGETS http
diff --git a/examples/network/loopback/CMakeLists.txt b/examples/network/loopback/CMakeLists.txt
index 4dfb7e763b..99ed77e060 100644
--- a/examples/network/loopback/CMakeLists.txt
+++ b/examples/network/loopback/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(loopback LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/network/loopback")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Network Widgets)
+qt_standard_project_setup()
+
qt_add_executable(loopback
dialog.cpp dialog.h
main.cpp
@@ -25,10 +25,10 @@ set_target_properties(loopback PROPERTIES
)
target_link_libraries(loopback PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Network
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Network
+ Qt6::Widgets
)
install(TARGETS loopback
diff --git a/examples/network/multicastreceiver/CMakeLists.txt b/examples/network/multicastreceiver/CMakeLists.txt
index 1baee432fa..b7ec830866 100644
--- a/examples/network/multicastreceiver/CMakeLists.txt
+++ b/examples/network/multicastreceiver/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(multicastreceiver LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/network/multicastreceiver")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Network Widgets)
+qt_standard_project_setup()
+
qt_add_executable(multicastreceiver
main.cpp
receiver.cpp receiver.h
@@ -25,10 +25,10 @@ set_target_properties(multicastreceiver PROPERTIES
)
target_link_libraries(multicastreceiver PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Network
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Network
+ Qt6::Widgets
)
install(TARGETS multicastreceiver
diff --git a/examples/network/multicastsender/CMakeLists.txt b/examples/network/multicastsender/CMakeLists.txt
index a5c7570dd7..933f2a9fc8 100644
--- a/examples/network/multicastsender/CMakeLists.txt
+++ b/examples/network/multicastsender/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(multicastsender LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/network/multicastsender")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Network Widgets)
+qt_standard_project_setup()
+
qt_add_executable(multicastsender
main.cpp
sender.cpp sender.h
@@ -25,10 +25,10 @@ set_target_properties(multicastsender PROPERTIES
)
target_link_libraries(multicastsender PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Network
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Network
+ Qt6::Widgets
)
install(TARGETS multicastsender
diff --git a/examples/network/multistreamclient/CMakeLists.txt b/examples/network/multistreamclient/CMakeLists.txt
index ffa0eb377d..da10f89eca 100644
--- a/examples/network/multistreamclient/CMakeLists.txt
+++ b/examples/network/multistreamclient/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(multistreamclient LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/network/multistreamclient")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Network Widgets)
+qt_standard_project_setup()
+
qt_add_executable(multistreamclient
chatconsumer.cpp chatconsumer.h
client.cpp client.h
@@ -29,10 +29,10 @@ set_target_properties(multistreamclient PROPERTIES
)
target_link_libraries(multistreamclient PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Network
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Network
+ Qt6::Widgets
)
install(TARGETS multistreamclient
diff --git a/examples/network/multistreamserver/CMakeLists.txt b/examples/network/multistreamserver/CMakeLists.txt
index b9f179fdd4..fa50c9f778 100644
--- a/examples/network/multistreamserver/CMakeLists.txt
+++ b/examples/network/multistreamserver/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(multistreamserver LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/network/multistreamserver")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Network Widgets)
+qt_standard_project_setup()
+
qt_add_executable(multistreamserver
chatprovider.cpp chatprovider.h
main.cpp
@@ -29,10 +29,10 @@ set_target_properties(multistreamserver PROPERTIES
)
target_link_libraries(multistreamserver PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Network
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Network
+ Qt6::Widgets
)
install(TARGETS multistreamserver
diff --git a/examples/network/network-chat/CMakeLists.txt b/examples/network/network-chat/CMakeLists.txt
index 7e40564d33..886e54ae4f 100644
--- a/examples/network/network-chat/CMakeLists.txt
+++ b/examples/network/network-chat/CMakeLists.txt
@@ -1,12 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(network-chat LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTOUIC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -15,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/network/network-chat")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Network Widgets)
+qt_standard_project_setup()
+
qt_add_executable(network-chat
chatdialog.cpp chatdialog.h chatdialog.ui
client.cpp client.h
@@ -30,10 +29,10 @@ set_target_properties(network-chat PROPERTIES
)
target_link_libraries(network-chat PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Network
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Network
+ Qt6::Widgets
)
install(TARGETS network-chat
diff --git a/examples/network/network-chat/client.cpp b/examples/network/network-chat/client.cpp
index c9b165f724..bbce358ce2 100644
--- a/examples/network/network-chat/client.cpp
+++ b/examples/network/network-chat/client.cpp
@@ -24,7 +24,7 @@ void Client::sendMessage(const QString &message)
if (message.isEmpty())
return;
- for (Connection *connection : qAsConst(peers))
+ for (Connection *connection : std::as_const(peers))
connection->sendMessage(message);
}
diff --git a/examples/network/network-chat/peermanager.cpp b/examples/network/network-chat/peermanager.cpp
index 68a10b34be..45587404fd 100644
--- a/examples/network/network-chat/peermanager.cpp
+++ b/examples/network/network-chat/peermanager.cpp
@@ -78,7 +78,7 @@ void PeerManager::sendBroadcastDatagram()
}
bool validBroadcastAddresses = true;
- for (const QHostAddress &address : qAsConst(broadcastAddresses)) {
+ for (const QHostAddress &address : std::as_const(broadcastAddresses)) {
if (broadcastSocket.writeDatagram(datagram, address,
broadcastPort) == -1)
validBroadcastAddresses = false;
diff --git a/examples/network/securesocketclient/CMakeLists.txt b/examples/network/securesocketclient/CMakeLists.txt
index 24e7057232..6d10139147 100644
--- a/examples/network/securesocketclient/CMakeLists.txt
+++ b/examples/network/securesocketclient/CMakeLists.txt
@@ -1,12 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(securesocketclient LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTOUIC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -15,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/network/securesocketclient")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Network Widgets)
+qt_standard_project_setup()
+
qt_add_executable(securesocketclient
certificateinfo.cpp certificateinfo.h certificateinfo.ui
main.cpp
@@ -28,10 +27,10 @@ set_target_properties(securesocketclient PROPERTIES
)
target_link_libraries(securesocketclient PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Network
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Network
+ Qt6::Widgets
)
# Resources:
diff --git a/examples/network/secureudpclient/CMakeLists.txt b/examples/network/secureudpclient/CMakeLists.txt
index 1d43cd0f4f..5625759443 100644
--- a/examples/network/secureudpclient/CMakeLists.txt
+++ b/examples/network/secureudpclient/CMakeLists.txt
@@ -1,12 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(secureudpclient LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTOUIC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -15,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/network/secureudpclient")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Network Widgets)
+qt_standard_project_setup()
+
qt_add_executable(secureudpclient
addressdialog.cpp addressdialog.h addressdialog.ui
association.cpp association.h
@@ -28,10 +27,10 @@ set_target_properties(secureudpclient PROPERTIES
)
target_link_libraries(secureudpclient PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Network
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Network
+ Qt6::Widgets
)
install(TARGETS secureudpclient
diff --git a/examples/network/secureudpserver/CMakeLists.txt b/examples/network/secureudpserver/CMakeLists.txt
index 234602f4a3..2e87495625 100644
--- a/examples/network/secureudpserver/CMakeLists.txt
+++ b/examples/network/secureudpserver/CMakeLists.txt
@@ -1,12 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(secureudpserver LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTOUIC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -15,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/network/secureudpserver")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Network Widgets)
+qt_standard_project_setup()
+
qt_add_executable(secureudpserver
main.cpp
mainwindow.cpp mainwindow.h mainwindow.ui
@@ -28,10 +27,10 @@ set_target_properties(secureudpserver PROPERTIES
)
target_link_libraries(secureudpserver PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Network
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Network
+ Qt6::Widgets
)
install(TARGETS secureudpserver
diff --git a/examples/network/secureudpserver/server.cpp b/examples/network/secureudpserver/server.cpp
index 3f39cbb739..8684c66c74 100644
--- a/examples/network/secureudpserver/server.cpp
+++ b/examples/network/secureudpserver/server.cpp
@@ -213,7 +213,7 @@ void DtlsServer::decryptDatagram(QDtls *connection, const QByteArray &clientMess
//! [14]
void DtlsServer::shutdown()
{
- for (const auto &connection : qExchange(knownClients, {}))
+ for (const auto &connection : std::exchange(knownClients, {}))
connection->shutdown(&serverSocket);
serverSocket.close();
diff --git a/examples/network/threadedfortuneserver/CMakeLists.txt b/examples/network/threadedfortuneserver/CMakeLists.txt
index 02a7cb9474..a016e73f42 100644
--- a/examples/network/threadedfortuneserver/CMakeLists.txt
+++ b/examples/network/threadedfortuneserver/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(threadedfortuneserver LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/network/threadedfortuneserver")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Network Widgets)
+qt_standard_project_setup()
+
qt_add_executable(threadedfortuneserver
dialog.cpp dialog.h
fortuneserver.cpp fortuneserver.h
@@ -27,10 +27,10 @@ set_target_properties(threadedfortuneserver PROPERTIES
)
target_link_libraries(threadedfortuneserver PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Network
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Network
+ Qt6::Widgets
)
install(TARGETS threadedfortuneserver
diff --git a/examples/network/torrent/CMakeLists.txt b/examples/network/torrent/CMakeLists.txt
index 28823c6400..d3cbc78eb5 100644
--- a/examples/network/torrent/CMakeLists.txt
+++ b/examples/network/torrent/CMakeLists.txt
@@ -1,12 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(torrent LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTOUIC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -15,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/network/torrent")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Network Widgets)
+qt_standard_project_setup()
+
qt_add_executable(torrent
addtorrentdialog.cpp addtorrentdialog.h
addtorrentform.ui
@@ -37,10 +36,10 @@ set_target_properties(torrent PROPERTIES
)
target_link_libraries(torrent PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Network
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Network
+ Qt6::Widgets
)
# Resources:
diff --git a/examples/network/torrent/filemanager.cpp b/examples/network/torrent/filemanager.cpp
index c86c3f2dd4..df964b9730 100644
--- a/examples/network/torrent/filemanager.cpp
+++ b/examples/network/torrent/filemanager.cpp
@@ -30,7 +30,7 @@ FileManager::~FileManager()
cond.wakeOne();
wait();
- for (QFile *file : qAsConst(files)) {
+ for (QFile *file : std::as_const(files)) {
file->close();
delete file;
}
@@ -391,7 +391,7 @@ void FileManager::verifyFileContents()
}
// Verify all pending pieces
- for (int index : qAsConst(newPendingVerificationRequests))
+ for (int index : std::as_const(newPendingVerificationRequests))
emit pieceVerified(index, verifySinglePiece(index));
}
diff --git a/examples/network/torrent/mainwindow.cpp b/examples/network/torrent/mainwindow.cpp
index 4d710953a1..4c898743ba 100644
--- a/examples/network/torrent/mainwindow.cpp
+++ b/examples/network/torrent/mainwindow.cpp
@@ -311,7 +311,7 @@ bool MainWindow::addTorrent(const QString &fileName, const QString &destinationF
const QByteArray &resumeState)
{
// Check if the torrent is already being downloaded.
- for (const Job &job : qAsConst(jobs)) {
+ for (const Job &job : std::as_const(jobs)) {
if (job.torrentFileName == fileName && job.destinationDirectory == destinationFolder) {
QMessageBox::warning(this, tr("Already downloading"),
tr("The torrent file %1 is "
@@ -644,7 +644,7 @@ void MainWindow::closeEvent(QCloseEvent *)
// them to signal that they have stopped.
jobsToStop = 0;
jobsStopped = 0;
- for (const Job &job : qAsConst(jobs)) {
+ for (const Job &job : std::as_const(jobs)) {
++jobsToStop;
TorrentClient *client = job.client;
client->disconnect();
diff --git a/examples/network/torrent/ratecontroller.cpp b/examples/network/torrent/ratecontroller.cpp
index 3dd256a0f6..c5e33ab63c 100644
--- a/examples/network/torrent/ratecontroller.cpp
+++ b/examples/network/torrent/ratecontroller.cpp
@@ -33,7 +33,7 @@ void RateController::removeSocket(PeerWireClient *socket)
void RateController::setDownloadLimit(int bytesPerSecond)
{
downLimit = bytesPerSecond;
- for (PeerWireClient *socket : qAsConst(sockets))
+ for (PeerWireClient *socket : std::as_const(sockets))
socket->setReadBufferSize(downLimit * 4);
}
@@ -63,7 +63,7 @@ void RateController::transfer()
}
QSet<PeerWireClient *> pendingSockets;
- for (PeerWireClient *client : qAsConst(sockets)) {
+ for (PeerWireClient *client : std::as_const(sockets)) {
if (client->canTransferMore())
pendingSockets << client;
}
diff --git a/examples/network/torrent/torrentclient.cpp b/examples/network/torrent/torrentclient.cpp
index fcc1b285f1..6fefb3855c 100644
--- a/examples/network/torrent/torrentclient.cpp
+++ b/examples/network/torrent/torrentclient.cpp
@@ -416,7 +416,7 @@ void TorrentClient::stop()
}
// Abort all existing connections
- for (PeerWireClient *client : qAsConst(d->connections)) {
+ for (PeerWireClient *client : std::as_const(d->connections)) {
RateController::instance()->removeSocket(client);
ConnectionManager::instance()->removeConnection(client);
client->abort();
@@ -439,7 +439,7 @@ void TorrentClient::setPaused(bool paused)
// connections to 0. Keep the list of peers, so we can quickly
// resume later.
d->setState(Paused);
- for (PeerWireClient *client : qAsConst(d->connections))
+ for (PeerWireClient *client : std::as_const(d->connections))
client->abort();
d->connections.clear();
TorrentServer::instance()->removeClient(this);
@@ -574,7 +574,7 @@ void TorrentClient::pieceVerified(int pieceIndex, bool ok)
}
// Update the peer list so we know who's still interesting.
- for (TorrentPeer *peer : qAsConst(d->peers)) {
+ for (TorrentPeer *peer : std::as_const(d->peers)) {
if (!peer->interesting)
continue;
bool interesting = false;
@@ -594,7 +594,7 @@ void TorrentClient::pieceVerified(int pieceIndex, bool ok)
d->incompletePieces.clearBit(pieceIndex);
// Notify connected peers.
- for (PeerWireClient *client : qAsConst(d->connections)) {
+ for (PeerWireClient *client : std::as_const(d->connections)) {
if (client->state() == QAbstractSocket::ConnectedState
&& !client->availablePieces().testBit(pieceIndex)) {
client->sendPieceNotification(pieceIndex);
@@ -672,9 +672,9 @@ QList<TorrentPeer *> TorrentClient::weighedFreePeers() const
qint64 now = QDateTime::currentSecsSinceEpoch();
QList<TorrentPeer *> freePeers;
QMap<QString, int> connectionsPerPeer;
- for (TorrentPeer *peer : qAsConst(d->peers)) {
+ for (TorrentPeer *peer : std::as_const(d->peers)) {
bool busy = false;
- for (PeerWireClient *client : qAsConst(d->connections)) {
+ for (PeerWireClient *client : std::as_const(d->connections)) {
if (client->state() == PeerWireClient::ConnectedState
&& client->peerAddress() == peer->address
&& client->peerPort() == peer->port) {
@@ -694,7 +694,7 @@ QList<TorrentPeer *> TorrentClient::weighedFreePeers() const
// Assign points based on connection speed and pieces available.
QList<QPair<int, TorrentPeer *> > points;
- for (TorrentPeer *peer : qAsConst(freePeers)) {
+ for (TorrentPeer *peer : std::as_const(freePeers)) {
int tmp = 0;
if (peer->interesting) {
tmp += peer->numCompletedPieces;
@@ -717,7 +717,7 @@ QList<TorrentPeer *> TorrentClient::weighedFreePeers() const
QMultiMap<int, TorrentPeer *> pointMap;
int lowestScore = 0;
int lastIndex = 0;
- for (const PointPair &point : qAsConst(points)) {
+ for (const PointPair &point : std::as_const(points)) {
if (point.first > lowestScore) {
lowestScore = point.first;
++lastIndex;
@@ -768,7 +768,7 @@ void TorrentClient::setupOutgoingConnection()
PeerWireClient *client = qobject_cast<PeerWireClient *>(sender());
// Update connection statistics.
- for (TorrentPeer *peer : qAsConst(d->peers)) {
+ for (TorrentPeer *peer : std::as_const(d->peers)) {
if (peer->port == client->peerPort() && peer->address == client->peerAddress()) {
peer->connectTime = peer->lastVisited - peer->connectStart;
break;
@@ -1040,7 +1040,7 @@ void TorrentClient::scheduleUploads()
// no use in unchoking them.
QList<PeerWireClient *> allClients = d->connections;
QList<QPair<qint64, PeerWireClient *>> transferSpeeds;
- for (PeerWireClient *client : qAsConst(allClients)) {
+ for (PeerWireClient *client : std::as_const(allClients)) {
if (client->state() == QAbstractSocket::ConnectedState
&& client->availablePieces().count(true) != d->pieceCount) {
if (d->state == Seeding) {
@@ -1098,7 +1098,7 @@ void TorrentClient::scheduleDownloads()
// Check what each client is doing, and assign payloads to those
// who are either idle or done.
- for (PeerWireClient *client : qAsConst(d->connections))
+ for (PeerWireClient *client : std::as_const(d->connections))
schedulePieceForClient(client);
}
@@ -1177,7 +1177,7 @@ void TorrentClient::schedulePieceForClient(PeerWireClient *client)
incompletePiecesAvailableToClient &= client->availablePieces();
// Remove all pieces that this client has already requested.
- for (int i : qAsConst(currentPieces))
+ for (int i : std::as_const(currentPieces))
incompletePiecesAvailableToClient.clearBit(i);
// Only continue if more pieces can be scheduled. If no pieces
@@ -1213,7 +1213,7 @@ void TorrentClient::schedulePieceForClient(PeerWireClient *client)
memset(occurrences, 0, d->pieceCount * sizeof(int));
// Count how many of each piece are available.
- for (PeerWireClient *peer : qAsConst(d->connections)) {
+ for (PeerWireClient *peer : std::as_const(d->connections)) {
QBitArray peerPieces = peer->availablePieces();
int peerPiecesSize = peerPieces.size();
for (int i = 0; i < peerPiecesSize; ++i) {
@@ -1311,7 +1311,7 @@ void TorrentClient::requestMore(PeerWireClient *client)
// Starting with the first piece that we're waiting for, request
// blocks until the quota is filled up.
- for (TorrentPiece *piece : qAsConst(piecesInProgress)) {
+ for (TorrentPiece *piece : std::as_const(piecesInProgress)) {
numBlocksInProgress += requestBlocks(client, piece, maxInProgress - numBlocksInProgress);
if (numBlocksInProgress == maxInProgress)
break;
@@ -1414,7 +1414,7 @@ void TorrentClient::addToPeerList(const QList<TorrentPeer> &peerList)
}
bool known = false;
- for (const TorrentPeer *knownPeer : qAsConst(d->peers)) {
+ for (const TorrentPeer *knownPeer : std::as_const(d->peers)) {
if (knownPeer->port == peer.port
&& knownPeer->address == peer.address) {
known = true;
@@ -1445,7 +1445,7 @@ void TorrentClient::addToPeerList(const QList<TorrentPeer> &peerList)
const auto firstNInactivePeers = [&tooMany, this] (TorrentPeer *peer) {
if (!tooMany)
return false;
- for (const PeerWireClient *client : qAsConst(d->connections)) {
+ for (const PeerWireClient *client : std::as_const(d->connections)) {
if (client->peer() == peer && (client->downloadSpeed() + client->uploadSpeed()) > 1024)
return false;
}
diff --git a/examples/network/torrent/torrentserver.cpp b/examples/network/torrent/torrentserver.cpp
index 8bdf98dd49..9751c25497 100644
--- a/examples/network/torrent/torrentserver.cpp
+++ b/examples/network/torrent/torrentserver.cpp
@@ -55,7 +55,7 @@ void TorrentServer::removeClient()
void TorrentServer::processInfoHash(const QByteArray &infoHash)
{
PeerWireClient *peer = qobject_cast<PeerWireClient *>(sender());
- for (TorrentClient *client : qAsConst(clients)) {
+ for (TorrentClient *client : std::as_const(clients)) {
if (client->state() >= TorrentClient::Searching && client->infoHash() == infoHash) {
peer->disconnect(peer, nullptr, this, nullptr);
client->setupIncomingConnection(peer);
diff --git a/examples/opengl/2dpainting/CMakeLists.txt b/examples/opengl/2dpainting/CMakeLists.txt
index 11e977b468..c6f320ffe7 100644
--- a/examples/opengl/2dpainting/CMakeLists.txt
+++ b/examples/opengl/2dpainting/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(2dpainting LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/opengl/2dpainting")
find_package(Qt6 REQUIRED COMPONENTS Core Gui OpenGL OpenGLWidgets Widgets)
+qt_standard_project_setup()
+
qt_add_executable(2dpainting
glwidget.cpp glwidget.h
helper.cpp helper.h
@@ -28,11 +28,11 @@ set_target_properties(2dpainting PROPERTIES
)
target_link_libraries(2dpainting PUBLIC
- Qt::Core
- Qt::Gui
- Qt::OpenGL
- Qt::OpenGLWidgets
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::OpenGL
+ Qt6::OpenGLWidgets
+ Qt6::Widgets
)
install(TARGETS 2dpainting
diff --git a/examples/opengl/CMakeLists.txt b/examples/opengl/CMakeLists.txt
index 0cd6a0cbba..9c6768f324 100644
--- a/examples/opengl/CMakeLists.txt
+++ b/examples/opengl/CMakeLists.txt
@@ -1,11 +1,11 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
qt_internal_add_example(hellowindow)
qt_internal_add_example(paintedwindow)
qt_internal_add_example(openglwindow)
qt_internal_add_example(qopenglwindow)
-if(TARGET Qt::Widgets)
+if(TARGET Qt6::Widgets)
qt_internal_add_example(contextinfo)
qt_internal_add_example(threadedqopenglwidget)
qt_internal_add_example(2dpainting)
diff --git a/examples/opengl/computegles31/CMakeLists.txt b/examples/opengl/computegles31/CMakeLists.txt
index 253221247b..ccbf158036 100644
--- a/examples/opengl/computegles31/CMakeLists.txt
+++ b/examples/opengl/computegles31/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(computegles31 LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/opengl/computegles31")
find_package(Qt6 REQUIRED COMPONENTS Core Gui OpenGL)
+qt_standard_project_setup()
+
qt_add_executable(computegles31
glwindow.cpp glwindow.h
main.cpp
@@ -25,9 +25,9 @@ set_target_properties(computegles31 PROPERTIES
)
target_link_libraries(computegles31 PUBLIC
- Qt::Core
- Qt::Gui
- Qt::OpenGL
+ Qt6::Core
+ Qt6::Gui
+ Qt6::OpenGL
)
# Resources:
diff --git a/examples/opengl/contextinfo/CMakeLists.txt b/examples/opengl/contextinfo/CMakeLists.txt
index 639275f3d1..7b49a02a53 100644
--- a/examples/opengl/contextinfo/CMakeLists.txt
+++ b/examples/opengl/contextinfo/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(contextinfo LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/opengl/contextinfo")
find_package(Qt6 REQUIRED COMPONENTS Core Gui OpenGL Widgets)
+qt_standard_project_setup()
+
qt_add_executable(contextinfo
main.cpp
renderwindow.cpp renderwindow.h
@@ -26,10 +26,10 @@ set_target_properties(contextinfo PROPERTIES
)
target_link_libraries(contextinfo PUBLIC
- Qt::Core
- Qt::Gui
- Qt::OpenGL
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::OpenGL
+ Qt6::Widgets
)
install(TARGETS contextinfo
diff --git a/examples/opengl/contextinfo/widget.cpp b/examples/opengl/contextinfo/widget.cpp
index a4ae397382..398f49b8dd 100644
--- a/examples/opengl/contextinfo/widget.cpp
+++ b/examples/opengl/contextinfo/widget.cpp
@@ -345,7 +345,7 @@ void Widget::renderWindowReady()
QList<QByteArray> extensionList = context->extensions().values();
std::sort(extensionList.begin(), extensionList.end());
m_extensions->append(tr("Found %1 extensions:").arg(extensionList.count()));
- for (const QByteArray &ext : qAsConst(extensionList))
+ for (const QByteArray &ext : std::as_const(extensionList))
m_extensions->append(QString::fromLatin1(ext));
m_output->moveCursor(QTextCursor::Start);
diff --git a/examples/opengl/cube/CMakeLists.txt b/examples/opengl/cube/CMakeLists.txt
index 00ec882c1f..ea999ed4e5 100644
--- a/examples/opengl/cube/CMakeLists.txt
+++ b/examples/opengl/cube/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(cube LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/opengl/cube")
find_package(Qt6 REQUIRED COMPONENTS Core Gui OpenGL OpenGLWidgets Widgets)
+qt_standard_project_setup()
+
qt_add_executable(cube
geometryengine.cpp geometryengine.h
main.cpp
@@ -26,11 +26,11 @@ set_target_properties(cube PROPERTIES
)
target_link_libraries(cube PUBLIC
- Qt::Core
- Qt::Gui
- Qt::OpenGL
- Qt::OpenGLWidgets
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::OpenGL
+ Qt6::OpenGLWidgets
+ Qt6::Widgets
)
# Resources:
diff --git a/examples/opengl/hellogl2/CMakeLists.txt b/examples/opengl/hellogl2/CMakeLists.txt
index 33829fbf8b..f15c5ffe85 100644
--- a/examples/opengl/hellogl2/CMakeLists.txt
+++ b/examples/opengl/hellogl2/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(hellogl2 LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/opengl/hellogl2")
find_package(Qt6 REQUIRED COMPONENTS Core Gui OpenGL OpenGLWidgets Widgets)
+qt_standard_project_setup()
+
qt_add_executable(hellogl2
glwidget.cpp glwidget.h
logo.cpp logo.h
@@ -28,11 +28,11 @@ set_target_properties(hellogl2 PROPERTIES
)
target_link_libraries(hellogl2 PUBLIC
- Qt::Core
- Qt::Gui
- Qt::OpenGL
- Qt::OpenGLWidgets
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::OpenGL
+ Qt6::OpenGLWidgets
+ Qt6::Widgets
)
install(TARGETS hellogl2
diff --git a/examples/opengl/hellogles3/CMakeLists.txt b/examples/opengl/hellogles3/CMakeLists.txt
index efa79acb4a..aa54ec9b93 100644
--- a/examples/opengl/hellogles3/CMakeLists.txt
+++ b/examples/opengl/hellogles3/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(hellogles3 LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/opengl/hellogles3")
find_package(Qt6 REQUIRED COMPONENTS Core Gui OpenGL)
+qt_standard_project_setup()
+
qt_add_executable(hellogles3
../hellogl2/logo.cpp ../hellogl2/logo.h
glwindow.cpp glwindow.h
@@ -26,9 +26,9 @@ set_target_properties(hellogles3 PROPERTIES
)
target_link_libraries(hellogles3 PUBLIC
- Qt::Core
- Qt::Gui
- Qt::OpenGL
+ Qt6::Core
+ Qt6::Gui
+ Qt6::OpenGL
)
# Resources:
diff --git a/examples/opengl/hellowindow/CMakeLists.txt b/examples/opengl/hellowindow/CMakeLists.txt
index 5335be6c6b..3ac623a99a 100644
--- a/examples/opengl/hellowindow/CMakeLists.txt
+++ b/examples/opengl/hellowindow/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(hellowindow LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/opengl/hellowindow")
find_package(Qt6 REQUIRED COMPONENTS Core Gui OpenGL)
+qt_standard_project_setup()
+
qt_add_executable(hellowindow
hellowindow.cpp hellowindow.h
main.cpp
@@ -25,11 +25,11 @@ set_target_properties(hellowindow PROPERTIES
)
target_link_libraries(hellowindow PUBLIC
- Qt::Core
- Qt::CorePrivate
- Qt::Gui
- Qt::GuiPrivate
- Qt::OpenGL
+ Qt6::Core
+ Qt6::CorePrivate
+ Qt6::Gui
+ Qt6::GuiPrivate
+ Qt6::OpenGL
)
install(TARGETS hellowindow
diff --git a/examples/opengl/openglwindow/CMakeLists.txt b/examples/opengl/openglwindow/CMakeLists.txt
index 33dc12c710..a22f92dcd8 100644
--- a/examples/opengl/openglwindow/CMakeLists.txt
+++ b/examples/opengl/openglwindow/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(openglwindow LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/opengl/openglwindow")
find_package(Qt6 REQUIRED COMPONENTS Core Gui OpenGL)
+qt_standard_project_setup()
+
qt_add_executable(openglwindow
main.cpp
openglwindow.cpp openglwindow.h
@@ -25,9 +25,9 @@ set_target_properties(openglwindow PROPERTIES
)
target_link_libraries(openglwindow PUBLIC
- Qt::Core
- Qt::Gui
- Qt::OpenGL
+ Qt6::Core
+ Qt6::Gui
+ Qt6::OpenGL
)
install(TARGETS openglwindow
diff --git a/examples/opengl/paintedwindow/CMakeLists.txt b/examples/opengl/paintedwindow/CMakeLists.txt
index 0d95a3f930..53ae5a01e2 100644
--- a/examples/opengl/paintedwindow/CMakeLists.txt
+++ b/examples/opengl/paintedwindow/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(paintedwindow LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/opengl/paintedwindow")
find_package(Qt6 REQUIRED COMPONENTS Core Gui OpenGL)
+qt_standard_project_setup()
+
qt_add_executable(paintedwindow
main.cpp
paintedwindow.cpp paintedwindow.h
@@ -25,9 +25,9 @@ set_target_properties(paintedwindow PROPERTIES
)
target_link_libraries(paintedwindow PUBLIC
- Qt::Core
- Qt::Gui
- Qt::OpenGL
+ Qt6::Core
+ Qt6::Gui
+ Qt6::OpenGL
)
install(TARGETS paintedwindow
diff --git a/examples/opengl/qopenglwidget/CMakeLists.txt b/examples/opengl/qopenglwidget/CMakeLists.txt
index 259ebdc43d..293d0b5037 100644
--- a/examples/opengl/qopenglwidget/CMakeLists.txt
+++ b/examples/opengl/qopenglwidget/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(qopenglwidget LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/opengl/qopenglwidget")
find_package(Qt6 REQUIRED COMPONENTS Core Gui OpenGL OpenGLWidgets Widgets)
+qt_standard_project_setup()
+
qt_add_executable(qopenglwidget
bubble.cpp bubble.h
glwidget.cpp glwidget.h
@@ -27,11 +27,11 @@ set_target_properties(qopenglwidget PROPERTIES
)
target_link_libraries(qopenglwidget PUBLIC
- Qt::Core
- Qt::Gui
- Qt::OpenGL
- Qt::OpenGLWidgets
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::OpenGL
+ Qt6::OpenGLWidgets
+ Qt6::Widgets
)
# Resources:
diff --git a/examples/opengl/qopenglwidget/glwidget.cpp b/examples/opengl/qopenglwidget/glwidget.cpp
index 96d5d51321..e2a3ea4fc5 100644
--- a/examples/opengl/qopenglwidget/glwidget.cpp
+++ b/examples/opengl/qopenglwidget/glwidget.cpp
@@ -358,7 +358,7 @@ void GLWidget::paintGL()
painter.endNativePainting();
if (m_showBubbles) {
- for (Bubble *bubble : qAsConst(m_bubbles))
+ for (Bubble *bubble : std::as_const(m_bubbles))
bubble->drawBubble(&painter);
}
@@ -371,7 +371,7 @@ void GLWidget::paintGL()
painter.end();
- for (Bubble *bubble : qAsConst(m_bubbles))
+ for (Bubble *bubble : std::as_const(m_bubbles))
bubble->move(rect());
if (!(m_frames % 100)) {
diff --git a/examples/opengl/qopenglwidget/mainwindow.cpp b/examples/opengl/qopenglwidget/mainwindow.cpp
index 409ff7b507..c383a692d5 100644
--- a/examples/opengl/qopenglwidget/mainwindow.cpp
+++ b/examples/opengl/qopenglwidget/mainwindow.cpp
@@ -133,7 +133,7 @@ void MainWindow::timerUsageChanged(bool enabled)
m_timer->start();
} else {
m_timer->stop();
- for (QOpenGLWidget *w : qAsConst(m_glWidgets))
+ for (QOpenGLWidget *w : std::as_const(m_glWidgets))
w->update();
}
}
diff --git a/examples/opengl/qopenglwindow/CMakeLists.txt b/examples/opengl/qopenglwindow/CMakeLists.txt
index 2778b2a07c..fd9f59b63e 100644
--- a/examples/opengl/qopenglwindow/CMakeLists.txt
+++ b/examples/opengl/qopenglwindow/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(qopenglwindow LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/opengl/qopenglwindow")
find_package(Qt6 REQUIRED COMPONENTS Core Gui OpenGL)
+qt_standard_project_setup()
+
qt_add_executable(qopenglwindow
background_renderer.cpp background_renderer.h
main.cpp
@@ -25,9 +25,9 @@ set_target_properties(qopenglwindow PROPERTIES
)
target_link_libraries(qopenglwindow PUBLIC
- Qt::Core
- Qt::Gui
- Qt::OpenGL
+ Qt6::Core
+ Qt6::Gui
+ Qt6::OpenGL
)
# Resources:
diff --git a/examples/opengl/textures/CMakeLists.txt b/examples/opengl/textures/CMakeLists.txt
index 1739e90051..bf22cda67f 100644
--- a/examples/opengl/textures/CMakeLists.txt
+++ b/examples/opengl/textures/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(textures LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/opengl/textures")
find_package(Qt6 REQUIRED COMPONENTS Core Gui OpenGL OpenGLWidgets Widgets)
+qt_standard_project_setup()
+
qt_add_executable(textures
glwidget.cpp glwidget.h
main.cpp
@@ -26,11 +26,11 @@ set_target_properties(textures PROPERTIES
)
target_link_libraries(textures PUBLIC
- Qt::Core
- Qt::Gui
- Qt::OpenGL
- Qt::OpenGLWidgets
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::OpenGL
+ Qt6::OpenGLWidgets
+ Qt6::Widgets
)
# Resources:
diff --git a/examples/opengl/threadedqopenglwidget/CMakeLists.txt b/examples/opengl/threadedqopenglwidget/CMakeLists.txt
index a3e7ee846a..23cedd81bd 100644
--- a/examples/opengl/threadedqopenglwidget/CMakeLists.txt
+++ b/examples/opengl/threadedqopenglwidget/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(threadedqopenglwidget LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/opengl/threadedqopenglwidget")
find_package(Qt6 REQUIRED COMPONENTS Core Gui OpenGL OpenGLWidgets Widgets)
+qt_standard_project_setup()
+
qt_add_executable(threadedqopenglwidget
renderer.cpp renderer.h
glwidget.cpp glwidget.h
@@ -27,11 +27,11 @@ set_target_properties(threadedqopenglwidget PROPERTIES
)
target_link_libraries(threadedqopenglwidget PUBLIC
- Qt::Core
- Qt::Gui
- Qt::OpenGL
- Qt::OpenGLWidgets
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::OpenGL
+ Qt6::OpenGLWidgets
+ Qt6::Widgets
)
install(TARGETS threadedqopenglwidget
diff --git a/examples/qpa/CMakeLists.txt b/examples/qpa/CMakeLists.txt
index c2bff33d64..a2b115fdf3 100644
--- a/examples/qpa/CMakeLists.txt
+++ b/examples/qpa/CMakeLists.txt
@@ -1,7 +1,7 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
-if(NOT TARGET Qt::Gui)
+if(NOT TARGET Qt6::Gui)
return()
endif()
qt_internal_add_example(windows)
diff --git a/examples/qpa/qrasterwindow/CMakeLists.txt b/examples/qpa/qrasterwindow/CMakeLists.txt
index 67d5d56e66..98068e87f8 100644
--- a/examples/qpa/qrasterwindow/CMakeLists.txt
+++ b/examples/qpa/qrasterwindow/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(qrasterwindow LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/qpa/qrasterwindow")
find_package(Qt6 REQUIRED COMPONENTS Core Gui)
+qt_standard_project_setup()
+
qt_add_executable(qrasterwindow
main.cpp
)
@@ -24,8 +24,8 @@ set_target_properties(qrasterwindow PROPERTIES
)
target_link_libraries(qrasterwindow PUBLIC
- Qt::Core
- Qt::Gui
+ Qt6::Core
+ Qt6::Gui
)
install(TARGETS qrasterwindow
diff --git a/examples/qpa/windows/CMakeLists.txt b/examples/qpa/windows/CMakeLists.txt
index 83fcdb94f4..fabc8665b0 100644
--- a/examples/qpa/windows/CMakeLists.txt
+++ b/examples/qpa/windows/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(windows LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/qpa/windows")
find_package(Qt6 REQUIRED COMPONENTS Core Gui)
+qt_standard_project_setup()
+
qt_add_executable(windows
main.cpp
window.cpp window.h
@@ -25,10 +25,10 @@ set_target_properties(windows PROPERTIES
)
target_link_libraries(windows PUBLIC
- Qt::Core
- Qt::CorePrivate
- Qt::Gui
- Qt::GuiPrivate
+ Qt6::Core
+ Qt6::CorePrivate
+ Qt6::Gui
+ Qt6::GuiPrivate
)
install(TARGETS windows
diff --git a/examples/qtconcurrent/CMakeLists.txt b/examples/qtconcurrent/CMakeLists.txt
index 3ae291d6cd..89462b589c 100644
--- a/examples/qtconcurrent/CMakeLists.txt
+++ b/examples/qtconcurrent/CMakeLists.txt
@@ -1,15 +1,15 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
-if(NOT TARGET Qt::Concurrent)
+if(NOT TARGET Qt6::Concurrent)
return()
endif()
-if(TARGET Qt::Widgets)
+if(TARGET Qt6::Widgets)
qt_internal_add_example(imagescaling)
qt_internal_add_example(progressdialog)
qt_internal_add_example(runfunction)
qt_internal_add_example(wordcount)
endif()
-if(TARGET Qt::Gui)
+if(TARGET Qt6::Gui)
qt_internal_add_example(map)
endif()
diff --git a/examples/qtconcurrent/imagescaling/CMakeLists.txt b/examples/qtconcurrent/imagescaling/CMakeLists.txt
index 452e9d871d..4ef3d5623e 100644
--- a/examples/qtconcurrent/imagescaling/CMakeLists.txt
+++ b/examples/qtconcurrent/imagescaling/CMakeLists.txt
@@ -1,12 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(imagescaling LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTOUIC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -15,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/qtconcurrent/imagescaling")
find_package(Qt6 REQUIRED COMPONENTS Concurrent Core Gui Network Widgets)
+qt_standard_project_setup()
+
qt_add_executable(imagescaling
downloaddialog.cpp downloaddialog.h downloaddialog.ui
imagescaling.cpp imagescaling.h
@@ -27,11 +26,11 @@ set_target_properties(imagescaling PROPERTIES
)
target_link_libraries(imagescaling PUBLIC
- Qt::Concurrent
- Qt::Core
- Qt::Gui
- Qt::Network
- Qt::Widgets
+ Qt6::Concurrent
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Network
+ Qt6::Widgets
)
install(TARGETS imagescaling
diff --git a/examples/qtconcurrent/map/CMakeLists.txt b/examples/qtconcurrent/map/CMakeLists.txt
index 1ae5c678b2..58caf882bc 100644
--- a/examples/qtconcurrent/map/CMakeLists.txt
+++ b/examples/qtconcurrent/map/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(mapdemo LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,14 +12,16 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/qtconcurrent/map")
find_package(Qt6 REQUIRED COMPONENTS Concurrent Core Gui)
+qt_standard_project_setup()
+
qt_add_executable(mapdemo
main.cpp
)
target_link_libraries(mapdemo PUBLIC
- Qt::Concurrent
- Qt::Core
- Qt::Gui
+ Qt6::Concurrent
+ Qt6::Core
+ Qt6::Gui
)
install(TARGETS mapdemo
diff --git a/examples/qtconcurrent/progressdialog/CMakeLists.txt b/examples/qtconcurrent/progressdialog/CMakeLists.txt
index c5d6c716f2..c021f80193 100644
--- a/examples/qtconcurrent/progressdialog/CMakeLists.txt
+++ b/examples/qtconcurrent/progressdialog/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(progressdialog LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/qtconcurrent/progressdialog")
find_package(Qt6 REQUIRED COMPONENTS Concurrent Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(progressdialog
main.cpp
)
@@ -24,10 +24,10 @@ set_target_properties(progressdialog PROPERTIES
)
target_link_libraries(progressdialog PUBLIC
- Qt::Concurrent
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Concurrent
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
install(TARGETS progressdialog
diff --git a/examples/qtconcurrent/runfunction/CMakeLists.txt b/examples/qtconcurrent/runfunction/CMakeLists.txt
index 0a9c049623..7793004519 100644
--- a/examples/qtconcurrent/runfunction/CMakeLists.txt
+++ b/examples/qtconcurrent/runfunction/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(runfunction LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,15 +12,17 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/qtconcurrent/runfunction")
find_package(Qt6 REQUIRED COMPONENTS Concurrent Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(runfunction
main.cpp
)
target_link_libraries(runfunction PUBLIC
- Qt::Concurrent
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Concurrent
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
install(TARGETS runfunction
diff --git a/examples/qtconcurrent/wordcount/CMakeLists.txt b/examples/qtconcurrent/wordcount/CMakeLists.txt
index 859b529ff7..1e62a0e3a2 100644
--- a/examples/qtconcurrent/wordcount/CMakeLists.txt
+++ b/examples/qtconcurrent/wordcount/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(wordcount LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,15 +12,17 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/qtconcurrent/wordcount")
find_package(Qt6 REQUIRED COMPONENTS Concurrent Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(wordcount
main.cpp
)
target_link_libraries(wordcount PUBLIC
- Qt::Concurrent
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Concurrent
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
install(TARGETS wordcount
diff --git a/examples/qtestlib/CMakeLists.txt b/examples/qtestlib/CMakeLists.txt
index 6b62348a0a..3ce21c9bbd 100644
--- a/examples/qtestlib/CMakeLists.txt
+++ b/examples/qtestlib/CMakeLists.txt
@@ -1,7 +1,7 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
-if(NOT TARGET Qt::Widgets)
+if(NOT TARGET Qt6::Widgets)
return()
endif()
qt_internal_add_example(tutorial1)
diff --git a/examples/qtestlib/tutorial1/CMakeLists.txt b/examples/qtestlib/tutorial1/CMakeLists.txt
index 816e0d2c67..76889d878f 100644
--- a/examples/qtestlib/tutorial1/CMakeLists.txt
+++ b/examples/qtestlib/tutorial1/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(tutorial1 LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/qtestlib/tutorial1")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Test Widgets)
+qt_standard_project_setup()
+
qt_add_executable(tutorial1
testqstring.cpp
)
@@ -24,10 +24,10 @@ set_target_properties(tutorial1 PROPERTIES
)
target_link_libraries(tutorial1 PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Test
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Test
+ Qt6::Widgets
)
install(TARGETS tutorial1
diff --git a/examples/qtestlib/tutorial2/CMakeLists.txt b/examples/qtestlib/tutorial2/CMakeLists.txt
index 49e79ece0f..3fb761f8ee 100644
--- a/examples/qtestlib/tutorial2/CMakeLists.txt
+++ b/examples/qtestlib/tutorial2/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(tutorial2 LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/qtestlib/tutorial2")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Test Widgets)
+qt_standard_project_setup()
+
qt_add_executable(tutorial2
testqstring.cpp
)
@@ -24,10 +24,10 @@ set_target_properties(tutorial2 PROPERTIES
)
target_link_libraries(tutorial2 PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Test
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Test
+ Qt6::Widgets
)
install(TARGETS tutorial2
diff --git a/examples/qtestlib/tutorial2/testqstring.cpp b/examples/qtestlib/tutorial2/testqstring.cpp
index 2e87292daa..fa6779a16f 100644
--- a/examples/qtestlib/tutorial2/testqstring.cpp
+++ b/examples/qtestlib/tutorial2/testqstring.cpp
@@ -20,9 +20,9 @@ void TestQString::toUpper_data()
QTest::addColumn<QString>("string");
QTest::addColumn<QString>("result");
- QTest::newRow("all lower") << "hello" << "HELLO";
+ QTest::newRow("all-lower") << "hello" << "HELLO";
QTest::newRow("mixed") << "Hello" << "HELLO";
- QTest::newRow("all upper") << "HELLO" << "HELLO";
+ QTest::newRow("all-upper") << "HELLO" << "HELLO";
}
//! [1]
diff --git a/examples/qtestlib/tutorial3/CMakeLists.txt b/examples/qtestlib/tutorial3/CMakeLists.txt
index 4f6760a143..6a83c0d00d 100644
--- a/examples/qtestlib/tutorial3/CMakeLists.txt
+++ b/examples/qtestlib/tutorial3/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(tutorial3 LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/qtestlib/tutorial3")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Test Widgets)
+qt_standard_project_setup()
+
qt_add_executable(tutorial3
testgui.cpp
)
@@ -24,10 +24,10 @@ set_target_properties(tutorial3 PROPERTIES
)
target_link_libraries(tutorial3 PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Test
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Test
+ Qt6::Widgets
)
install(TARGETS tutorial3
diff --git a/examples/qtestlib/tutorial4/CMakeLists.txt b/examples/qtestlib/tutorial4/CMakeLists.txt
index 31789da2af..61dde45c68 100644
--- a/examples/qtestlib/tutorial4/CMakeLists.txt
+++ b/examples/qtestlib/tutorial4/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(tutorial4 LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/qtestlib/tutorial4")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Test Widgets)
+qt_standard_project_setup()
+
qt_add_executable(tutorial4
testgui.cpp
)
@@ -24,10 +24,10 @@ set_target_properties(tutorial4 PROPERTIES
)
target_link_libraries(tutorial4 PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Test
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Test
+ Qt6::Widgets
)
install(TARGETS tutorial4
diff --git a/examples/qtestlib/tutorial4/testgui.cpp b/examples/qtestlib/tutorial4/testgui.cpp
index 58f895cef5..527532edee 100644
--- a/examples/qtestlib/tutorial4/testgui.cpp
+++ b/examples/qtestlib/tutorial4/testgui.cpp
@@ -28,7 +28,7 @@ void TestGui::testGui_data()
QTestEventList list2;
list2.addKeyClick('a');
list2.addKeyClick(Qt::Key_Backspace);
- QTest::newRow("there and back again") << list2 << "";
+ QTest::newRow("there+back-again") << list2 << "";
}
//! [1]
diff --git a/examples/qtestlib/tutorial5/CMakeLists.txt b/examples/qtestlib/tutorial5/CMakeLists.txt
index 47abcf5fc9..58cf0f61e3 100644
--- a/examples/qtestlib/tutorial5/CMakeLists.txt
+++ b/examples/qtestlib/tutorial5/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(tutorial5 LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/qtestlib/tutorial5")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Test Widgets)
+qt_standard_project_setup()
+
qt_add_executable(tutorial5
benchmarking.cpp
)
@@ -24,10 +24,10 @@ set_target_properties(tutorial5 PROPERTIES
)
target_link_libraries(tutorial5 PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Test
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Test
+ Qt6::Widgets
)
install(TARGETS tutorial5
diff --git a/examples/qtestlib/tutorial5/benchmarking.cpp b/examples/qtestlib/tutorial5/benchmarking.cpp
index d22baa3cff..d88780757a 100644
--- a/examples/qtestlib/tutorial5/benchmarking.cpp
+++ b/examples/qtestlib/tutorial5/benchmarking.cpp
@@ -33,8 +33,8 @@ void TestBenchmark::simple()
void TestBenchmark::multiple_data()
{
QTest::addColumn<bool>("useLocaleCompare");
- QTest::newRow("locale aware compare") << true;
- QTest::newRow("standard compare") << false;
+ QTest::newRow("locale-aware-compare") << true;
+ QTest::newRow("standard-compare") << false;
}
//! [1]
@@ -66,9 +66,8 @@ void TestBenchmark::series_data()
QTest::addColumn<int>("stringSize");
for (int i = 1; i < 10000; i += 2000) {
- QByteArray size = QByteArray::number(i);
- QTest::newRow(("locale aware compare--" + size).constData()) << true << i;
- QTest::newRow(("standard compare--" + size).constData()) << false << i;
+ QTest::addRow("locale-aware-compare:%d", i) << true << i;
+ QTest::addRow("standard-compare:%d", i) << false << i;
}
}
//! [4]
diff --git a/examples/sql/CMakeLists.txt b/examples/sql/CMakeLists.txt
index ccde50b250..ce1014a06a 100644
--- a/examples/sql/CMakeLists.txt
+++ b/examples/sql/CMakeLists.txt
@@ -1,7 +1,7 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
-if(NOT TARGET Qt::Widgets)
+if(NOT TARGET Qt6::Widgets)
return()
endif()
qt_internal_add_example(books)
@@ -11,7 +11,7 @@ qt_internal_add_example(querymodel)
qt_internal_add_example(relationaltablemodel)
qt_internal_add_example(sqlwidgetmapper)
qt_internal_add_example(tablemodel)
-if(TARGET Qt::Xml)
+if(TARGET Qt6::Xml)
qt_internal_add_example(masterdetail)
endif()
diff --git a/examples/sql/books/CMakeLists.txt b/examples/sql/books/CMakeLists.txt
index 86fdcb538c..928912922c 100644
--- a/examples/sql/books/CMakeLists.txt
+++ b/examples/sql/books/CMakeLists.txt
@@ -1,12 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(books LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTOUIC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -15,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/sql/books")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Sql Widgets)
+qt_standard_project_setup()
+
qt_add_executable(books
bookdelegate.cpp bookdelegate.h
bookwindow.cpp bookwindow.h bookwindow.ui
@@ -28,10 +27,10 @@ set_target_properties(books PROPERTIES
)
target_link_libraries(books PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Sql
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Sql
+ Qt6::Widgets
)
# Resources:
diff --git a/examples/sql/cachedtable/CMakeLists.txt b/examples/sql/cachedtable/CMakeLists.txt
index 8dac743572..806a80ade7 100644
--- a/examples/sql/cachedtable/CMakeLists.txt
+++ b/examples/sql/cachedtable/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(cachedtable LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/sql/cachedtable")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Sql Widgets)
+qt_standard_project_setup()
+
qt_add_executable(cachedtable
../connection.h
main.cpp
@@ -26,10 +26,10 @@ set_target_properties(cachedtable PROPERTIES
)
target_link_libraries(cachedtable PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Sql
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Sql
+ Qt6::Widgets
)
install(TARGETS cachedtable
diff --git a/examples/sql/drilldown/CMakeLists.txt b/examples/sql/drilldown/CMakeLists.txt
index 51569540ec..5c0398bb75 100644
--- a/examples/sql/drilldown/CMakeLists.txt
+++ b/examples/sql/drilldown/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(drilldown LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/sql/drilldown")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Sql Widgets)
+qt_standard_project_setup()
+
qt_add_executable(drilldown
../connection.h
imageitem.cpp imageitem.h
@@ -28,10 +28,10 @@ set_target_properties(drilldown PROPERTIES
)
target_link_libraries(drilldown PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Sql
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Sql
+ Qt6::Widgets
)
# Resources:
diff --git a/examples/sql/masterdetail/CMakeLists.txt b/examples/sql/masterdetail/CMakeLists.txt
index 01c687be0e..8e6bfd2367 100644
--- a/examples/sql/masterdetail/CMakeLists.txt
+++ b/examples/sql/masterdetail/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(masterdetail LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/sql/masterdetail")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Sql Widgets Xml)
+qt_standard_project_setup()
+
qt_add_executable(masterdetail
database.h
dialog.cpp dialog.h
@@ -27,11 +27,11 @@ set_target_properties(masterdetail PROPERTIES
)
target_link_libraries(masterdetail PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Sql
- Qt::Widgets
- Qt::Xml
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Sql
+ Qt6::Widgets
+ Qt6::Xml
)
# Resources:
diff --git a/examples/sql/querymodel/CMakeLists.txt b/examples/sql/querymodel/CMakeLists.txt
index 6118c38750..1682b56f16 100644
--- a/examples/sql/querymodel/CMakeLists.txt
+++ b/examples/sql/querymodel/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(querymodel LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/sql/querymodel")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Sql Widgets)
+qt_standard_project_setup()
+
qt_add_executable(querymodel
../connection.h
customsqlmodel.cpp customsqlmodel.h
@@ -27,10 +27,10 @@ set_target_properties(querymodel PROPERTIES
)
target_link_libraries(querymodel PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Sql
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Sql
+ Qt6::Widgets
)
install(TARGETS querymodel
diff --git a/examples/sql/relationaltablemodel/CMakeLists.txt b/examples/sql/relationaltablemodel/CMakeLists.txt
index d5d63ddc47..33e509767e 100644
--- a/examples/sql/relationaltablemodel/CMakeLists.txt
+++ b/examples/sql/relationaltablemodel/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(relationaltablemodel LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/sql/relationaltablemodel")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Sql Widgets)
+qt_standard_project_setup()
+
qt_add_executable(relationaltablemodel
../connection.h
relationaltablemodel.cpp
@@ -25,10 +25,10 @@ set_target_properties(relationaltablemodel PROPERTIES
)
target_link_libraries(relationaltablemodel PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Sql
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Sql
+ Qt6::Widgets
)
install(TARGETS relationaltablemodel
diff --git a/examples/sql/sqlbrowser/CMakeLists.txt b/examples/sql/sqlbrowser/CMakeLists.txt
index d36751f31c..52710b20f1 100644
--- a/examples/sql/sqlbrowser/CMakeLists.txt
+++ b/examples/sql/sqlbrowser/CMakeLists.txt
@@ -1,14 +1,11 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(sqlbrowser LANGUAGES CXX)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
-set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTOUIC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -17,6 +14,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/sql/sqlbrowser")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Sql Widgets)
+qt_standard_project_setup()
+
qt_add_executable(sqlbrowser
browser.cpp browser.h
browserwidget.ui
@@ -31,10 +30,10 @@ set_target_properties(sqlbrowser PROPERTIES
)
target_link_libraries(sqlbrowser PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Sql
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Sql
+ Qt6::Widgets
)
install(TARGETS sqlbrowser
diff --git a/examples/sql/sqlwidgetmapper/CMakeLists.txt b/examples/sql/sqlwidgetmapper/CMakeLists.txt
index 8ec7b2e8ae..4e4ecbc07b 100644
--- a/examples/sql/sqlwidgetmapper/CMakeLists.txt
+++ b/examples/sql/sqlwidgetmapper/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(sqlwidgetmapper LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/sql/sqlwidgetmapper")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Sql Widgets)
+qt_standard_project_setup()
+
qt_add_executable(sqlwidgetmapper
main.cpp
window.cpp window.h
@@ -25,10 +25,10 @@ set_target_properties(sqlwidgetmapper PROPERTIES
)
target_link_libraries(sqlwidgetmapper PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Sql
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Sql
+ Qt6::Widgets
)
install(TARGETS sqlwidgetmapper
diff --git a/examples/sql/tablemodel/CMakeLists.txt b/examples/sql/tablemodel/CMakeLists.txt
index c701dc7930..8a2f623499 100644
--- a/examples/sql/tablemodel/CMakeLists.txt
+++ b/examples/sql/tablemodel/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(tablemodel LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/sql/tablemodel")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Sql Widgets)
+qt_standard_project_setup()
+
qt_add_executable(tablemodel
../connection.h
tablemodel.cpp
@@ -25,10 +25,10 @@ set_target_properties(tablemodel PROPERTIES
)
target_link_libraries(tablemodel PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Sql
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Sql
+ Qt6::Widgets
)
install(TARGETS tablemodel
diff --git a/examples/vulkan/CMakeLists.txt b/examples/vulkan/CMakeLists.txt
index 9cd670d646..e4a1af8e26 100644
--- a/examples/vulkan/CMakeLists.txt
+++ b/examples/vulkan/CMakeLists.txt
@@ -1,12 +1,12 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
qt_internal_add_example(hellovulkanwindow)
qt_internal_add_example(hellovulkantriangle)
qt_internal_add_example(hellovulkantexture)
-if(TARGET Qt::Widgets)
+if(TARGET Qt6::Widgets)
qt_internal_add_example(hellovulkanwidget)
endif()
-if(TARGET Qt::Concurrent AND TARGET Qt::Widgets)
+if(TARGET Qt6::Concurrent AND TARGET Qt6::Widgets)
qt_internal_add_example(hellovulkancubes)
endif()
diff --git a/examples/vulkan/hellovulkancubes/CMakeLists.txt b/examples/vulkan/hellovulkancubes/CMakeLists.txt
index ebf2fe5fbd..fe23fcc0ed 100644
--- a/examples/vulkan/hellovulkancubes/CMakeLists.txt
+++ b/examples/vulkan/hellovulkancubes/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(hellovulkancubes LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/vulkan/hellovulkancubes")
find_package(Qt6 REQUIRED COMPONENTS Concurrent Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(hellovulkancubes
camera.cpp camera.h
main.cpp
@@ -30,10 +30,10 @@ set_target_properties(hellovulkancubes PROPERTIES
)
target_link_libraries(hellovulkancubes PUBLIC
- Qt::Concurrent
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Concurrent
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
# Resources:
diff --git a/examples/vulkan/hellovulkantexture/CMakeLists.txt b/examples/vulkan/hellovulkantexture/CMakeLists.txt
index 11de679126..b0ff1a16eb 100644
--- a/examples/vulkan/hellovulkantexture/CMakeLists.txt
+++ b/examples/vulkan/hellovulkantexture/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(hellovulkantexture LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/vulkan/hellovulkantexture")
find_package(Qt6 REQUIRED COMPONENTS Core Gui)
+qt_standard_project_setup()
+
qt_add_executable(hellovulkantexture
hellovulkantexture.cpp hellovulkantexture.h
main.cpp
@@ -25,8 +25,8 @@ set_target_properties(hellovulkantexture PROPERTIES
)
target_link_libraries(hellovulkantexture PUBLIC
- Qt::Core
- Qt::Gui
+ Qt6::Core
+ Qt6::Gui
)
# Resources:
diff --git a/examples/vulkan/hellovulkantriangle/CMakeLists.txt b/examples/vulkan/hellovulkantriangle/CMakeLists.txt
index 704e2f431f..c6b6826c90 100644
--- a/examples/vulkan/hellovulkantriangle/CMakeLists.txt
+++ b/examples/vulkan/hellovulkantriangle/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(hellovulkantriangle LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/vulkan/hellovulkantriangle")
find_package(Qt6 REQUIRED COMPONENTS Core Gui)
+qt_standard_project_setup()
+
qt_add_executable(hellovulkantriangle
../shared/trianglerenderer.cpp ../shared/trianglerenderer.h
main.cpp
@@ -25,8 +25,8 @@ set_target_properties(hellovulkantriangle PROPERTIES
)
target_link_libraries(hellovulkantriangle PUBLIC
- Qt::Core
- Qt::Gui
+ Qt6::Core
+ Qt6::Gui
)
# Resources:
diff --git a/examples/vulkan/hellovulkanwidget/CMakeLists.txt b/examples/vulkan/hellovulkanwidget/CMakeLists.txt
index d4e5f11ad3..f061686bf3 100644
--- a/examples/vulkan/hellovulkanwidget/CMakeLists.txt
+++ b/examples/vulkan/hellovulkanwidget/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(hellovulkanwidget LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/vulkan/hellovulkanwidget")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(hellovulkanwidget
../shared/trianglerenderer.cpp ../shared/trianglerenderer.h
hellovulkanwidget.cpp hellovulkanwidget.h
@@ -26,9 +26,9 @@ set_target_properties(hellovulkanwidget PROPERTIES
)
target_link_libraries(hellovulkanwidget PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
# Resources:
diff --git a/examples/vulkan/hellovulkanwindow/CMakeLists.txt b/examples/vulkan/hellovulkanwindow/CMakeLists.txt
index d6e041df55..17e84b7399 100644
--- a/examples/vulkan/hellovulkanwindow/CMakeLists.txt
+++ b/examples/vulkan/hellovulkanwindow/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(hellovulkanwindow LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/vulkan/hellovulkanwindow")
find_package(Qt6 REQUIRED COMPONENTS Core Gui)
+qt_standard_project_setup()
+
qt_add_executable(hellovulkanwindow
hellovulkanwindow.cpp hellovulkanwindow.h
main.cpp
@@ -25,8 +25,8 @@ set_target_properties(hellovulkanwindow PROPERTIES
)
target_link_libraries(hellovulkanwindow PUBLIC
- Qt::Core
- Qt::Gui
+ Qt6::Core
+ Qt6::Gui
)
install(TARGETS hellovulkanwindow
diff --git a/examples/widgets/CMakeLists.txt b/examples/widgets/CMakeLists.txt
index 52d9d11154..315865b841 100644
--- a/examples/widgets/CMakeLists.txt
+++ b/examples/widgets/CMakeLists.txt
@@ -1,7 +1,7 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
-if(NOT TARGET Qt::Widgets)
+if(NOT TARGET Qt6::Widgets)
return()
endif()
if(QT_FEATURE_animation)
@@ -28,6 +28,6 @@ endif()
if(QT_FEATURE_cursor)
add_subdirectory(mainwindows)
endif()
-if(QT_FEATURE_opengl AND TARGET Qt::Gui)
+if(QT_FEATURE_opengl AND TARGET Qt6::Gui)
qt_internal_add_example(windowcontainer)
endif()
diff --git a/examples/widgets/animation/easing/CMakeLists.txt b/examples/widgets/animation/easing/CMakeLists.txt
index d3667cd725..69f734d047 100644
--- a/examples/widgets/animation/easing/CMakeLists.txt
+++ b/examples/widgets/animation/easing/CMakeLists.txt
@@ -1,12 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(easing LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTOUIC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -15,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/animation/easing")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(easing
animation.h
form.ui
@@ -28,9 +27,9 @@ set_target_properties(easing PROPERTIES
)
target_link_libraries(easing PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
# Resources:
diff --git a/examples/widgets/animation/easing/animation.h b/examples/widgets/animation/easing/animation.h
index b6b4824583..111ad44f45 100644
--- a/examples/widgets/animation/easing/animation.h
+++ b/examples/widgets/animation/easing/animation.h
@@ -15,8 +15,8 @@ public:
CirclePath,
NPathTypes
};
- Animation(QObject *target, const QByteArray &prop)
- : QPropertyAnimation(target, prop)
+ Animation(QObject *target, const QByteArray &prop, QObject *parent = nullptr)
+ : QPropertyAnimation(target, prop, parent)
{
setPathType(LinearPath);
}
diff --git a/examples/widgets/animation/easing/window.cpp b/examples/widgets/animation/easing/window.cpp
index 260efa7832..11929738ae 100644
--- a/examples/widgets/animation/easing/window.cpp
+++ b/examples/widgets/animation/easing/window.cpp
@@ -35,7 +35,7 @@ Window::Window(QWidget *parent)
m_scene.addItem(m_item);
m_ui.graphicsView->setScene(&m_scene);
- m_anim = new Animation(m_item, "pos");
+ m_anim = new Animation(m_item, "pos", this);
m_anim->setEasingCurve(QEasingCurve::OutBounce);
m_ui.easingCurvePicker->setCurrentRow(int(QEasingCurve::OutBounce));
diff --git a/examples/widgets/desktop/screenshot/CMakeLists.txt b/examples/widgets/desktop/screenshot/CMakeLists.txt
index 9fe63429ea..e341726690 100644
--- a/examples/widgets/desktop/screenshot/CMakeLists.txt
+++ b/examples/widgets/desktop/screenshot/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(screenshot LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/desktop/screenshot")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(screenshot
main.cpp
screenshot.cpp screenshot.h
@@ -25,9 +25,9 @@ set_target_properties(screenshot PROPERTIES
)
target_link_libraries(screenshot PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
install(TARGETS screenshot
diff --git a/examples/widgets/desktop/systray/CMakeLists.txt b/examples/widgets/desktop/systray/CMakeLists.txt
index b83a567dd4..ae059d3f8e 100644
--- a/examples/widgets/desktop/systray/CMakeLists.txt
+++ b/examples/widgets/desktop/systray/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(systray LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/desktop/systray")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(systray
main.cpp
window.cpp window.h
@@ -25,9 +25,9 @@ set_target_properties(systray PROPERTIES
)
target_link_libraries(systray PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
# Resources:
diff --git a/examples/widgets/dialogs/CMakeLists.txt b/examples/widgets/dialogs/CMakeLists.txt
index 0d7cf6d5c7..bb966b485a 100644
--- a/examples/widgets/dialogs/CMakeLists.txt
+++ b/examples/widgets/dialogs/CMakeLists.txt
@@ -1,5 +1,5 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
if(QT_FEATURE_wizard)
qt_internal_add_example(classwizard)
@@ -9,6 +9,6 @@ qt_internal_add_example(extension)
qt_internal_add_example(findfiles)
qt_internal_add_example(standarddialogs)
qt_internal_add_example(tabdialog)
-if(QT_FEATURE_wizard AND TARGET Qt::PrintSupport)
+if(QT_FEATURE_wizard AND TARGET Qt6::PrintSupport)
qt_internal_add_example(licensewizard)
endif()
diff --git a/examples/widgets/dialogs/classwizard/CMakeLists.txt b/examples/widgets/dialogs/classwizard/CMakeLists.txt
index 3ff625dea7..9f6a2a37cc 100644
--- a/examples/widgets/dialogs/classwizard/CMakeLists.txt
+++ b/examples/widgets/dialogs/classwizard/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(classwizard LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/dialogs/classwizard")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(classwizard
classwizard.cpp classwizard.h
main.cpp
@@ -25,9 +25,9 @@ set_target_properties(classwizard PROPERTIES
)
target_link_libraries(classwizard PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
# Resources:
diff --git a/examples/widgets/dialogs/extension/CMakeLists.txt b/examples/widgets/dialogs/extension/CMakeLists.txt
index 5b208f4e2b..7f34c1343d 100644
--- a/examples/widgets/dialogs/extension/CMakeLists.txt
+++ b/examples/widgets/dialogs/extension/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(extension LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/dialogs/extension")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(extension
finddialog.cpp finddialog.h
main.cpp
@@ -25,9 +25,9 @@ set_target_properties(extension PROPERTIES
)
target_link_libraries(extension PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
install(TARGETS extension
diff --git a/examples/widgets/dialogs/findfiles/CMakeLists.txt b/examples/widgets/dialogs/findfiles/CMakeLists.txt
index d7a52d7485..09d01b8dd9 100644
--- a/examples/widgets/dialogs/findfiles/CMakeLists.txt
+++ b/examples/widgets/dialogs/findfiles/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(findfiles LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/dialogs/findfiles")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(findfiles
main.cpp
window.cpp window.h
@@ -25,9 +25,9 @@ set_target_properties(findfiles PROPERTIES
)
target_link_libraries(findfiles PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
install(TARGETS findfiles
diff --git a/examples/widgets/dialogs/licensewizard/CMakeLists.txt b/examples/widgets/dialogs/licensewizard/CMakeLists.txt
index b62a8e6a2c..d8df8538f4 100644
--- a/examples/widgets/dialogs/licensewizard/CMakeLists.txt
+++ b/examples/widgets/dialogs/licensewizard/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(licensewizard LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/dialogs/licensewizard")
find_package(Qt6 REQUIRED COMPONENTS Core Gui PrintSupport Widgets)
+qt_standard_project_setup()
+
qt_add_executable(licensewizard
licensewizard.cpp licensewizard.h
main.cpp
@@ -25,10 +25,10 @@ set_target_properties(licensewizard PROPERTIES
)
target_link_libraries(licensewizard PUBLIC
- Qt::Core
- Qt::Gui
- Qt::PrintSupport
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::PrintSupport
+ Qt6::Widgets
)
# Resources:
diff --git a/examples/widgets/dialogs/standarddialogs/CMakeLists.txt b/examples/widgets/dialogs/standarddialogs/CMakeLists.txt
index a83cb50be3..33fc0ec28f 100644
--- a/examples/widgets/dialogs/standarddialogs/CMakeLists.txt
+++ b/examples/widgets/dialogs/standarddialogs/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(standarddialogs LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/dialogs/standarddialogs")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(standarddialogs
dialog.cpp dialog.h
main.cpp
@@ -25,9 +25,9 @@ set_target_properties(standarddialogs PROPERTIES
)
target_link_libraries(standarddialogs PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
install(TARGETS standarddialogs
diff --git a/examples/widgets/dialogs/standarddialogs/dialog.cpp b/examples/widgets/dialogs/standarddialogs/dialog.cpp
index 1775a4231a..9f1cc96528 100644
--- a/examples/widgets/dialogs/standarddialogs/dialog.cpp
+++ b/examples/widgets/dialogs/standarddialogs/dialog.cpp
@@ -5,16 +5,6 @@
#include "dialog.h"
-#define MESSAGE \
- Dialog::tr("<p>Message boxes have a caption, a text, " \
- "and any number of buttons, each with standard or custom texts." \
- "<p>Click a button to close the message box. Pressing the Esc button " \
- "will activate the detected escape button (if any).")
-#define MESSAGE_DETAILS \
- Dialog::tr("If a message box has detailed text, the user can reveal it " \
- "by pressing the Show Details... button.")
-
-
class DialogOptionsWidget : public QGroupBox
{
public:
@@ -52,7 +42,7 @@ void DialogOptionsWidget::addSpacer()
int DialogOptionsWidget::value() const
{
int result = 0;
- for (const CheckBoxEntry &checkboxEntry : qAsConst(checkBoxEntries)) {
+ for (const CheckBoxEntry &checkboxEntry : std::as_const(checkBoxEntries)) {
if (checkboxEntry.first->isChecked())
result |= checkboxEntry.second;
}
@@ -413,10 +403,14 @@ void Dialog::setSaveFileName()
void Dialog::criticalMessage()
{
- QMessageBox::StandardButton reply;
- reply = QMessageBox::critical(this, tr("QMessageBox::critical()"),
- MESSAGE,
- QMessageBox::Abort | QMessageBox::Retry | QMessageBox::Ignore);
+ QMessageBox msgBox(QMessageBox::Critical, tr("QMessageBox::critical()"),
+ tr("Houston, we have a problem"), { }, this);
+ msgBox.setInformativeText(tr("Activating the liquid oxygen stirring fans caused an explosion in one of the tanks. " \
+ "Liquid oxygen levels are getting low. This may jeopardize the moon landing mission."));
+ msgBox.addButton(QMessageBox::Abort);
+ msgBox.addButton(QMessageBox::Retry);
+ msgBox.addButton(QMessageBox::Ignore);
+ int reply = msgBox.exec();
if (reply == QMessageBox::Abort)
criticalLabel->setText(tr("Abort"));
else if (reply == QMessageBox::Retry)
@@ -427,9 +421,12 @@ void Dialog::criticalMessage()
void Dialog::informationMessage()
{
- QMessageBox::StandardButton reply;
- reply = QMessageBox::information(this, tr("QMessageBox::information()"), MESSAGE);
- if (reply == QMessageBox::Ok)
+ QMessageBox msgBox(QMessageBox::Information, tr("QMessageBox::information()"),
+ tr("Elvis has left the building."), { }, this);
+ msgBox.setInformativeText(tr("This phrase was often used by public address announcers at the conclusion " \
+ "of Elvis Presley concerts in order to disperse audiences who lingered in " \
+ "hopes of an encore. It has since become a catchphrase and punchline."));
+ if (msgBox.exec() == QMessageBox::Ok)
informationLabel->setText(tr("OK"));
else
informationLabel->setText(tr("Escape"));
@@ -437,10 +434,15 @@ void Dialog::informationMessage()
void Dialog::questionMessage()
{
- QMessageBox::StandardButton reply;
- reply = QMessageBox::question(this, tr("QMessageBox::question()"),
- MESSAGE,
- QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel);
+ QMessageBox msgBox(QMessageBox::Question, tr("QMessageBox::question()"),
+ tr("Would you like cheese with that?"), { }, this);
+ msgBox.setInformativeText(tr("A cheeseburger is a hamburger topped with cheese. Traditionally, the slice of " \
+ "cheese is placed on top of the meat patty. The cheese is usually added to the " \
+ "cooking hamburger patty shortly before serving, which allows the cheese to melt."));
+ msgBox.addButton(QMessageBox::Yes);
+ msgBox.addButton(QMessageBox::No);
+ msgBox.addButton(QMessageBox::Cancel);
+ int reply = msgBox.exec();
if (reply == QMessageBox::Yes)
questionLabel->setText(tr("Yes"));
else if (reply == QMessageBox::No)
@@ -452,14 +454,15 @@ void Dialog::questionMessage()
void Dialog::warningMessage()
{
QMessageBox msgBox(QMessageBox::Warning, tr("QMessageBox::warning()"),
- MESSAGE, { }, this);
- msgBox.setDetailedText(MESSAGE_DETAILS);
- msgBox.addButton(tr("Save &Again"), QMessageBox::AcceptRole);
- msgBox.addButton(tr("&Continue"), QMessageBox::RejectRole);
+ tr("Delete the only copy of your movie manuscript?"), { }, this);
+ msgBox.setInformativeText(tr("You've been working on this manuscript for 738 days now. Hang in there!"));
+ msgBox.setDetailedText("\"A long time ago in a galaxy far, far away....\"");
+ msgBox.addButton(tr("&Keep"), QMessageBox::AcceptRole);
+ msgBox.addButton(tr("Delete"), QMessageBox::DestructiveRole);
if (msgBox.exec() == QMessageBox::AcceptRole)
- warningLabel->setText(tr("Save Again"));
+ warningLabel->setText(tr("Keep"));
else
- warningLabel->setText(tr("Continue"));
+ warningLabel->setText(tr("Delete"));
}
diff --git a/examples/widgets/dialogs/standarddialogs/main.mm b/examples/widgets/dialogs/standarddialogs/main.mm
new file mode 100644
index 0000000000..558ef4e680
--- /dev/null
+++ b/examples/widgets/dialogs/standarddialogs/main.mm
@@ -0,0 +1,47 @@
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+#include <QApplication>
+#include <QScreen>
+#include <QStyleHints>
+#include <QTranslator>
+#include <QLocale>
+#include <QLibraryInfo>
+
+#include "dialog.h"
+
+#include <AppKit/AppKit.h>
+
+using namespace Qt::StringLiterals;
+
+int main(int argc, char *argv[])
+{
+ [NSApplication sharedApplication];
+ NSApplicationLoad();
+ NSApplicationLoad();
+ [NSApp run];
+
+ QApplication app(argc, argv);
+ //app.setAttribute(Qt::AA_DontUseNativeDialogs);
+
+#if QT_CONFIG(translation)
+ QTranslator translator;
+ if (translator.load(QLocale::system(), u"qtbase"_s, u"_"_s,
+ QLibraryInfo::path(QLibraryInfo::TranslationsPath))) {
+ app.installTranslator(&translator);
+ }
+#endif
+
+ QGuiApplication::setApplicationDisplayName(Dialog::tr("Standard Dialogs"));
+
+ Dialog dialog;
+ if (!QGuiApplication::styleHints()->showIsFullScreen() && !QGuiApplication::styleHints()->showIsMaximized()) {
+ const QRect availableGeometry = dialog.screen()->availableGeometry();
+ dialog.resize(availableGeometry.width() / 3, availableGeometry.height() * 2 / 3);
+ dialog.move((availableGeometry.width() - dialog.width()) / 2,
+ (availableGeometry.height() - dialog.height()) / 2);
+ }
+ dialog.show();
+
+ return app.exec();
+}
diff --git a/examples/widgets/dialogs/tabdialog/CMakeLists.txt b/examples/widgets/dialogs/tabdialog/CMakeLists.txt
index 9bdf61773f..570db34c8d 100644
--- a/examples/widgets/dialogs/tabdialog/CMakeLists.txt
+++ b/examples/widgets/dialogs/tabdialog/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(tabdialog LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/dialogs/tabdialog")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(tabdialog
main.cpp
tabdialog.cpp tabdialog.h
@@ -25,9 +25,9 @@ set_target_properties(tabdialog PROPERTIES
)
target_link_libraries(tabdialog PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
install(TARGETS tabdialog
diff --git a/examples/widgets/dialogs/trivialwizard/CMakeLists.txt b/examples/widgets/dialogs/trivialwizard/CMakeLists.txt
index bd0765ba54..9f4a3d3ba8 100644
--- a/examples/widgets/dialogs/trivialwizard/CMakeLists.txt
+++ b/examples/widgets/dialogs/trivialwizard/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(trivialwizard LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/dialogs/trivialwizard")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(trivialwizard
trivialwizard.cpp
)
@@ -24,9 +24,9 @@ set_target_properties(trivialwizard PROPERTIES
)
target_link_libraries(trivialwizard PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
install(TARGETS trivialwizard
diff --git a/examples/widgets/doc/dropsite.qdoc b/examples/widgets/doc/dropsite.qdoc
index fb10643f48..5ebf0ff3a4 100644
--- a/examples/widgets/doc/dropsite.qdoc
+++ b/examples/widgets/doc/dropsite.qdoc
@@ -25,8 +25,8 @@
\snippet draganddrop/dropsite/droparea.h DropArea header part1
- In addition, \c DropArea also contains a private instance of QLabel and
- reimplementations of four \l{QWidget} event handlers:
+ In addition, \c DropArea contains reimplementations of four \l{QWidget}
+ event handlers:
\list 1
\li \l{QWidget::dragEnterEvent()}{dragEnterEvent()}
diff --git a/examples/widgets/doc/src/i18n.qdoc b/examples/widgets/doc/src/i18n.qdoc
deleted file mode 100644
index 6077691b92..0000000000
--- a/examples/widgets/doc/src/i18n.qdoc
+++ /dev/null
@@ -1,16 +0,0 @@
-// Copyright (C) 2016 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
-
-/*!
- \example tools/i18n
- \title I18N Example
- \ingroup examples-widgets-tools
-
- \brief The Internationalization (I18N) example demonstrates Qt's support for translated
- text. Developers can write the initial application text in one language, and
- translations can be provided later without any modifications to the code. It also
- demonstrates how to detect the system language settings and show the UI in the appropriate
- language.
-
- \image i18n-example.png
-*/
diff --git a/examples/widgets/doc/src/shortcuteditor.qdoc b/examples/widgets/doc/src/shortcuteditor.qdoc
new file mode 100644
index 0000000000..350609c962
--- /dev/null
+++ b/examples/widgets/doc/src/shortcuteditor.qdoc
@@ -0,0 +1,230 @@
+// Copyright (C) 2022 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
+
+/*!
+ \example widgets/shortcuteditor
+ \title Shortcut Editor Example
+ \ingroup examples-widgets
+ \brief The Shortcut Editor example shows how to create a basic, read-write
+ hierarchical model to use with Qt's standard view and QKeySequenceEdit
+ classes. For a description of Model/View Programming, see the \l{Model/View
+ Programming} overview.
+
+ \image shortcuteditor-example.png
+
+ Qt's model/view architecture provides a standard way for views to
+ manipulate information in a data source, using an abstract model
+ of the data to simplify and standardize the way it is accessed.
+ The shortcut editor model represents the actions as a tree of items, and
+ allow views to access this data via an
+ \l{Model/View Programming#Models}{index-based} system. More generally,
+ models can be used to represent data in the form of a tree structure
+ by allowing each item to act as a parent to a table of child items.
+
+ \section1 Design and Concepts
+
+ The data structure that we use to represent the structure of the data takes
+ the form of a tree built from ShortcutEditorModelItem objects. Each
+ ShortcutEditorModelItem represents an item in a tree view, and contains
+ two columns of data.
+
+ \table
+ \row \li \inlineimage treemodel-structure.png
+ \li \b{Shortcut Editor Structure}
+
+ The data is stored internally in the model using ShortcutEditorModelItem
+ objects that are linked together in a pointer-based tree structure.
+ Generally, each ShortcutEditorModelItem has a parent item, and can have a
+ number of child items. However, the root item in the tree structure has no
+ parent item and it is never referenced outside the model.
+
+ Each ShortcutEditorModelItem contains information about its place in the
+ tree structure; it can return its parent item and its row number. Having
+ this information readily available makes implementing the model easier.
+
+ Since each item in a tree view usually contains several columns of data
+ (a name and a shortcut in this example), it is natural to store this
+ information in each item. For simplicity, we will use a list of QVariant
+ objects to store the data for each column in the item.
+ \endtable
+
+ The use of a pointer-based tree structure means that, when passing a
+ model index to a view, we can record the address of the corresponding
+ item in the index (see QAbstractItemModel::createIndex()) and retrieve
+ it later with QModelIndex::internalPointer(). This makes writing the
+ model easier and ensures that all model indexes that refer to the same
+ item have the same internal data pointer.
+
+ With the appropriate data structure in place, we can create a tree model
+ with a minimal amount of extra code to supply model indexes and data to
+ other components.
+
+ \section1 ShortcutEditorModelItem Class Definition
+
+ The ShortcutEditorModelItem class is defined as follows:
+
+ The class is a basic C++ class. It does not inherit from QObject or
+ provide signals and slots. It is used to hold a list of QVariants,
+ containing column data, and information about its position in the tree
+ structure. The functions provide the following features:
+
+ \list
+ \li The \c appendChildItem() is used to add data when the model is first
+ constructed and is not used during normal use.
+ \li The \c child() and \c childCount() functions allow the model to obtain
+ information about any child items.
+ \li Information about the number of columns associated with the item is
+ provided by \c columnCount(), and the data in each column can be
+ obtained with the data() function.
+ \li The \c row() and \c parent() functions are used to obtain the item's
+ row number and parent item.
+ \endlist
+
+ The parent item and column data are stored in the \c parentItem and
+ \c itemData private member variables. The \c childItems variable contains
+ a list of pointers to the item's own child items.
+
+ \section1 ShortcutEditorModel Class Definition
+
+ The \c ShortcutEditorModel class is defined as follows:
+
+ \snippet widgets/shortcuteditor/shortcuteditormodel.h 0
+
+ This class is similar to most other subclasses of QAbstractItemModel that
+ provide read-write models. Only the form of the constructor and the
+ \c setupModelData() function are specific to this model. In addition, we
+ provide a destructor to clean up when the model is destroyed.
+
+ \section1 ShortcutEditorModel Class Implementation
+
+ The constructor takes an argument containing the data that the model will
+ share with views and delegates:
+
+ \snippet widgets/shortcuteditor/shortcuteditormodel.cpp 0
+
+ It is up to the constructor to create a root item for the model. This
+ item only contains vertical header data for convenience. We also use it
+ to reference the internal data structure that contains the model data,
+ and it is used to represent an imaginary parent of top-level items in
+ the model.
+
+ The model's internal data structure is populated with items by the
+ \c setupModelData() function. We will examine this function separately
+ at the end of this document.
+
+ The destructor ensures that the root item and all of its descendants
+ are deleted when the model is destroyed:
+
+ \snippet widgets/shortcuteditor/shortcuteditormodel.cpp 1
+
+ Since we cannot add data to the model after it is constructed and set
+ up, this simplifies the way that the internal tree of items is managed.
+
+ Models must implement an \c index() function to provide indexes for
+ views and delegates to use when accessing data. Indexes are created
+ for other components when they are referenced by their row and column
+ numbers, and their parent model index. If an invalid model
+ index is specified as the parent, it is up to the model to return an
+ index that corresponds to a top-level item in the model.
+
+ When supplied with a model index, we first check whether it is valid.
+ If it is not, we assume that a top-level item is being referred to;
+ otherwise, we obtain the data pointer from the model index with its
+ \l{QModelIndex::internalPointer()}{internalPointer()} function and use
+ it to reference a \c TreeItem object. Note that all the model indexes
+ that we construct will contain a pointer to an existing \c TreeItem,
+ so we can guarantee that any valid model indexes that we receive will
+ contain a valid data pointer.
+
+ \snippet widgets/shortcuteditor/shortcuteditormodel.cpp 2
+
+ Since the row and column arguments to this function refer to a
+ child item of the corresponding parent item, we obtain the item using
+ the \c TreeItem::child() function. The
+ \l{QAbstractItemModel::createIndex()}{createIndex()} function is used
+ to create a model index to be returned. We specify the row and column
+ numbers, and a pointer to the item itself. The model index can be used
+ later to obtain the item's data.
+
+ The way that the \c TreeItem objects are defined makes writing the
+ \c parent() function easy:
+
+ \snippet widgets/shortcuteditor/shortcuteditormodel.cpp 3
+
+ We only need to ensure that we never return a model index corresponding
+ to the root item. To be consistent with the way that the \c index()
+ function is implemented, we return an invalid model index for the
+ parent of any top-level items in the model.
+
+ When creating a model index to return, we must specify the row and
+ column numbers of the parent item within its own parent. We can
+ easily discover the row number with the \c TreeItem::row() function,
+ but we follow a convention of specifying 0 as the column number of
+ the parent. The model index is created with
+ \l{QAbstractItemModel::createIndex()}{createIndex()} in the same way
+ as in the \c index() function.
+
+ The \c rowCount() function simply returns the number of child items
+ for the \c TreeItem that corresponds to a given model index, or the
+ number of top-level items if an invalid index is specified:
+
+ \snippet widgets/shortcuteditor/shortcuteditormodel.cpp 4
+
+ Since each item manages its own column data, the \c columnCount()
+ function has to call the item's own \c columnCount() function to
+ determine how many columns are present for a given model index.
+ As with the \c rowCount() function, if an invalid model index is
+ specified, the number of columns returned is determined from the
+ root item:
+
+ \snippet widgets/shortcuteditor/shortcuteditormodel.cpp 5
+
+ Data is obtained from the model via \c data(). Since the item manages
+ its own columns, we need to use the column number to retrieve the data
+ with the \c TreeItem::data() function:
+
+ \snippet widgets/shortcuteditor/shortcuteditormodel.cpp 6
+
+ Note that we only support the \l{Qt::ItemDataRole}{DisplayRole}
+ in this implementation, and we also return invalid QVariant objects for
+ invalid model indexes.
+
+ We use the \c flags() function to ensure that views know that the
+ model is read-only:
+
+ \snippet widgets/shortcuteditor/shortcuteditormodel.cpp 7
+
+ The \c headerData() function returns data that we conveniently stored
+ in the root item:
+
+ \snippet widgets/shortcuteditor/shortcuteditormodel.cpp 8
+
+ This information could have been supplied in a different way: either
+ specified in the constructor, or hard coded into the \c headerData()
+ function.
+
+ \snippet widgets/shortcuteditor/shortcuteditormodel.cpp 9
+
+ TODO
+
+ \snippet widgets/shortcuteditor/shortcuteditormodel.cpp 10
+
+ TODO
+
+ \snippet widgets/shortcuteditor/shortcuteditormodel.cpp 11
+
+ TODO
+
+ \section1 Setting Up the Data in the Model
+
+ We use the \c setupModelData() function to set up the initial data in
+ the model. This function retrieves the registered actions text and creates
+ item objects that record both the data and the overall model structure.
+ Naturally, this function works in a way that is very specific to
+ this model. We provide the following description of its behavior,
+ and refer the reader to the example code itself for more information.
+
+ To ensure that the model works correctly, it is only necessary to
+ create instances of ShortcutEditorModelItem with the correct data and
+ parent item.
+*/
diff --git a/examples/widgets/draganddrop/CMakeLists.txt b/examples/widgets/draganddrop/CMakeLists.txt
index 9327e47b90..c75600f660 100644
--- a/examples/widgets/draganddrop/CMakeLists.txt
+++ b/examples/widgets/draganddrop/CMakeLists.txt
@@ -1,5 +1,5 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
qt_internal_add_example(draggableicons)
qt_internal_add_example(draggabletext)
diff --git a/examples/widgets/draganddrop/draggableicons/CMakeLists.txt b/examples/widgets/draganddrop/draggableicons/CMakeLists.txt
index bc430717f8..39ed7d760a 100644
--- a/examples/widgets/draganddrop/draggableicons/CMakeLists.txt
+++ b/examples/widgets/draganddrop/draggableicons/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(draggableicons LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/draganddrop/draggableicon
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(draggableicons
dragwidget.cpp dragwidget.h
main.cpp
@@ -25,9 +25,9 @@ set_target_properties(draggableicons PROPERTIES
)
target_link_libraries(draggableicons PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
# Resources:
diff --git a/examples/widgets/draganddrop/draggabletext/CMakeLists.txt b/examples/widgets/draganddrop/draggabletext/CMakeLists.txt
index 6763be8444..5e1514aae5 100644
--- a/examples/widgets/draganddrop/draggabletext/CMakeLists.txt
+++ b/examples/widgets/draganddrop/draggabletext/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(draggabletext LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/draganddrop/draggabletext
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(draggabletext
dragwidget.cpp dragwidget.h
main.cpp
@@ -25,9 +25,9 @@ set_target_properties(draggabletext PROPERTIES
)
target_link_libraries(draggabletext PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
# Resources:
diff --git a/examples/widgets/draganddrop/dropsite/CMakeLists.txt b/examples/widgets/draganddrop/dropsite/CMakeLists.txt
index a4f48c0fb8..8c8a28ad60 100644
--- a/examples/widgets/draganddrop/dropsite/CMakeLists.txt
+++ b/examples/widgets/draganddrop/dropsite/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(dropsite LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/draganddrop/dropsite")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(dropsite
droparea.cpp droparea.h
dropsitewindow.cpp dropsitewindow.h
@@ -26,9 +26,9 @@ set_target_properties(dropsite PROPERTIES
)
target_link_libraries(dropsite PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
install(TARGETS dropsite
diff --git a/examples/widgets/draganddrop/dropsite/droparea.cpp b/examples/widgets/draganddrop/dropsite/droparea.cpp
index 096f59fe16..1b2ff1820d 100644
--- a/examples/widgets/draganddrop/dropsite/droparea.cpp
+++ b/examples/widgets/draganddrop/dropsite/droparea.cpp
@@ -6,6 +6,8 @@
#include <QDragEnterEvent>
#include <QMimeData>
+using namespace Qt::StringLiterals;
+
//! [DropArea constructor]
DropArea::DropArea(QWidget *parent)
: QLabel(parent)
@@ -46,8 +48,8 @@ void DropArea::dropEvent(QDropEvent *event)
//! [dropEvent() function part2]
if (mimeData->hasImage()) {
setPixmap(qvariant_cast<QPixmap>(mimeData->imageData()));
- } else if (mimeData->hasFormat(QLatin1String("text/markdown"))) {
- setText(QString::fromUtf8(mimeData->data(QLatin1String("text/markdown"))));
+ } else if (mimeData->hasFormat(u"text/markdown"_s)) {
+ setText(QString::fromUtf8(mimeData->data(u"text/markdown"_s)));
setTextFormat(Qt::MarkdownText);
} else if (mimeData->hasHtml()) {
setText(mimeData->html());
@@ -58,8 +60,8 @@ void DropArea::dropEvent(QDropEvent *event)
} else if (mimeData->hasUrls()) {
QList<QUrl> urlList = mimeData->urls();
QString text;
- for (int i = 0; i < urlList.size() && i < 32; ++i)
- text += urlList.at(i).path() + QLatin1Char('\n');
+ for (qsizetype i = 0, count = qMin(urlList.size(), qsizetype(32)); i < count; ++i)
+ text += urlList.at(i).path() + u'\n';
setText(text);
} else {
setText(tr("Cannot display data"));
diff --git a/examples/widgets/draganddrop/dropsite/droparea.h b/examples/widgets/draganddrop/dropsite/droparea.h
index 507f8d854f..3e5947b236 100644
--- a/examples/widgets/draganddrop/dropsite/droparea.h
+++ b/examples/widgets/draganddrop/dropsite/droparea.h
@@ -31,9 +31,6 @@ protected:
void dragMoveEvent(QDragMoveEvent *event) override;
void dragLeaveEvent(QDragLeaveEvent *event) override;
void dropEvent(QDropEvent *event) override;
-
-private:
- QLabel *label;
};
//! [DropArea header part2]
diff --git a/examples/widgets/draganddrop/dropsite/dropsitewindow.cpp b/examples/widgets/draganddrop/dropsite/dropsitewindow.cpp
index 0208f76a50..2969fdf7ae 100644
--- a/examples/widgets/draganddrop/dropsite/dropsitewindow.cpp
+++ b/examples/widgets/draganddrop/dropsite/dropsitewindow.cpp
@@ -1,11 +1,23 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-#include <QtWidgets>
+#include <QPushButton>
+#include <QDialogButtonBox>
+#include <QHeaderView>
+#include <QTableWidget>
+#include <QTableWidgetItem>
+#include <QVBoxLayout>
+
+#include <QClipboard>
+#include <QGuiApplication>
+
+#include <QMimeData>
#include "droparea.h"
#include "dropsitewindow.h"
+using namespace Qt::StringLiterals;
+
//! [constructor part1]
DropSiteWindow::DropSiteWindow()
{
@@ -23,13 +35,10 @@ DropSiteWindow::DropSiteWindow()
//! [constructor part2]
//! [constructor part3]
- QStringList labels;
- labels << tr("Format") << tr("Content");
-
formatsTable = new QTableWidget;
formatsTable->setColumnCount(2);
formatsTable->setEditTriggers(QAbstractItemView::NoEditTriggers);
- formatsTable->setHorizontalHeaderLabels(labels);
+ formatsTable->setHorizontalHeaderLabels({tr("Format"), tr("Content")});
formatsTable->horizontalHeader()->setStretchLastSection(true);
//! [constructor part3]
@@ -60,7 +69,7 @@ DropSiteWindow::DropSiteWindow()
mainLayout->addWidget(buttonBox);
setWindowTitle(tr("Drop Site"));
- setMinimumSize(350, 500);
+ resize(700, 500);
}
//! [constructor part5]
@@ -83,20 +92,21 @@ void DropSiteWindow::updateFormatsTable(const QMimeData *mimeData)
//! [updateFormatsTable() part3]
QString text;
- if (format == QLatin1String("text/plain")) {
+ if (format == u"text/plain") {
text = mimeData->text().simplified();
- } else if (format == QLatin1String("text/markdown")) {
- text = QString::fromUtf8(mimeData->data(QLatin1String("text/markdown")));
- } else if (format == QLatin1String("text/html")) {
+ } else if (format == u"text/markdown") {
+ text = QString::fromUtf8(mimeData->data(u"text/markdown"_s));
+ } else if (format == u"text/html") {
text = mimeData->html().simplified();
- } else if (format == QLatin1String("text/uri-list")) {
+ } else if (format == u"text/uri-list") {
QList<QUrl> urlList = mimeData->urls();
- for (int i = 0; i < urlList.size() && i < 32; ++i)
- text.append(urlList.at(i).toString() + QLatin1Char(' '));
+ for (qsizetype i = 0, count = qMin(urlList.size(), qsizetype(32)); i < count; ++i)
+ text.append(urlList.at(i).toString() + u' ');
} else {
QByteArray data = mimeData->data(format);
- for (int i = 0; i < data.size() && i < 32; ++i)
- text.append(QStringLiteral("%1 ").arg(uchar(data[i]), 2, 16, QLatin1Char('0')).toUpper());
+ if (data.size() > 32)
+ data.truncate(32);
+ text = QString::fromLatin1(data.toHex(' ')).toUpper();
}
//! [updateFormatsTable() part3]
diff --git a/examples/widgets/draganddrop/fridgemagnets/CMakeLists.txt b/examples/widgets/draganddrop/fridgemagnets/CMakeLists.txt
index b2f8cdbe6f..bee35fcf30 100644
--- a/examples/widgets/draganddrop/fridgemagnets/CMakeLists.txt
+++ b/examples/widgets/draganddrop/fridgemagnets/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(fridgemagnets LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/draganddrop/fridgemagnets
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(fridgemagnets
draglabel.cpp draglabel.h
dragwidget.cpp dragwidget.h
@@ -26,9 +26,9 @@ set_target_properties(fridgemagnets PROPERTIES
)
target_link_libraries(fridgemagnets PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
# Resources:
diff --git a/examples/widgets/draganddrop/puzzle/CMakeLists.txt b/examples/widgets/draganddrop/puzzle/CMakeLists.txt
index f4004d1cc9..0fef5c220f 100644
--- a/examples/widgets/draganddrop/puzzle/CMakeLists.txt
+++ b/examples/widgets/draganddrop/puzzle/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(puzzle LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/draganddrop_puzzle")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(draganddrop_puzzle
main.cpp
mainwindow.cpp mainwindow.h
@@ -27,9 +27,9 @@ set_target_properties(draganddrop_puzzle PROPERTIES
)
target_link_libraries(draganddrop_puzzle PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
# Resources:
diff --git a/examples/widgets/effects/blurpicker/CMakeLists.txt b/examples/widgets/effects/blurpicker/CMakeLists.txt
index ca059bac41..6cefd92467 100644
--- a/examples/widgets/effects/blurpicker/CMakeLists.txt
+++ b/examples/widgets/effects/blurpicker/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(blurpicker LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/effects/blurpicker")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(blurpicker
blureffect.cpp blureffect.h
blurpicker.cpp blurpicker.h
@@ -26,9 +26,9 @@ set_target_properties(blurpicker PROPERTIES
)
target_link_libraries(blurpicker PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
# Resources:
diff --git a/examples/widgets/effects/fademessage/CMakeLists.txt b/examples/widgets/effects/fademessage/CMakeLists.txt
index 363cc36376..facf8806e6 100644
--- a/examples/widgets/effects/fademessage/CMakeLists.txt
+++ b/examples/widgets/effects/fademessage/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(fademessage LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/effects/fademessage")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(fademessage
fademessage.cpp fademessage.h
main.cpp
@@ -25,9 +25,9 @@ set_target_properties(fademessage PROPERTIES
)
target_link_libraries(fademessage PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
# Resources:
diff --git a/examples/widgets/gallery/CMakeLists.txt b/examples/widgets/gallery/CMakeLists.txt
index 02788419fd..a17b1cf08f 100644
--- a/examples/widgets/gallery/CMakeLists.txt
+++ b/examples/widgets/gallery/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(gallery LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/gallery")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(gallery
main.cpp
widgetgallery.cpp widgetgallery.h
@@ -25,9 +25,9 @@ set_target_properties(gallery PROPERTIES
)
target_link_libraries(gallery PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
install(TARGETS gallery
diff --git a/examples/widgets/gestures/CMakeLists.txt b/examples/widgets/gestures/CMakeLists.txt
index 4e090a1bac..c345cfed11 100644
--- a/examples/widgets/gestures/CMakeLists.txt
+++ b/examples/widgets/gestures/CMakeLists.txt
@@ -1,7 +1,7 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
-if(NOT TARGET Qt::Widgets)
+if(NOT TARGET Qt6::Widgets)
return()
endif()
qt_internal_add_example(imagegestures)
diff --git a/examples/widgets/gestures/imagegestures/CMakeLists.txt b/examples/widgets/gestures/imagegestures/CMakeLists.txt
index e24b5b58bf..10c6a6830c 100644
--- a/examples/widgets/gestures/imagegestures/CMakeLists.txt
+++ b/examples/widgets/gestures/imagegestures/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(imagegestures LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/gestures/imagegestures")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(imagegestures
imagewidget.cpp imagewidget.h
main.cpp
@@ -26,9 +26,9 @@ set_target_properties(imagegestures PROPERTIES
)
target_link_libraries(imagegestures PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
install(TARGETS imagegestures
diff --git a/examples/widgets/graphicsview/CMakeLists.txt b/examples/widgets/graphicsview/CMakeLists.txt
index b77eaff5eb..47ae1091ab 100644
--- a/examples/widgets/graphicsview/CMakeLists.txt
+++ b/examples/widgets/graphicsview/CMakeLists.txt
@@ -1,5 +1,5 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
qt_internal_add_example(chip)
qt_internal_add_example(elasticnodes)
diff --git a/examples/widgets/graphicsview/anchorlayout/CMakeLists.txt b/examples/widgets/graphicsview/anchorlayout/CMakeLists.txt
index 3f3a30d964..905a6b91dd 100644
--- a/examples/widgets/graphicsview/anchorlayout/CMakeLists.txt
+++ b/examples/widgets/graphicsview/anchorlayout/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(anchorlayout LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/graphicsview/anchorlayout
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(anchorlayout
main.cpp
)
@@ -24,9 +24,9 @@ set_target_properties(anchorlayout PROPERTIES
)
target_link_libraries(anchorlayout PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
install(TARGETS anchorlayout
diff --git a/examples/widgets/graphicsview/basicgraphicslayouts/CMakeLists.txt b/examples/widgets/graphicsview/basicgraphicslayouts/CMakeLists.txt
index 2482361147..e189db9514 100644
--- a/examples/widgets/graphicsview/basicgraphicslayouts/CMakeLists.txt
+++ b/examples/widgets/graphicsview/basicgraphicslayouts/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(basicgraphicslayouts LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/graphicsview/basicgraphic
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(basicgraphicslayouts
layoutitem.cpp layoutitem.h
main.cpp
@@ -26,9 +26,9 @@ set_target_properties(basicgraphicslayouts PROPERTIES
)
target_link_libraries(basicgraphicslayouts PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
# Resources:
diff --git a/examples/widgets/graphicsview/chip/CMakeLists.txt b/examples/widgets/graphicsview/chip/CMakeLists.txt
index e197d00d48..b9ad27ae05 100644
--- a/examples/widgets/graphicsview/chip/CMakeLists.txt
+++ b/examples/widgets/graphicsview/chip/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(chip LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -17,6 +15,8 @@ find_package(Qt6
OPTIONAL_COMPONENTS PrintSupport
)
+qt_standard_project_setup()
+
qt_add_executable(chip
chip.cpp chip.h
main.cpp
@@ -30,9 +30,9 @@ set_target_properties(chip PROPERTIES
)
target_link_libraries(chip PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
# Resources:
@@ -52,9 +52,9 @@ qt_add_resources(chip "images"
${images_resource_files}
)
-if(TARGET Qt::PrintSupport)
+if(TARGET Qt6::PrintSupport)
target_link_libraries(chip PUBLIC
- Qt::PrintSupport
+ Qt6::PrintSupport
)
endif()
diff --git a/examples/widgets/graphicsview/collidingmice/CMakeLists.txt b/examples/widgets/graphicsview/collidingmice/CMakeLists.txt
index e24de5db74..aff61c7b6c 100644
--- a/examples/widgets/graphicsview/collidingmice/CMakeLists.txt
+++ b/examples/widgets/graphicsview/collidingmice/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(collidingmice LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/graphicsview/collidingmic
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(collidingmice
main.cpp
mouse.cpp mouse.h
@@ -25,9 +25,9 @@ set_target_properties(collidingmice PROPERTIES
)
target_link_libraries(collidingmice PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
# Resources:
diff --git a/examples/widgets/graphicsview/diagramscene/CMakeLists.txt b/examples/widgets/graphicsview/diagramscene/CMakeLists.txt
index 23ac0f21cb..1dbd22ad8e 100644
--- a/examples/widgets/graphicsview/diagramscene/CMakeLists.txt
+++ b/examples/widgets/graphicsview/diagramscene/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(diagramscene LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/graphicsview/diagramscene
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(diagramscene
arrow.cpp arrow.h
diagramitem.cpp diagramitem.h
@@ -29,9 +29,9 @@ set_target_properties(diagramscene PROPERTIES
)
target_link_libraries(diagramscene PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
# Resources:
diff --git a/examples/widgets/graphicsview/diagramscene/diagramitem.cpp b/examples/widgets/graphicsview/diagramscene/diagramitem.cpp
index ae764371ae..82b832837b 100644
--- a/examples/widgets/graphicsview/diagramscene/diagramitem.cpp
+++ b/examples/widgets/graphicsview/diagramscene/diagramitem.cpp
@@ -97,7 +97,7 @@ void DiagramItem::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
{
scene()->clearSelection();
setSelected(true);
- myContextMenu->exec(event->screenPos());
+ myContextMenu->popup(event->screenPos());
}
//! [5]
@@ -105,7 +105,7 @@ void DiagramItem::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
QVariant DiagramItem::itemChange(GraphicsItemChange change, const QVariant &value)
{
if (change == QGraphicsItem::ItemPositionChange) {
- for (Arrow *arrow : qAsConst(arrows))
+ for (Arrow *arrow : std::as_const(arrows))
arrow->updatePosition();
}
diff --git a/examples/widgets/graphicsview/diagramscene/mainwindow.cpp b/examples/widgets/graphicsview/diagramscene/mainwindow.cpp
index dc77b500cb..d6a389af38 100644
--- a/examples/widgets/graphicsview/diagramscene/mainwindow.cpp
+++ b/examples/widgets/graphicsview/diagramscene/mainwindow.cpp
@@ -87,7 +87,7 @@ void MainWindow::buttonGroupClicked(QAbstractButton *button)
void MainWindow::deleteItem()
{
QList<QGraphicsItem *> selectedItems = scene->selectedItems();
- for (QGraphicsItem *item : qAsConst(selectedItems)) {
+ for (QGraphicsItem *item : std::as_const(selectedItems)) {
if (item->type() == Arrow::Type) {
scene->removeItem(item);
Arrow *arrow = qgraphicsitem_cast<Arrow *>(item);
@@ -98,7 +98,7 @@ void MainWindow::deleteItem()
}
selectedItems = scene->selectedItems();
- for (QGraphicsItem *item : qAsConst(selectedItems)) {
+ for (QGraphicsItem *item : std::as_const(selectedItems)) {
if (item->type() == DiagramItem::Type)
qgraphicsitem_cast<DiagramItem *>(item)->removeArrows();
scene->removeItem(item);
diff --git a/examples/widgets/graphicsview/dragdroprobot/CMakeLists.txt b/examples/widgets/graphicsview/dragdroprobot/CMakeLists.txt
index 4dc26317f4..91419726d7 100644
--- a/examples/widgets/graphicsview/dragdroprobot/CMakeLists.txt
+++ b/examples/widgets/graphicsview/dragdroprobot/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(dragdroprobot LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/graphicsview/dragdroprobo
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(dragdroprobot
coloritem.cpp coloritem.h
main.cpp
@@ -26,9 +26,9 @@ set_target_properties(dragdroprobot PROPERTIES
)
target_link_libraries(dragdroprobot PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
# Resources:
diff --git a/examples/widgets/graphicsview/elasticnodes/CMakeLists.txt b/examples/widgets/graphicsview/elasticnodes/CMakeLists.txt
index 74022df00b..d60a6811a0 100644
--- a/examples/widgets/graphicsview/elasticnodes/CMakeLists.txt
+++ b/examples/widgets/graphicsview/elasticnodes/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(elasticnodes LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/graphicsview/elasticnodes
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(elasticnodes
edge.cpp edge.h
graphwidget.cpp graphwidget.h
@@ -27,9 +27,9 @@ set_target_properties(elasticnodes PROPERTIES
)
target_link_libraries(elasticnodes PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
install(TARGETS elasticnodes
diff --git a/examples/widgets/graphicsview/elasticnodes/graphwidget.cpp b/examples/widgets/graphicsview/elasticnodes/graphwidget.cpp
index 3d8ca8e972..ede3d23137 100644
--- a/examples/widgets/graphicsview/elasticnodes/graphwidget.cpp
+++ b/examples/widgets/graphicsview/elasticnodes/graphwidget.cpp
@@ -123,11 +123,11 @@ void GraphWidget::timerEvent(QTimerEvent *event)
nodes << node;
}
- for (Node *node : qAsConst(nodes))
+ for (Node *node : std::as_const(nodes))
node->calculateForces();
bool itemsMoved = false;
- for (Node *node : qAsConst(nodes)) {
+ for (Node *node : std::as_const(nodes)) {
if (node->advancePosition())
itemsMoved = true;
}
diff --git a/examples/widgets/graphicsview/elasticnodes/node.cpp b/examples/widgets/graphicsview/elasticnodes/node.cpp
index fd8df0b32b..eb102f0aa4 100644
--- a/examples/widgets/graphicsview/elasticnodes/node.cpp
+++ b/examples/widgets/graphicsview/elasticnodes/node.cpp
@@ -67,7 +67,7 @@ void Node::calculateForces()
//! [4]
// Now subtract all forces pulling items together
double weight = (edgeList.size() + 1) * 10;
- for (const Edge *edge : qAsConst(edgeList)) {
+ for (const Edge *edge : std::as_const(edgeList)) {
QPointF vec;
if (edge->sourceNode() == this)
vec = mapToItem(edge->destNode(), 0, 0);
@@ -148,7 +148,7 @@ QVariant Node::itemChange(GraphicsItemChange change, const QVariant &value)
{
switch (change) {
case ItemPositionHasChanged:
- for (Edge *edge : qAsConst(edgeList))
+ for (Edge *edge : std::as_const(edgeList))
edge->adjust();
graph->itemMoved();
break;
diff --git a/examples/widgets/graphicsview/embeddeddialogs/CMakeLists.txt b/examples/widgets/graphicsview/embeddeddialogs/CMakeLists.txt
index 1de6628514..f11dd79102 100644
--- a/examples/widgets/graphicsview/embeddeddialogs/CMakeLists.txt
+++ b/examples/widgets/graphicsview/embeddeddialogs/CMakeLists.txt
@@ -1,12 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(embeddeddialogs LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTOUIC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -15,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/graphicsview/embeddeddial
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(embeddeddialogs
customproxy.cpp customproxy.h
embeddeddialog.cpp embeddeddialog.h embeddeddialog.ui
@@ -27,9 +26,9 @@ set_target_properties(embeddeddialogs PROPERTIES
)
target_link_libraries(embeddeddialogs PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
# Resources:
diff --git a/examples/widgets/graphicsview/flowlayout/CMakeLists.txt b/examples/widgets/graphicsview/flowlayout/CMakeLists.txt
index 6aa46801c0..7f25dddb7c 100644
--- a/examples/widgets/graphicsview/flowlayout/CMakeLists.txt
+++ b/examples/widgets/graphicsview/flowlayout/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(flowlayout LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/graphicsview_flowlayout")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(graphicsview_flowlayout
flowlayout.cpp flowlayout.h
main.cpp
@@ -26,9 +26,9 @@ set_target_properties(graphicsview_flowlayout PROPERTIES
)
target_link_libraries(graphicsview_flowlayout PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
install(TARGETS graphicsview_flowlayout
diff --git a/examples/widgets/graphicsview/flowlayout/flowlayout.cpp b/examples/widgets/graphicsview/flowlayout/flowlayout.cpp
index 1f9fb25e75..ab5f4717b3 100644
--- a/examples/widgets/graphicsview/flowlayout/flowlayout.cpp
+++ b/examples/widgets/graphicsview/flowlayout/flowlayout.cpp
@@ -102,7 +102,7 @@ QSizeF FlowLayout::minSize(const QSizeF &constraint) const
} else if (constraint.height() >= 0) { // width for height?
// not supported
} else {
- for (const QGraphicsLayoutItem *item : qAsConst(m_items))
+ for (const QGraphicsLayoutItem *item : std::as_const(m_items))
size = size.expandedTo(item->effectiveSizeHint(Qt::MinimumSize));
size += QSizeF(left + right, top + bottom);
}
@@ -116,7 +116,7 @@ QSizeF FlowLayout::prefSize() const
qreal maxh = 0;
qreal totalWidth = 0;
- for (const QGraphicsLayoutItem *item : qAsConst(m_items)) {
+ for (const QGraphicsLayoutItem *item : std::as_const(m_items)) {
if (totalWidth > 0)
totalWidth += spacing(Qt::Horizontal);
QSizeF pref = item->effectiveSizeHint(Qt::PreferredSize);
@@ -135,7 +135,7 @@ QSizeF FlowLayout::maxSize() const
{
qreal totalWidth = 0;
qreal totalHeight = 0;
- for (const QGraphicsLayoutItem *item : qAsConst(m_items)) {
+ for (const QGraphicsLayoutItem *item : std::as_const(m_items)) {
if (totalWidth > 0)
totalWidth += spacing(Qt::Horizontal);
if (totalHeight > 0)
diff --git a/examples/widgets/graphicsview/simpleanchorlayout/CMakeLists.txt b/examples/widgets/graphicsview/simpleanchorlayout/CMakeLists.txt
index e42f2868cf..0cbb857bc7 100644
--- a/examples/widgets/graphicsview/simpleanchorlayout/CMakeLists.txt
+++ b/examples/widgets/graphicsview/simpleanchorlayout/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(simpleanchorlayout LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/graphicsview/simpleanchor
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(simpleanchorlayout
main.cpp
)
@@ -24,9 +24,9 @@ set_target_properties(simpleanchorlayout PROPERTIES
)
target_link_libraries(simpleanchorlayout PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
install(TARGETS simpleanchorlayout
diff --git a/examples/widgets/graphicsview/weatheranchorlayout/CMakeLists.txt b/examples/widgets/graphicsview/weatheranchorlayout/CMakeLists.txt
index d2d1b83859..8394a4ac20 100644
--- a/examples/widgets/graphicsview/weatheranchorlayout/CMakeLists.txt
+++ b/examples/widgets/graphicsview/weatheranchorlayout/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(weatheranchorlayout LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/graphicsview/weatherancho
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(weatheranchorlayout
main.cpp
)
@@ -24,9 +24,9 @@ set_target_properties(weatheranchorlayout PROPERTIES
)
target_link_libraries(weatheranchorlayout PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
# Resources:
diff --git a/examples/widgets/itemviews/CMakeLists.txt b/examples/widgets/itemviews/CMakeLists.txt
index bd3a2c4c29..96af14b567 100644
--- a/examples/widgets/itemviews/CMakeLists.txt
+++ b/examples/widgets/itemviews/CMakeLists.txt
@@ -1,5 +1,5 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
qt_internal_add_example(addressbook)
qt_internal_add_example(basicsortfiltermodel)
@@ -23,6 +23,6 @@ qt_internal_add_example(storageview)
if(QT_FEATURE_draganddrop)
qt_internal_add_example(puzzle)
endif()
-if(TARGET Qt::Xml)
+if(TARGET Qt6::Xml)
qt_internal_add_example(simpledommodel)
endif()
diff --git a/examples/widgets/itemviews/addressbook/CMakeLists.txt b/examples/widgets/itemviews/addressbook/CMakeLists.txt
index c0958911b2..00e48aba1b 100644
--- a/examples/widgets/itemviews/addressbook/CMakeLists.txt
+++ b/examples/widgets/itemviews/addressbook/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(addressbook LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/itemviews/addressbook")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(addressbook
adddialog.cpp adddialog.h
addresswidget.cpp addresswidget.h
@@ -29,9 +29,9 @@ set_target_properties(addressbook PROPERTIES
)
target_link_libraries(addressbook PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
install(TARGETS addressbook
diff --git a/examples/widgets/itemviews/addressbook/addresswidget.cpp b/examples/widgets/itemviews/addressbook/addresswidget.cpp
index 955a766750..6be8867a94 100644
--- a/examples/widgets/itemviews/addressbook/addresswidget.cpp
+++ b/examples/widgets/itemviews/addressbook/addresswidget.cpp
@@ -164,7 +164,7 @@ void AddressWidget::readFromFile(const QString &fileName)
QMessageBox::information(this, tr("No contacts in file"),
tr("The file you are attempting to open contains no contacts."));
} else {
- for (const auto &contact: qAsConst(contacts))
+ for (const auto &contact: std::as_const(contacts))
addEntry(contact.name, contact.address);
}
}
diff --git a/examples/widgets/itemviews/basicsortfiltermodel/CMakeLists.txt b/examples/widgets/itemviews/basicsortfiltermodel/CMakeLists.txt
index c021614568..ffc3717435 100644
--- a/examples/widgets/itemviews/basicsortfiltermodel/CMakeLists.txt
+++ b/examples/widgets/itemviews/basicsortfiltermodel/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(basicsortfiltermodel LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/itemviews/basicsortfilter
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(basicsortfiltermodel
main.cpp
window.cpp window.h
@@ -25,9 +25,9 @@ set_target_properties(basicsortfiltermodel PROPERTIES
)
target_link_libraries(basicsortfiltermodel PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
install(TARGETS basicsortfiltermodel
diff --git a/examples/widgets/itemviews/chart/CMakeLists.txt b/examples/widgets/itemviews/chart/CMakeLists.txt
index 32bf8b2d89..0c639c5b15 100644
--- a/examples/widgets/itemviews/chart/CMakeLists.txt
+++ b/examples/widgets/itemviews/chart/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(chart LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/itemviews/chart")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(chart
main.cpp
mainwindow.cpp mainwindow.h
@@ -26,9 +26,9 @@ set_target_properties(chart PROPERTIES
)
target_link_libraries(chart PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
# Resources:
diff --git a/examples/widgets/itemviews/coloreditorfactory/CMakeLists.txt b/examples/widgets/itemviews/coloreditorfactory/CMakeLists.txt
index 7580aaef3b..93ed47b958 100644
--- a/examples/widgets/itemviews/coloreditorfactory/CMakeLists.txt
+++ b/examples/widgets/itemviews/coloreditorfactory/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(coloreditorfactory LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/itemviews/coloreditorfact
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(coloreditorfactory
colorlisteditor.cpp colorlisteditor.h
main.cpp
@@ -26,9 +26,9 @@ set_target_properties(coloreditorfactory PROPERTIES
)
target_link_libraries(coloreditorfactory PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
install(TARGETS coloreditorfactory
diff --git a/examples/widgets/itemviews/combowidgetmapper/CMakeLists.txt b/examples/widgets/itemviews/combowidgetmapper/CMakeLists.txt
index 7790529901..83aa298ec1 100644
--- a/examples/widgets/itemviews/combowidgetmapper/CMakeLists.txt
+++ b/examples/widgets/itemviews/combowidgetmapper/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(combowidgetmapper LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/itemviews/combowidgetmapp
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(combowidgetmapper
main.cpp
window.cpp window.h
@@ -25,9 +25,9 @@ set_target_properties(combowidgetmapper PROPERTIES
)
target_link_libraries(combowidgetmapper PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
install(TARGETS combowidgetmapper
diff --git a/examples/widgets/itemviews/customsortfiltermodel/CMakeLists.txt b/examples/widgets/itemviews/customsortfiltermodel/CMakeLists.txt
index b2e95cc33c..00643f1608 100644
--- a/examples/widgets/itemviews/customsortfiltermodel/CMakeLists.txt
+++ b/examples/widgets/itemviews/customsortfiltermodel/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(customsortfiltermodel LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/itemviews/customsortfilte
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(customsortfiltermodel
filterwidget.cpp filterwidget.h
main.cpp
@@ -27,9 +27,9 @@ set_target_properties(customsortfiltermodel PROPERTIES
)
target_link_libraries(customsortfiltermodel PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
# Resources:
diff --git a/examples/widgets/itemviews/dirview/CMakeLists.txt b/examples/widgets/itemviews/dirview/CMakeLists.txt
index 1f98337bf3..6719b2e03d 100644
--- a/examples/widgets/itemviews/dirview/CMakeLists.txt
+++ b/examples/widgets/itemviews/dirview/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(dirview LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/itemviews/dirview")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(dirview
main.cpp
)
@@ -24,9 +24,9 @@ set_target_properties(dirview PROPERTIES
)
target_link_libraries(dirview PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
install(TARGETS dirview
diff --git a/examples/widgets/itemviews/editabletreemodel/CMakeLists.txt b/examples/widgets/itemviews/editabletreemodel/CMakeLists.txt
index fc7e0b2be5..f94ee6e681 100644
--- a/examples/widgets/itemviews/editabletreemodel/CMakeLists.txt
+++ b/examples/widgets/itemviews/editabletreemodel/CMakeLists.txt
@@ -1,12 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(editabletreemodel LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTOUIC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -15,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/itemviews/editabletreemod
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(editabletreemodel
main.cpp
mainwindow.cpp mainwindow.h mainwindow.ui
@@ -28,9 +27,9 @@ set_target_properties(editabletreemodel PROPERTIES
)
target_link_libraries(editabletreemodel PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
# Resources:
diff --git a/examples/widgets/itemviews/editabletreemodel/treeitem.cpp b/examples/widgets/itemviews/editabletreemodel/treeitem.cpp
index 5784202b93..942ba277a3 100644
--- a/examples/widgets/itemviews/editabletreemodel/treeitem.cpp
+++ b/examples/widgets/itemviews/editabletreemodel/treeitem.cpp
@@ -88,7 +88,7 @@ bool TreeItem::insertColumns(int position, int columns)
for (int column = 0; column < columns; ++column)
itemData.insert(position, QVariant());
- for (TreeItem *child : qAsConst(childItems))
+ for (TreeItem *child : std::as_const(childItems))
child->insertColumns(position, columns);
return true;
@@ -123,7 +123,7 @@ bool TreeItem::removeColumns(int position, int columns)
for (int column = 0; column < columns; ++column)
itemData.remove(position);
- for (TreeItem *child : qAsConst(childItems))
+ for (TreeItem *child : std::as_const(childItems))
child->removeColumns(position, columns);
return true;
diff --git a/examples/widgets/itemviews/fetchmore/CMakeLists.txt b/examples/widgets/itemviews/fetchmore/CMakeLists.txt
index d2a1206614..d930c6b730 100644
--- a/examples/widgets/itemviews/fetchmore/CMakeLists.txt
+++ b/examples/widgets/itemviews/fetchmore/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(fetchmore LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/itemviews/fetchmore")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(fetchmore
filelistmodel.cpp filelistmodel.h
main.cpp
@@ -26,9 +26,9 @@ set_target_properties(fetchmore PROPERTIES
)
target_link_libraries(fetchmore PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
install(TARGETS fetchmore
diff --git a/examples/widgets/itemviews/flattreeview/CMakeLists.txt b/examples/widgets/itemviews/flattreeview/CMakeLists.txt
index f944ccaea1..8191889790 100644
--- a/examples/widgets/itemviews/flattreeview/CMakeLists.txt
+++ b/examples/widgets/itemviews/flattreeview/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(flattreeview LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/itemviews/flattreeview")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(flattreeview
main.cpp
)
@@ -24,9 +24,9 @@ set_target_properties(flattreeview PROPERTIES
)
target_link_libraries(flattreeview PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
install(TARGETS flattreeview
diff --git a/examples/widgets/itemviews/frozencolumn/CMakeLists.txt b/examples/widgets/itemviews/frozencolumn/CMakeLists.txt
index 89ba20983c..60dfc4cb86 100644
--- a/examples/widgets/itemviews/frozencolumn/CMakeLists.txt
+++ b/examples/widgets/itemviews/frozencolumn/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(frozencolumn LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/itemviews/frozencolumn")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(frozencolumn
freezetablewidget.cpp freezetablewidget.h
main.cpp
@@ -25,9 +25,9 @@ set_target_properties(frozencolumn PROPERTIES
)
target_link_libraries(frozencolumn PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
# Resources:
diff --git a/examples/widgets/itemviews/interview/CMakeLists.txt b/examples/widgets/itemviews/interview/CMakeLists.txt
index 208345fd21..2a9afc3aa5 100644
--- a/examples/widgets/itemviews/interview/CMakeLists.txt
+++ b/examples/widgets/itemviews/interview/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(interview LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/itemviews/interview")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(interview
main.cpp
model.cpp model.h
@@ -25,9 +25,9 @@ set_target_properties(interview PROPERTIES
)
target_link_libraries(interview PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
# Resources:
diff --git a/examples/widgets/itemviews/pixelator/CMakeLists.txt b/examples/widgets/itemviews/pixelator/CMakeLists.txt
index 2fc02d3871..52dd6b74e5 100644
--- a/examples/widgets/itemviews/pixelator/CMakeLists.txt
+++ b/examples/widgets/itemviews/pixelator/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(pixelator LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -17,6 +15,8 @@ find_package(Qt6
OPTIONAL_COMPONENTS PrintSupport
)
+qt_standard_project_setup()
+
qt_add_executable(pixelator
imagemodel.cpp imagemodel.h
main.cpp
@@ -30,9 +30,9 @@ set_target_properties(pixelator PROPERTIES
)
target_link_libraries(pixelator PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
# Resources:
@@ -47,9 +47,9 @@ qt_add_resources(pixelator "images"
${images_resource_files}
)
-if(TARGET Qt::PrintSupport)
+if(TARGET Qt6::PrintSupport)
target_link_libraries(pixelator PUBLIC
- Qt::PrintSupport
+ Qt6::PrintSupport
)
endif()
diff --git a/examples/widgets/itemviews/puzzle/CMakeLists.txt b/examples/widgets/itemviews/puzzle/CMakeLists.txt
index 32fc92fbb9..7d341d3ce7 100644
--- a/examples/widgets/itemviews/puzzle/CMakeLists.txt
+++ b/examples/widgets/itemviews/puzzle/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(puzzle LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/itemviews/puzzle")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(itemviews_puzzle
main.cpp
mainwindow.cpp mainwindow.h
@@ -27,9 +27,9 @@ set_target_properties(itemviews_puzzle PROPERTIES
)
target_link_libraries(itemviews_puzzle PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
# Resources:
diff --git a/examples/widgets/itemviews/simpledommodel/CMakeLists.txt b/examples/widgets/itemviews/simpledommodel/CMakeLists.txt
index a3c6c7d93b..5c732870e8 100644
--- a/examples/widgets/itemviews/simpledommodel/CMakeLists.txt
+++ b/examples/widgets/itemviews/simpledommodel/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(simpledommodel LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/itemviews/simpledommodel"
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets Xml)
+qt_standard_project_setup()
+
qt_add_executable(simpledommodel
domitem.cpp domitem.h
dommodel.cpp dommodel.h
@@ -27,10 +27,10 @@ set_target_properties(simpledommodel PROPERTIES
)
target_link_libraries(simpledommodel PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
- Qt::Xml
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
+ Qt6::Xml
)
install(TARGETS simpledommodel
diff --git a/examples/widgets/itemviews/simpletreemodel/CMakeLists.txt b/examples/widgets/itemviews/simpletreemodel/CMakeLists.txt
index 1afd015991..c4c7a14199 100644
--- a/examples/widgets/itemviews/simpletreemodel/CMakeLists.txt
+++ b/examples/widgets/itemviews/simpletreemodel/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(simpletreemodel LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/itemviews/simpletreemodel
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(simpletreemodel
main.cpp
treeitem.cpp treeitem.h
@@ -26,9 +26,9 @@ set_target_properties(simpletreemodel PROPERTIES
)
target_link_libraries(simpletreemodel PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
# Resources:
diff --git a/examples/widgets/itemviews/simplewidgetmapper/CMakeLists.txt b/examples/widgets/itemviews/simplewidgetmapper/CMakeLists.txt
index 842231b15d..eb8d3ee480 100644
--- a/examples/widgets/itemviews/simplewidgetmapper/CMakeLists.txt
+++ b/examples/widgets/itemviews/simplewidgetmapper/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(simplewidgetmapper LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/itemviews/simplewidgetmap
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(simplewidgetmapper
main.cpp
window.cpp window.h
@@ -25,9 +25,9 @@ set_target_properties(simplewidgetmapper PROPERTIES
)
target_link_libraries(simplewidgetmapper PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
install(TARGETS simplewidgetmapper
diff --git a/examples/widgets/itemviews/spinboxdelegate/CMakeLists.txt b/examples/widgets/itemviews/spinboxdelegate/CMakeLists.txt
index aca1fa16d0..f42feac10a 100644
--- a/examples/widgets/itemviews/spinboxdelegate/CMakeLists.txt
+++ b/examples/widgets/itemviews/spinboxdelegate/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(spinboxdelegate LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/itemviews/spinboxdelegate
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(spinboxdelegate
delegate.cpp delegate.h
main.cpp
@@ -25,9 +25,9 @@ set_target_properties(spinboxdelegate PROPERTIES
)
target_link_libraries(spinboxdelegate PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
install(TARGETS spinboxdelegate
diff --git a/examples/widgets/itemviews/spreadsheet/CMakeLists.txt b/examples/widgets/itemviews/spreadsheet/CMakeLists.txt
index 79ce45ea8a..1481533dca 100644
--- a/examples/widgets/itemviews/spreadsheet/CMakeLists.txt
+++ b/examples/widgets/itemviews/spreadsheet/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(spreadsheet LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -17,6 +15,8 @@ find_package(Qt6
OPTIONAL_COMPONENTS PrintSupport
)
+qt_standard_project_setup()
+
qt_add_executable(spreadsheet
main.cpp
printview.cpp printview.h
@@ -31,13 +31,13 @@ set_target_properties(spreadsheet PROPERTIES
)
target_link_libraries(spreadsheet PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
-if (TARGET Qt::PrintSupport)
- target_link_libraries(spreadsheet PUBLIC Qt::PrintSupport)
+if (TARGET Qt6::PrintSupport)
+ target_link_libraries(spreadsheet PUBLIC Qt6::PrintSupport)
endif()
# Resources:
@@ -52,9 +52,9 @@ qt_add_resources(spreadsheet "spreadsheet"
${spreadsheet_resource_files}
)
-if(TARGET Qt::PrintSupport)
+if(TARGET Qt6::PrintSupport)
target_link_libraries(spreadsheet PUBLIC
- Qt::PrintSupport
+ Qt6::PrintSupport
)
endif()
diff --git a/examples/widgets/itemviews/stardelegate/CMakeLists.txt b/examples/widgets/itemviews/stardelegate/CMakeLists.txt
index 0df282b3e2..717ac29733 100644
--- a/examples/widgets/itemviews/stardelegate/CMakeLists.txt
+++ b/examples/widgets/itemviews/stardelegate/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(stardelegate LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/itemviews/stardelegate")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(stardelegate
main.cpp
stardelegate.cpp stardelegate.h
@@ -27,9 +27,9 @@ set_target_properties(stardelegate PROPERTIES
)
target_link_libraries(stardelegate PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
install(TARGETS stardelegate
diff --git a/examples/widgets/itemviews/storageview/CMakeLists.txt b/examples/widgets/itemviews/storageview/CMakeLists.txt
index b5f729de19..6cf427e068 100644
--- a/examples/widgets/itemviews/storageview/CMakeLists.txt
+++ b/examples/widgets/itemviews/storageview/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(storageview LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/itemviews/storageview")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(storageview
main.cpp
storagemodel.cpp storagemodel.h
@@ -25,9 +25,9 @@ set_target_properties(storageview PROPERTIES
)
target_link_libraries(storageview PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
install(TARGETS storageview
diff --git a/examples/widgets/layouts/CMakeLists.txt b/examples/widgets/layouts/CMakeLists.txt
index 47a9380a78..60299638c4 100644
--- a/examples/widgets/layouts/CMakeLists.txt
+++ b/examples/widgets/layouts/CMakeLists.txt
@@ -1,5 +1,5 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
qt_internal_add_example(basiclayouts)
qt_internal_add_example(borderlayout)
diff --git a/examples/widgets/layouts/basiclayouts/CMakeLists.txt b/examples/widgets/layouts/basiclayouts/CMakeLists.txt
index 085b232995..ff1fd30f8c 100644
--- a/examples/widgets/layouts/basiclayouts/CMakeLists.txt
+++ b/examples/widgets/layouts/basiclayouts/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(basiclayouts LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/layouts/basiclayouts")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(basiclayouts
dialog.cpp dialog.h
main.cpp
@@ -25,9 +25,9 @@ set_target_properties(basiclayouts PROPERTIES
)
target_link_libraries(basiclayouts PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
install(TARGETS basiclayouts
diff --git a/examples/widgets/layouts/borderlayout/CMakeLists.txt b/examples/widgets/layouts/borderlayout/CMakeLists.txt
index 46dd3cd48b..cb138a457a 100644
--- a/examples/widgets/layouts/borderlayout/CMakeLists.txt
+++ b/examples/widgets/layouts/borderlayout/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(borderlayout LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/layouts/borderlayout")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(borderlayout
borderlayout.cpp borderlayout.h
main.cpp
@@ -26,9 +26,9 @@ set_target_properties(borderlayout PROPERTIES
)
target_link_libraries(borderlayout PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
install(TARGETS borderlayout
diff --git a/examples/widgets/layouts/dynamiclayouts/CMakeLists.txt b/examples/widgets/layouts/dynamiclayouts/CMakeLists.txt
index 0bccbcdf9f..bf31fa811c 100644
--- a/examples/widgets/layouts/dynamiclayouts/CMakeLists.txt
+++ b/examples/widgets/layouts/dynamiclayouts/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(dynamiclayouts LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/layouts/dynamiclayouts")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(dynamiclayouts
dialog.cpp dialog.h
main.cpp
@@ -25,9 +25,9 @@ set_target_properties(dynamiclayouts PROPERTIES
)
target_link_libraries(dynamiclayouts PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
install(TARGETS dynamiclayouts
diff --git a/examples/widgets/layouts/dynamiclayouts/dialog.cpp b/examples/widgets/layouts/dynamiclayouts/dialog.cpp
index 8dc3d069bc..28b4fc2f7f 100644
--- a/examples/widgets/layouts/dynamiclayouts/dialog.cpp
+++ b/examples/widgets/layouts/dynamiclayouts/dialog.cpp
@@ -57,7 +57,7 @@ void Dialog::rotateWidgets()
{
Q_ASSERT(rotatableWidgets.count() % 2 == 0);
- for (QWidget *widget : qAsConst(rotatableWidgets))
+ for (QWidget *widget : std::as_const(rotatableWidgets))
rotatableLayout->removeWidget(widget);
rotatableWidgets.enqueue(rotatableWidgets.dequeue());
diff --git a/examples/widgets/layouts/flowlayout/CMakeLists.txt b/examples/widgets/layouts/flowlayout/CMakeLists.txt
index 8567cd49b6..85d0e0821e 100644
--- a/examples/widgets/layouts/flowlayout/CMakeLists.txt
+++ b/examples/widgets/layouts/flowlayout/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(flowlayout LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/layouts/flowlayout")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(flowlayout
flowlayout.cpp flowlayout.h
main.cpp
@@ -26,9 +26,9 @@ set_target_properties(flowlayout PROPERTIES
)
target_link_libraries(flowlayout PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
install(TARGETS flowlayout
diff --git a/examples/widgets/layouts/flowlayout/flowlayout.cpp b/examples/widgets/layouts/flowlayout/flowlayout.cpp
index b4cba9fe69..0565053096 100644
--- a/examples/widgets/layouts/flowlayout/flowlayout.cpp
+++ b/examples/widgets/layouts/flowlayout/flowlayout.cpp
@@ -108,7 +108,7 @@ QSize FlowLayout::sizeHint() const
QSize FlowLayout::minimumSize() const
{
QSize size;
- for (const QLayoutItem *item : qAsConst(itemList))
+ for (const QLayoutItem *item : std::as_const(itemList))
size = size.expandedTo(item->minimumSize());
const QMargins margins = contentsMargins();
@@ -129,7 +129,7 @@ int FlowLayout::doLayout(const QRect &rect, bool testOnly) const
//! [9]
//! [10]
- for (QLayoutItem *item : qAsConst(itemList)) {
+ for (QLayoutItem *item : std::as_const(itemList)) {
const QWidget *wid = item->widget();
int spaceX = horizontalSpacing();
if (spaceX == -1)
diff --git a/examples/widgets/mainwindows/CMakeLists.txt b/examples/widgets/mainwindows/CMakeLists.txt
index 60a4cd160f..93c9e23514 100644
--- a/examples/widgets/mainwindows/CMakeLists.txt
+++ b/examples/widgets/mainwindows/CMakeLists.txt
@@ -1,5 +1,5 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
qt_internal_add_example(application)
qt_internal_add_example(dockwidgets)
diff --git a/examples/widgets/mainwindows/application/CMakeLists.txt b/examples/widgets/mainwindows/application/CMakeLists.txt
index 18aed52e23..c721aea2f0 100644
--- a/examples/widgets/mainwindows/application/CMakeLists.txt
+++ b/examples/widgets/mainwindows/application/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(application LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/mainwindows/application")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(application
main.cpp
mainwindow.cpp mainwindow.h
@@ -25,9 +25,9 @@ set_target_properties(application PROPERTIES
)
target_link_libraries(application PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
# Resources:
diff --git a/examples/widgets/mainwindows/dockwidgets/CMakeLists.txt b/examples/widgets/mainwindows/dockwidgets/CMakeLists.txt
index 91bbe65c70..7d9c111bf9 100644
--- a/examples/widgets/mainwindows/dockwidgets/CMakeLists.txt
+++ b/examples/widgets/mainwindows/dockwidgets/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(dockwidgets LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -17,6 +15,8 @@ find_package(Qt6
OPTIONAL_COMPONENTS PrintSupport
)
+qt_standard_project_setup()
+
qt_add_executable(dockwidgets
main.cpp
mainwindow.cpp mainwindow.h
@@ -28,13 +28,13 @@ set_target_properties(dockwidgets PROPERTIES
)
target_link_libraries(dockwidgets PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
-if (TARGET Qt::PrintSupport)
- target_link_libraries(dockwidgets PUBLIC Qt::PrintSupport)
+if (TARGET Qt6::PrintSupport)
+ target_link_libraries(dockwidgets PUBLIC Qt6::PrintSupport)
endif()
# Resources:
@@ -52,9 +52,9 @@ qt_add_resources(dockwidgets "dockwidgets"
${dockwidgets_resource_files}
)
-if(TARGET Qt::PrintSupport)
+if(TARGET Qt6::PrintSupport)
target_link_libraries(dockwidgets PUBLIC
- Qt::PrintSupport
+ Qt6::PrintSupport
)
endif()
diff --git a/examples/widgets/mainwindows/mainwindow/CMakeLists.txt b/examples/widgets/mainwindows/mainwindow/CMakeLists.txt
index 80817240c8..1962c9399c 100644
--- a/examples/widgets/mainwindows/mainwindow/CMakeLists.txt
+++ b/examples/widgets/mainwindows/mainwindow/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(mainwindow LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/mainwindows/mainwindow")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(mainwindow
colorswatch.cpp colorswatch.h
main.cpp
@@ -27,9 +27,9 @@ set_target_properties(mainwindow PROPERTIES
)
target_link_libraries(mainwindow PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
# Resources:
diff --git a/examples/widgets/mainwindows/mainwindow/colorswatch.cpp b/examples/widgets/mainwindows/mainwindow/colorswatch.cpp
index edd792730c..678f00054c 100644
--- a/examples/widgets/mainwindows/mainwindow/colorswatch.cpp
+++ b/examples/widgets/mainwindows/mainwindow/colorswatch.cpp
@@ -446,7 +446,7 @@ void ColorSwatch::tabInto(QAction *action)
void ColorSwatch::contextMenuEvent(QContextMenuEvent *event)
{
event->accept();
- menu->exec(event->globalPos());
+ menu->popup(event->globalPos());
}
#endif // QT_NO_CONTEXTMENU
diff --git a/examples/widgets/mainwindows/mdi/CMakeLists.txt b/examples/widgets/mainwindows/mdi/CMakeLists.txt
index d0d27edb0e..08c2f49a39 100644
--- a/examples/widgets/mainwindows/mdi/CMakeLists.txt
+++ b/examples/widgets/mainwindows/mdi/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(mdi LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/mainwindows/mdi")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(mdi
main.cpp
mainwindow.cpp mainwindow.h
@@ -26,9 +26,9 @@ set_target_properties(mdi PROPERTIES
)
target_link_libraries(mdi PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
# Resources:
diff --git a/examples/widgets/mainwindows/menus/CMakeLists.txt b/examples/widgets/mainwindows/menus/CMakeLists.txt
index f1102f3b14..1c498b95c5 100644
--- a/examples/widgets/mainwindows/menus/CMakeLists.txt
+++ b/examples/widgets/mainwindows/menus/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(menus LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/mainwindows/menus")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(menus
main.cpp
mainwindow.cpp mainwindow.h
@@ -25,9 +25,9 @@ set_target_properties(menus PROPERTIES
)
target_link_libraries(menus PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
install(TARGETS menus
diff --git a/examples/widgets/mainwindows/sdi/CMakeLists.txt b/examples/widgets/mainwindows/sdi/CMakeLists.txt
index 9c4eca0970..01fc7b15cf 100644
--- a/examples/widgets/mainwindows/sdi/CMakeLists.txt
+++ b/examples/widgets/mainwindows/sdi/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(sdi LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/mainwindows/sdi")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(sdi
main.cpp
mainwindow.cpp mainwindow.h
@@ -25,9 +25,9 @@ set_target_properties(sdi PROPERTIES
)
target_link_libraries(sdi PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
# Resources:
diff --git a/examples/widgets/painting/CMakeLists.txt b/examples/widgets/painting/CMakeLists.txt
index f7274c17b6..df0bfe9007 100644
--- a/examples/widgets/painting/CMakeLists.txt
+++ b/examples/widgets/painting/CMakeLists.txt
@@ -1,5 +1,5 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
qt_internal_add_example(basicdrawing)
qt_internal_add_example(concentriccircles)
diff --git a/examples/widgets/painting/affine/CMakeLists.txt b/examples/widgets/painting/affine/CMakeLists.txt
index c0f52d1c1c..4c9b0f6ac0 100644
--- a/examples/widgets/painting/affine/CMakeLists.txt
+++ b/examples/widgets/painting/affine/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(affine LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/painting/affine")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(affine
# remove files from ../shared
#../shared/arthurstyle.cpp ../shared/arthurstyle.h
@@ -37,9 +37,9 @@ if(NOT TARGET painting_shared::painting_shared)
endif()
target_link_libraries(affine PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
painting_shared::painting_shared
)
@@ -111,7 +111,7 @@ qt_add_resources(affine "affine"
#)
#target_link_libraries(affine PUBLIC
- #Qt::OpenGL
+ #Qt6::OpenGL
#)
#endif()
diff --git a/examples/widgets/painting/basicdrawing/CMakeLists.txt b/examples/widgets/painting/basicdrawing/CMakeLists.txt
index 0b524b06b4..6d8558fb4d 100644
--- a/examples/widgets/painting/basicdrawing/CMakeLists.txt
+++ b/examples/widgets/painting/basicdrawing/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(basicdrawing LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/painting/basicdrawing")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(basicdrawing
main.cpp
renderarea.cpp renderarea.h
@@ -26,9 +26,9 @@ set_target_properties(basicdrawing PROPERTIES
)
target_link_libraries(basicdrawing PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
# Resources:
diff --git a/examples/widgets/painting/composition/CMakeLists.txt b/examples/widgets/painting/composition/CMakeLists.txt
index 0acee43be5..76896b1089 100644
--- a/examples/widgets/painting/composition/CMakeLists.txt
+++ b/examples/widgets/painting/composition/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(composition LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/painting/composition")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(composition
# remove files from ../shared
#../shared/arthurstyle.cpp ../shared/arthurstyle.h
@@ -37,9 +37,9 @@ if(NOT TARGET painting_shared::painting_shared)
endif()
target_link_libraries(composition PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
painting_shared::painting_shared
)
@@ -112,7 +112,7 @@ qt_add_resources(composition "composition"
#)
#target_link_libraries(affine PUBLIC
- #Qt::OpenGL
+ #Qt6::OpenGL
#)
#endif()
diff --git a/examples/widgets/painting/concentriccircles/CMakeLists.txt b/examples/widgets/painting/concentriccircles/CMakeLists.txt
index 9b2756334a..f16db7ee9f 100644
--- a/examples/widgets/painting/concentriccircles/CMakeLists.txt
+++ b/examples/widgets/painting/concentriccircles/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(concentriccircles LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/painting/concentriccircle
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(concentriccircles
circlewidget.cpp circlewidget.h
main.cpp
@@ -26,9 +26,9 @@ set_target_properties(concentriccircles PROPERTIES
)
target_link_libraries(concentriccircles PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
install(TARGETS concentriccircles
diff --git a/examples/widgets/painting/deform/CMakeLists.txt b/examples/widgets/painting/deform/CMakeLists.txt
index 9061faebf3..a4468c6699 100644
--- a/examples/widgets/painting/deform/CMakeLists.txt
+++ b/examples/widgets/painting/deform/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(deform LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/painting/deform")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(deform
# remove files from ../shared
#../shared/arthurstyle.cpp ../shared/arthurstyle.h
@@ -37,9 +37,9 @@ if(NOT TARGET painting_shared::painting_shared)
endif()
target_link_libraries(deform PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
painting_shared::painting_shared
)
@@ -110,7 +110,7 @@ qt_add_resources(deform "deform"
#)
#target_link_libraries(affine PUBLIC
- #Qt::OpenGL
+ #Qt6::OpenGL
#)
#endif()
diff --git a/examples/widgets/painting/fontsampler/CMakeLists.txt b/examples/widgets/painting/fontsampler/CMakeLists.txt
index 454b0e1403..23f2bb4c29 100644
--- a/examples/widgets/painting/fontsampler/CMakeLists.txt
+++ b/examples/widgets/painting/fontsampler/CMakeLists.txt
@@ -1,12 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(fontsampler LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTOUIC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -18,6 +15,8 @@ find_package(Qt6
OPTIONAL_COMPONENTS PrintSupport
)
+qt_standard_project_setup()
+
qt_add_executable(fontsampler
main.cpp
mainwindow.cpp mainwindow.h
@@ -30,14 +29,14 @@ set_target_properties(fontsampler PROPERTIES
)
target_link_libraries(fontsampler PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
-if(TARGET Qt::PrintSupport)
+if(TARGET Qt6::PrintSupport)
target_link_libraries(fontsampler PUBLIC
- Qt::PrintSupport
+ Qt6::PrintSupport
)
endif()
diff --git a/examples/widgets/painting/fontsampler/mainwindow.cpp b/examples/widgets/painting/fontsampler/mainwindow.cpp
index 1b1b816395..e2bd768f79 100644
--- a/examples/widgets/painting/fontsampler/mainwindow.cpp
+++ b/examples/widgets/painting/fontsampler/mainwindow.cpp
@@ -260,7 +260,7 @@ void MainWindow::printPage(int index, QPainter *painter, QPrinter *printer)
bool italic = item->data(0, Qt::UserRole + 1).toBool();
// Calculate the maximum width and total height of the text.
- for (int size : qAsConst(sampleSizes)) {
+ for (int size : std::as_const(sampleSizes)) {
QFont font(family, size, weight, italic);
font.setStyleName(style);
font = QFont(font, painter->device());
@@ -294,7 +294,7 @@ void MainWindow::printPage(int index, QPainter *painter, QPrinter *printer)
bool italic = item->data(0, Qt::UserRole + 1).toBool();
// Draw each line of text.
- for (int size : qAsConst(sampleSizes)) {
+ for (int size : std::as_const(sampleSizes)) {
QFont font(family, size, weight, italic);
font.setStyleName(style);
font = QFont(font, painter->device());
diff --git a/examples/widgets/painting/gradients/CMakeLists.txt b/examples/widgets/painting/gradients/CMakeLists.txt
index 340c455302..ade0fc3b25 100644
--- a/examples/widgets/painting/gradients/CMakeLists.txt
+++ b/examples/widgets/painting/gradients/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(gradients LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/painting/gradients")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(gradients
# remove files from ../shared
#../shared/arthurstyle.cpp ../shared/arthurstyle.h
@@ -37,9 +37,9 @@ if(NOT TARGET painting_shared::painting_shared)
endif()
target_link_libraries(gradients PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
painting_shared::painting_shared
)
@@ -110,7 +110,7 @@ qt_add_resources(gradients "gradients"
#)
#target_link_libraries(affine PUBLIC
- #Qt::OpenGL
+ #Qt6::OpenGL
#)
#endif()
diff --git a/examples/widgets/painting/gradients/gradients.cpp b/examples/widgets/painting/gradients/gradients.cpp
index dcedd250cf..538d851eb8 100644
--- a/examples/widgets/painting/gradients/gradients.cpp
+++ b/examples/widgets/painting/gradients/gradients.cpp
@@ -534,7 +534,7 @@ void GradientRenderer::paint(QPainter *p)
g = QConicalGradient(pts.at(0), angle);
}
- for (const auto &stop : qAsConst(m_stops))
+ for (const auto &stop : std::as_const(m_stops))
g.setColorAt(stop.first, stop.second);
g.setSpread(m_spread);
diff --git a/examples/widgets/painting/imagecomposition/CMakeLists.txt b/examples/widgets/painting/imagecomposition/CMakeLists.txt
index d1f4f1ced4..944f2303c8 100644
--- a/examples/widgets/painting/imagecomposition/CMakeLists.txt
+++ b/examples/widgets/painting/imagecomposition/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(imagecomposition LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/painting/imagecomposition
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(imagecomposition
imagecomposer.cpp imagecomposer.h
main.cpp
@@ -25,9 +25,9 @@ set_target_properties(imagecomposition PROPERTIES
)
target_link_libraries(imagecomposition PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
# Resources:
diff --git a/examples/widgets/painting/painterpaths/CMakeLists.txt b/examples/widgets/painting/painterpaths/CMakeLists.txt
index 95caadb0c7..280953d503 100644
--- a/examples/widgets/painting/painterpaths/CMakeLists.txt
+++ b/examples/widgets/painting/painterpaths/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(painterpaths LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/painting/painterpaths")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(painterpaths
main.cpp
renderarea.cpp renderarea.h
@@ -26,9 +26,9 @@ set_target_properties(painterpaths PROPERTIES
)
target_link_libraries(painterpaths PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
if(UNIX AND NOT APPLE AND NOT HAIKU AND NOT INTEGRITY AND NOT VXWORKS)
diff --git a/examples/widgets/painting/painterpaths/window.cpp b/examples/widgets/painting/painterpaths/window.cpp
index 4fc3e8efd9..01b62d6988 100644
--- a/examples/widgets/painting/painterpaths/window.cpp
+++ b/examples/widgets/painting/painterpaths/window.cpp
@@ -156,7 +156,7 @@ Window::Window()
connect(penColorComboBox, &QComboBox::activated,
this, &Window::penColorChanged);
- for (RenderArea *area : qAsConst(renderAreas)) {
+ for (RenderArea *area : std::as_const(renderAreas)) {
connect(penWidthSpinBox, &QSpinBox::valueChanged,
area, &RenderArea::setPenWidth);
connect(rotationAngleSpinBox, &QSpinBox::valueChanged,
@@ -167,7 +167,7 @@ Window::Window()
QGridLayout *topLayout = new QGridLayout;
int i = 0;
- for (RenderArea *area : qAsConst(renderAreas)) {
+ for (RenderArea *area : std::as_const(renderAreas)) {
topLayout->addWidget(area, i / 3, i % 3);
++i;
}
@@ -204,7 +204,7 @@ void Window::fillRuleChanged()
{
Qt::FillRule rule = (Qt::FillRule)currentItemData(fillRuleComboBox).toInt();
- for (RenderArea *area : qAsConst(renderAreas))
+ for (RenderArea *area : std::as_const(renderAreas))
area->setFillRule(rule);
}
//! [19]
@@ -215,7 +215,7 @@ void Window::fillGradientChanged()
QColor color1 = qvariant_cast<QColor>(currentItemData(fillColor1ComboBox));
QColor color2 = qvariant_cast<QColor>(currentItemData(fillColor2ComboBox));
- for (RenderArea *area : qAsConst(renderAreas))
+ for (RenderArea *area : std::as_const(renderAreas))
area->setFillGradient(color1, color2);
}
//! [20]
@@ -225,7 +225,7 @@ void Window::penColorChanged()
{
QColor color = qvariant_cast<QColor>(currentItemData(penColorComboBox));
- for (RenderArea *area : qAsConst(renderAreas))
+ for (RenderArea *area : std::as_const(renderAreas))
area->setPenColor(color);
}
//! [21]
diff --git a/examples/widgets/painting/pathstroke/CMakeLists.txt b/examples/widgets/painting/pathstroke/CMakeLists.txt
index feececacc8..1b8d42535f 100644
--- a/examples/widgets/painting/pathstroke/CMakeLists.txt
+++ b/examples/widgets/painting/pathstroke/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(pathstroke LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/painting/pathstroke")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(pathstroke
# remove files from ../shared
#../shared/arthurstyle.cpp ../shared/arthurstyle.h
@@ -37,9 +37,9 @@ if(NOT TARGET painting_shared::painting_shared)
endif()
target_link_libraries(pathstroke PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
painting_shared::painting_shared
)
@@ -110,7 +110,7 @@ qt_add_resources(pathstroke "pathstroke"
#)
#target_link_libraries(affine PUBLIC
- #Qt::OpenGL
+ #Qt6::OpenGL
#)
#endif()
diff --git a/examples/widgets/painting/shared/CMakeLists.txt b/examples/widgets/painting/shared/CMakeLists.txt
index d330532d20..f3d6fd49de 100644
--- a/examples/widgets/painting/shared/CMakeLists.txt
+++ b/examples/widgets/painting/shared/CMakeLists.txt
@@ -1,5 +1,5 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
add_library(painting_shared OBJECT)
add_library(painting_shared::painting_shared ALIAS painting_shared)
@@ -11,16 +11,16 @@ target_sources(painting_shared PRIVATE
${moc_files}
)
-target_link_libraries(painting_shared PUBLIC Qt::Widgets)
+target_link_libraries(painting_shared PUBLIC Qt6::Widgets)
target_include_directories(painting_shared PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}")
## Scopes:
#####################################################################
-if (TARGET Qt::OpenGL OR QT_FEATURE_opengles2)
+if (TARGET Qt6::OpenGL OR QT_FEATURE_opengles2)
target_compile_definitions(painting_shared PRIVATE QT_OPENGL_SUPPORT)
target_link_libraries(painting_shared PUBLIC
- Qt::OpenGL
+ Qt6::OpenGL
)
qt6_wrap_cpp(moc_files_gl fbopaintdevice.h) # no automoc for OBJECT libs
target_sources(painting_shared PRIVATE fbopaintdevice.cpp fbopaintdevice.h ${moc_files_gl})
diff --git a/examples/widgets/painting/shared/hoverpoints.cpp b/examples/widgets/painting/shared/hoverpoints.cpp
index 7d2bb81538..87e1eb4415 100644
--- a/examples/widgets/painting/shared/hoverpoints.cpp
+++ b/examples/widgets/painting/shared/hoverpoints.cpp
@@ -268,7 +268,7 @@ void HoverPoints::paintPoints()
p.setPen(m_pointPen);
p.setBrush(m_pointBrush);
- for (const auto &point : qAsConst(m_points)) {
+ for (const auto &point : std::as_const(m_points)) {
QRectF bounds = pointBoundingRect(point);
if (m_shape == CircleShape)
p.drawEllipse(bounds);
diff --git a/examples/widgets/painting/shared/use_lib.cmake b/examples/widgets/painting/shared/use_lib.cmake
index da4ded9ece..dc17fff3c0 100644
--- a/examples/widgets/painting/shared/use_lib.cmake
+++ b/examples/widgets/painting/shared/use_lib.cmake
@@ -1,5 +1,5 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
# Include this file in your example project to use the library defined in this directory.
# This avoids find_package calls in a directory scope different from the directory scope of the
diff --git a/examples/widgets/painting/transformations/CMakeLists.txt b/examples/widgets/painting/transformations/CMakeLists.txt
index ea6fb49a34..0914537dc9 100644
--- a/examples/widgets/painting/transformations/CMakeLists.txt
+++ b/examples/widgets/painting/transformations/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(transformations LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/painting/transformations"
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(transformations
main.cpp
renderarea.cpp renderarea.h
@@ -26,9 +26,9 @@ set_target_properties(transformations PROPERTIES
)
target_link_libraries(transformations PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
install(TARGETS transformations
diff --git a/examples/widgets/richtext/CMakeLists.txt b/examples/widgets/richtext/CMakeLists.txt
index de6605b316..ea4165b764 100644
--- a/examples/widgets/richtext/CMakeLists.txt
+++ b/examples/widgets/richtext/CMakeLists.txt
@@ -1,5 +1,5 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
qt_internal_add_example(calendar)
qt_internal_add_example(orderform)
diff --git a/examples/widgets/richtext/calendar/CMakeLists.txt b/examples/widgets/richtext/calendar/CMakeLists.txt
index c7138792b1..1aeedf11e9 100644
--- a/examples/widgets/richtext/calendar/CMakeLists.txt
+++ b/examples/widgets/richtext/calendar/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(calendar LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/richtext/calendar")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(calendar
main.cpp
mainwindow.cpp mainwindow.h
@@ -25,9 +25,9 @@ set_target_properties(calendar PROPERTIES
)
target_link_libraries(calendar PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
install(TARGETS calendar
diff --git a/examples/widgets/richtext/orderform/CMakeLists.txt b/examples/widgets/richtext/orderform/CMakeLists.txt
index f98301ea70..4a0d0be66b 100644
--- a/examples/widgets/richtext/orderform/CMakeLists.txt
+++ b/examples/widgets/richtext/orderform/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(orderform LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/richtext/orderform")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(orderform
detailsdialog.cpp detailsdialog.h
main.cpp
@@ -26,14 +26,14 @@ set_target_properties(orderform PROPERTIES
)
target_link_libraries(orderform PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
-if(TARGET Qt::PrintSupport)
+if(TARGET Qt6::PrintSupport)
target_link_libraries(orderform PUBLIC
- Qt::PrintSupport
+ Qt6::PrintSupport
)
endif()
diff --git a/examples/widgets/richtext/syntaxhighlighter/CMakeLists.txt b/examples/widgets/richtext/syntaxhighlighter/CMakeLists.txt
index b1e859c69a..cdfca402de 100644
--- a/examples/widgets/richtext/syntaxhighlighter/CMakeLists.txt
+++ b/examples/widgets/richtext/syntaxhighlighter/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(syntaxhighlighter LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/richtext/syntaxhighlighte
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(syntaxhighlighter
highlighter.cpp highlighter.h
main.cpp
@@ -26,9 +26,9 @@ set_target_properties(syntaxhighlighter PROPERTIES
)
target_link_libraries(syntaxhighlighter PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
install(TARGETS syntaxhighlighter
diff --git a/examples/widgets/richtext/syntaxhighlighter/highlighter.cpp b/examples/widgets/richtext/syntaxhighlighter/highlighter.cpp
index 11e203c333..d78de20a7d 100644
--- a/examples/widgets/richtext/syntaxhighlighter/highlighter.cpp
+++ b/examples/widgets/richtext/syntaxhighlighter/highlighter.cpp
@@ -72,7 +72,7 @@ Highlighter::Highlighter(QTextDocument *parent)
//! [7]
void Highlighter::highlightBlock(const QString &text)
{
- for (const HighlightingRule &rule : qAsConst(highlightingRules)) {
+ for (const HighlightingRule &rule : std::as_const(highlightingRules)) {
QRegularExpressionMatchIterator matchIterator = rule.pattern.globalMatch(text);
while (matchIterator.hasNext()) {
QRegularExpressionMatch match = matchIterator.next();
diff --git a/examples/widgets/richtext/textedit/CMakeLists.txt b/examples/widgets/richtext/textedit/CMakeLists.txt
index 663a33b99f..66cdeafd24 100644
--- a/examples/widgets/richtext/textedit/CMakeLists.txt
+++ b/examples/widgets/richtext/textedit/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(textedit LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -28,13 +26,13 @@ set_target_properties(textedit PROPERTIES
)
target_link_libraries(textedit PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
-if (TARGET Qt::PrintSupport)
- target_link_libraries(textedit PUBLIC Qt::PrintSupport)
+if (TARGET Qt6::PrintSupport)
+ target_link_libraries(textedit PUBLIC Qt6::PrintSupport)
endif()
# Resources:
@@ -98,9 +96,9 @@ qt_add_resources(textedit "textedit"
${textedit_resource_files}
)
-if(TARGET Qt::PrintSupport)
+if(TARGET Qt6::PrintSupport)
target_link_libraries(textedit PUBLIC
- Qt::PrintSupport
+ Qt6::PrintSupport
)
endif()
diff --git a/examples/widgets/scroller/graphicsview/CMakeLists.txt b/examples/widgets/scroller/graphicsview/CMakeLists.txt
index d59bc72d59..8e6d23b89d 100644
--- a/examples/widgets/scroller/graphicsview/CMakeLists.txt
+++ b/examples/widgets/scroller/graphicsview/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(graphicsview LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/scroller/graphicsview")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(graphicsview
main.cpp
)
@@ -24,9 +24,9 @@ set_target_properties(graphicsview PROPERTIES
)
target_link_libraries(graphicsview PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
install(TARGETS graphicsview
diff --git a/examples/widgets/tools/CMakeLists.txt b/examples/widgets/tools/CMakeLists.txt
index 50087cba04..2de15d5a44 100644
--- a/examples/widgets/tools/CMakeLists.txt
+++ b/examples/widgets/tools/CMakeLists.txt
@@ -1,11 +1,8 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
qt_internal_add_example(completer)
qt_internal_add_example(customcompleter)
-if(QT_FEATURE_translation)
- qt_internal_add_example(i18n)
-endif()
qt_internal_add_example(regularexpression)
qt_internal_add_example(settingseditor)
qt_internal_add_example(styleplugin)
diff --git a/examples/widgets/tools/completer/CMakeLists.txt b/examples/widgets/tools/completer/CMakeLists.txt
index fa2bce8505..0cf49b519b 100644
--- a/examples/widgets/tools/completer/CMakeLists.txt
+++ b/examples/widgets/tools/completer/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(completer LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/tools/completer")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(completer
fsmodel.cpp fsmodel.h
main.cpp
@@ -26,9 +26,9 @@ set_target_properties(completer PROPERTIES
)
target_link_libraries(completer PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
# Resources:
diff --git a/examples/widgets/tools/customcompleter/CMakeLists.txt b/examples/widgets/tools/customcompleter/CMakeLists.txt
index 0cb97fc79d..58fba2b75d 100644
--- a/examples/widgets/tools/customcompleter/CMakeLists.txt
+++ b/examples/widgets/tools/customcompleter/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(customcompleter LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/tools/customcompleter")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(customcompleter
main.cpp
mainwindow.cpp mainwindow.h
@@ -26,9 +26,9 @@ set_target_properties(customcompleter PROPERTIES
)
target_link_libraries(customcompleter PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
# Resources:
diff --git a/examples/widgets/tools/echoplugin/CMakeLists.txt b/examples/widgets/tools/echoplugin/CMakeLists.txt
index 6ce59af6cd..cfe76f4a73 100644
--- a/examples/widgets/tools/echoplugin/CMakeLists.txt
+++ b/examples/widgets/tools/echoplugin/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(plugandpaint LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,5 +12,7 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/tools/echoplugin")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
add_subdirectory(plugin)
add_subdirectory(echowindow)
diff --git a/examples/widgets/tools/echoplugin/echowindow/CMakeLists.txt b/examples/widgets/tools/echoplugin/echowindow/CMakeLists.txt
index facacc29a6..728e6d4856 100644
--- a/examples/widgets/tools/echoplugin/echowindow/CMakeLists.txt
+++ b/examples/widgets/tools/echoplugin/echowindow/CMakeLists.txt
@@ -1,5 +1,5 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
qt_add_executable(echopluginwindow
echointerface.h
@@ -13,9 +13,9 @@ set_target_properties(echopluginwindow PROPERTIES
)
target_link_libraries(echopluginwindow PRIVATE
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
if(NOT QT6_IS_SHARED_LIBS_BUILD)
diff --git a/examples/widgets/tools/echoplugin/plugin/CMakeLists.txt b/examples/widgets/tools/echoplugin/plugin/CMakeLists.txt
index e19a4161a0..243d653177 100644
--- a/examples/widgets/tools/echoplugin/plugin/CMakeLists.txt
+++ b/examples/widgets/tools/echoplugin/plugin/CMakeLists.txt
@@ -1,5 +1,5 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
qt_add_plugin(echoplugin
CLASS_NAME EchoPlugin
@@ -15,9 +15,9 @@ target_include_directories(echoplugin PUBLIC
)
target_link_libraries(echoplugin PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
install(TARGETS echoplugin
diff --git a/examples/widgets/tools/i18n/CMakeLists.txt b/examples/widgets/tools/i18n/CMakeLists.txt
deleted file mode 100644
index 35a8692c47..0000000000
--- a/examples/widgets/tools/i18n/CMakeLists.txt
+++ /dev/null
@@ -1,63 +0,0 @@
-# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-
-cmake_minimum_required(VERSION 3.16)
-project(i18n LANGUAGES CXX)
-
-set(CMAKE_AUTOMOC ON)
-
-if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
-endif()
-
-set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/tools/i18n")
-
-find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
-
-qt_add_executable(i18n
- languagechooser.cpp languagechooser.h
- main.cpp
- mainwindow.cpp mainwindow.h
-)
-
-set_target_properties(i18n PROPERTIES
- WIN32_EXECUTABLE TRUE
- MACOSX_BUNDLE TRUE
-)
-
-target_link_libraries(i18n PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
-)
-
-# Resources:
-set(i18n_resource_files
- "translations/i18n_ar.qm"
- "translations/i18n_cs.qm"
- "translations/i18n_de.qm"
- "translations/i18n_el.qm"
- "translations/i18n_en.qm"
- "translations/i18n_eo.qm"
- "translations/i18n_fr.qm"
- "translations/i18n_it.qm"
- "translations/i18n_jp.qm"
- "translations/i18n_ko.qm"
- "translations/i18n_no.qm"
- "translations/i18n_ru.qm"
- "translations/i18n_sv.qm"
- "translations/i18n_zh.qm"
-)
-
-qt_add_resources(i18n "i18n"
- PREFIX
- "/"
- FILES
- ${i18n_resource_files}
-)
-
-install(TARGETS i18n
- RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
-)
diff --git a/examples/widgets/tools/i18n/i18n.pro b/examples/widgets/tools/i18n/i18n.pro
deleted file mode 100644
index a4d5e418ea..0000000000
--- a/examples/widgets/tools/i18n/i18n.pro
+++ /dev/null
@@ -1,27 +0,0 @@
-QT += widgets
-requires(qtConfig(listwidget))
-
-HEADERS = languagechooser.h \
- mainwindow.h
-SOURCES = languagechooser.cpp \
- main.cpp \
- mainwindow.cpp
-RESOURCES += i18n.qrc
-TRANSLATIONS += translations/i18n_ar.ts \
- translations/i18n_cs.ts \
- translations/i18n_de.ts \
- translations/i18n_el.ts \
- translations/i18n_en.ts \
- translations/i18n_eo.ts \
- translations/i18n_fr.ts \
- translations/i18n_it.ts \
- translations/i18n_jp.ts \
- translations/i18n_ko.ts \
- translations/i18n_no.ts \
- translations/i18n_ru.ts \
- translations/i18n_sv.ts \
- translations/i18n_zh.ts
-
-# install
-target.path = $$[QT_INSTALL_EXAMPLES]/widgets/tools/i18n
-INSTALLS += target
diff --git a/examples/widgets/tools/i18n/i18n.qrc b/examples/widgets/tools/i18n/i18n.qrc
deleted file mode 100644
index 16a89f140b..0000000000
--- a/examples/widgets/tools/i18n/i18n.qrc
+++ /dev/null
@@ -1,18 +0,0 @@
-<!DOCTYPE RCC><RCC version="1.0">
-<qresource>
- <file>translations/i18n_ar.qm</file>
- <file>translations/i18n_cs.qm</file>
- <file>translations/i18n_de.qm</file>
- <file>translations/i18n_el.qm</file>
- <file>translations/i18n_en.qm</file>
- <file>translations/i18n_eo.qm</file>
- <file>translations/i18n_fr.qm</file>
- <file>translations/i18n_it.qm</file>
- <file>translations/i18n_jp.qm</file>
- <file>translations/i18n_ko.qm</file>
- <file>translations/i18n_no.qm</file>
- <file>translations/i18n_ru.qm</file>
- <file>translations/i18n_sv.qm</file>
- <file>translations/i18n_zh.qm</file>
-</qresource>
-</RCC>
diff --git a/examples/widgets/tools/i18n/languagechooser.cpp b/examples/widgets/tools/i18n/languagechooser.cpp
deleted file mode 100644
index 936c755e71..0000000000
--- a/examples/widgets/tools/i18n/languagechooser.cpp
+++ /dev/null
@@ -1,139 +0,0 @@
-// Copyright (C) 2016 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-
-#include "languagechooser.h"
-#include "mainwindow.h"
-
-#include <QCoreApplication>
-#include <QCheckBox>
-#include <QDialogButtonBox>
-#include <QDir>
-#include <QGridLayout>
-#include <QGroupBox>
-#include <QPushButton>
-#include <QTranslator>
-
-LanguageChooser::LanguageChooser(const QString &defaultLang, QWidget *parent)
- : QDialog(parent, Qt::WindowStaysOnTopHint)
-{
- groupBox = new QGroupBox("Languages");
-
- QGridLayout *groupBoxLayout = new QGridLayout;
-
- const QStringList qmFiles = findQmFiles();
- for (int i = 0; i < qmFiles.size(); ++i) {
- const QString &qmlFile = qmFiles.at(i);
- QCheckBox *checkBox = new QCheckBox(languageName(qmlFile));
- qmFileForCheckBoxMap.insert(checkBox, qmlFile);
- connect(checkBox, &QCheckBox::toggled,
- this, &LanguageChooser::checkBoxToggled);
- if (languageMatch(defaultLang, qmlFile))
- checkBox->setCheckState(Qt::Checked);
- groupBoxLayout->addWidget(checkBox, i / 2, i % 2);
- }
- groupBox->setLayout(groupBoxLayout);
-
- buttonBox = new QDialogButtonBox;
- showAllButton = buttonBox->addButton("Show All",
- QDialogButtonBox::ActionRole);
- hideAllButton = buttonBox->addButton("Hide All",
- QDialogButtonBox::ActionRole);
-
- connect(showAllButton, &QAbstractButton::clicked, this, &LanguageChooser::showAll);
- connect(hideAllButton, &QAbstractButton::clicked, this, &LanguageChooser::hideAll);
-
- QVBoxLayout *mainLayout = new QVBoxLayout;
- mainLayout->addWidget(groupBox);
- mainLayout->addWidget(buttonBox);
- setLayout(mainLayout);
-
- setWindowTitle("I18N");
-}
-
-bool LanguageChooser::languageMatch(QStringView lang, QStringView qmFile)
-{
- //qmFile: i18n_xx.qm
- const QStringView prefix{ u"i18n_" };
- const int langTokenLength = 2; /*FIXME: is checking two chars enough?*/
- return qmFile.mid(qmFile.indexOf(prefix) + prefix.length(), langTokenLength) == lang.left(langTokenLength);
-}
-
-bool LanguageChooser::eventFilter(QObject *object, QEvent *event)
-{
- if (event->type() == QEvent::Close) {
- MainWindow *window = qobject_cast<MainWindow *>(object);
- if (window) {
- QCheckBox *checkBox = mainWindowForCheckBoxMap.key(window);
- if (checkBox)
- checkBox->setChecked(false);
- }
- }
- return QDialog::eventFilter(object, event);
-}
-
-void LanguageChooser::closeEvent(QCloseEvent * /* event */)
-{
- QCoreApplication::quit();
-}
-
-void LanguageChooser::checkBoxToggled()
-{
- QCheckBox *checkBox = qobject_cast<QCheckBox *>(sender());
- MainWindow *window = mainWindowForCheckBoxMap.value(checkBox);
- if (!window) {
- QTranslator translator;
- const QString qmlFile = qmFileForCheckBoxMap.value(checkBox);
- if (translator.load(qmlFile))
- QCoreApplication::installTranslator(&translator);
- else
- qWarning("Unable to load %s", qPrintable(QDir::toNativeSeparators(qmlFile)));
-
- window = new MainWindow;
- window->setPalette(colorForLanguage(checkBox->text()));
-
- window->installEventFilter(this);
- mainWindowForCheckBoxMap.insert(checkBox, window);
- }
- window->setVisible(checkBox->isChecked());
-}
-
-void LanguageChooser::showAll()
-{
- for (auto it = qmFileForCheckBoxMap.keyBegin(); it != qmFileForCheckBoxMap.keyEnd(); ++it)
- (*it)->setChecked(true);
-}
-
-void LanguageChooser::hideAll()
-{
- for (auto it = qmFileForCheckBoxMap.keyBegin(); it != qmFileForCheckBoxMap.keyEnd(); ++it)
- (*it)->setChecked(false);
-}
-
-QStringList LanguageChooser::findQmFiles()
-{
- QDir dir(":/translations");
- QStringList fileNames = dir.entryList(QStringList("*.qm"), QDir::Files,
- QDir::Name);
- for (QString &fileName : fileNames)
- fileName = dir.filePath(fileName);
- return fileNames;
-}
-
-QString LanguageChooser::languageName(const QString &qmFile)
-{
- QTranslator translator;
- if (!translator.load(qmFile)) {
- qWarning("Unable to load %s", qPrintable(QDir::toNativeSeparators(qmFile)));
- return {};
- }
- return translator.translate("MainWindow", "English");
-}
-
-QColor LanguageChooser::colorForLanguage(const QString &language)
-{
- size_t hashValue = qHash(language);
- int red = 156 + (hashValue & 0x3F);
- int green = 156 + ((hashValue >> 6) & 0x3F);
- int blue = 156 + ((hashValue >> 12) & 0x3F);
- return QColor(red, green, blue);
-}
diff --git a/examples/widgets/tools/i18n/languagechooser.h b/examples/widgets/tools/i18n/languagechooser.h
deleted file mode 100644
index b7b029bb0a..0000000000
--- a/examples/widgets/tools/i18n/languagechooser.h
+++ /dev/null
@@ -1,49 +0,0 @@
-// Copyright (C) 2016 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-
-#ifndef LANGUAGECHOOSER_H
-#define LANGUAGECHOOSER_H
-
-#include <QDialog>
-#include <QHash>
-#include <QStringList>
-
-QT_BEGIN_NAMESPACE
-class QAbstractButton;
-class QCheckBox;
-class QDialogButtonBox;
-class QGroupBox;
-QT_END_NAMESPACE
-class MainWindow;
-
-class LanguageChooser : public QDialog
-{
- Q_OBJECT
-
-public:
- explicit LanguageChooser(const QString &defaultLang = QString(), QWidget *parent = nullptr);
-
-protected:
- bool eventFilter(QObject *object, QEvent *event) override;
- void closeEvent(QCloseEvent *event) override;
-
-private slots:
- void checkBoxToggled();
- void showAll();
- void hideAll();
-
-private:
- static QStringList findQmFiles();
- static QString languageName(const QString &qmFile);
- static QColor colorForLanguage(const QString &language);
- static bool languageMatch(QStringView lang, QStringView qmFile);
-
- QGroupBox *groupBox;
- QDialogButtonBox *buttonBox;
- QAbstractButton *showAllButton;
- QAbstractButton *hideAllButton;
- QHash<QCheckBox *, QString> qmFileForCheckBoxMap;
- QHash<QCheckBox *, MainWindow *> mainWindowForCheckBoxMap;
-};
-
-#endif
diff --git a/examples/widgets/tools/i18n/main.cpp b/examples/widgets/tools/i18n/main.cpp
deleted file mode 100644
index c7133bd682..0000000000
--- a/examples/widgets/tools/i18n/main.cpp
+++ /dev/null
@@ -1,17 +0,0 @@
-// Copyright (C) 2016 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-
-#include <QApplication>
-#include <QLocale>
-#include "languagechooser.h"
-#include "mainwindow.h"
-
-int main(int argc, char *argv[])
-{
- Q_INIT_RESOURCE(i18n);
-
- QApplication app(argc, argv);
- LanguageChooser chooser(QLocale::system().name());
- chooser.show();
- return app.exec();
-}
diff --git a/examples/widgets/tools/i18n/mainwindow.cpp b/examples/widgets/tools/i18n/mainwindow.cpp
deleted file mode 100644
index e8feb06aa5..0000000000
--- a/examples/widgets/tools/i18n/mainwindow.cpp
+++ /dev/null
@@ -1,66 +0,0 @@
-// Copyright (C) 2016 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-
-#include "mainwindow.h"
-
-#include <QAction>
-#include <QCoreApplication>
-#include <QGroupBox>
-#include <QListWidget>
-#include <QMenuBar>
-#include <QRadioButton>
-#include <QStatusBar>
-#include <QVBoxLayout>
-
-static const char * const listEntries[] = {
- QT_TRANSLATE_NOOP("MainWindow", "First"),
- QT_TRANSLATE_NOOP("MainWindow", "Second"),
- QT_TRANSLATE_NOOP("MainWindow", "Third"),
- nullptr
-};
-
-MainWindow::MainWindow(QWidget *parent)
- : QMainWindow(parent)
-{
- centralWidget = new QWidget;
- setCentralWidget(centralWidget);
-
- createGroupBox();
-
- listWidget = new QListWidget;
- for (const char *entry : listEntries)
- listWidget->addItem(tr(entry));
-
- QVBoxLayout *mainLayout = new QVBoxLayout;
- mainLayout->addWidget(groupBox);
- mainLayout->addWidget(listWidget);
- centralWidget->setLayout(mainLayout);
-
- exitAction = new QAction(tr("E&xit"), this);
- connect(exitAction, &QAction::triggered, qApp, QCoreApplication::quit);
-
- fileMenu = menuBar()->addMenu(tr("&File"));
- fileMenu->setPalette(QPalette(Qt::red));
- fileMenu->addAction(exitAction);
-
- setWindowTitle(tr("Language: %1").arg(tr("English")));
- statusBar()->showMessage(tr("Internationalization Example"));
-
- if (tr("LTR") == "RTL")
- setLayoutDirection(Qt::RightToLeft);
-}
-
-void MainWindow::createGroupBox()
-{
- groupBox = new QGroupBox(tr("View"));
- perspectiveRadioButton = new QRadioButton(tr("Perspective"));
- isometricRadioButton = new QRadioButton(tr("Isometric"));
- obliqueRadioButton = new QRadioButton(tr("Oblique"));
- perspectiveRadioButton->setChecked(true);
-
- QVBoxLayout *groupBoxLayout = new QVBoxLayout;
- groupBoxLayout->addWidget(perspectiveRadioButton);
- groupBoxLayout->addWidget(isometricRadioButton);
- groupBoxLayout->addWidget(obliqueRadioButton);
- groupBox->setLayout(groupBoxLayout);
-}
diff --git a/examples/widgets/tools/i18n/mainwindow.h b/examples/widgets/tools/i18n/mainwindow.h
deleted file mode 100644
index 1552b94fcd..0000000000
--- a/examples/widgets/tools/i18n/mainwindow.h
+++ /dev/null
@@ -1,39 +0,0 @@
-// Copyright (C) 2016 The Qt Company Ltd.
-// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
-
-#ifndef MAINWINDOW_H
-#define MAINWINDOW_H
-
-#include <QMainWindow>
-
-QT_BEGIN_NAMESPACE
-class QAction;
-class QGroupBox;
-class QLabel;
-class QListWidget;
-class QMenu;
-class QRadioButton;
-QT_END_NAMESPACE
-
-class MainWindow : public QMainWindow
-{
- Q_OBJECT
-
-public:
- MainWindow(QWidget *parent = nullptr);
-
-private:
- void createGroupBox();
-
- QWidget *centralWidget;
- QLabel *label;
- QGroupBox *groupBox;
- QListWidget *listWidget;
- QRadioButton *perspectiveRadioButton;
- QRadioButton *isometricRadioButton;
- QRadioButton *obliqueRadioButton;
- QMenu *fileMenu;
- QAction *exitAction;
-};
-
-#endif
diff --git a/examples/widgets/tools/i18n/translations/i18n_ar.qm b/examples/widgets/tools/i18n/translations/i18n_ar.qm
deleted file mode 100644
index a134c468bb..0000000000
--- a/examples/widgets/tools/i18n/translations/i18n_ar.qm
+++ /dev/null
Binary files differ
diff --git a/examples/widgets/tools/i18n/translations/i18n_ar.ts b/examples/widgets/tools/i18n/translations/i18n_ar.ts
deleted file mode 100644
index a7ec2c9404..0000000000
--- a/examples/widgets/tools/i18n/translations/i18n_ar.ts
+++ /dev/null
@@ -1,57 +0,0 @@
-<!DOCTYPE TS><TS>
-<context>
- <name>MainWindow</name>
- <message>
- <source>First</source>
- <translation>أول</translation>
- </message>
- <message>
- <source>Internationalization Example</source>
- <translation>مثال التدويل</translation>
- </message>
- <message>
- <source>Isometric</source>
- <translation>متماثل</translation>
- </message>
- <message>
- <source>Language: %1</source>
- <translation>اللغة: %1</translation>
- </message>
- <message>
- <source>English</source>
- <translation>العربية</translation>
- </message>
- <message>
- <source>Oblique</source>
- <translation>مصمت</translation>
- </message>
- <message>
- <source>Perspective</source>
- <translation>منظور</translation>
- </message>
- <message>
- <source>Second</source>
- <translation>ثانى</translation>
- </message>
- <message>
- <source>Third</source>
- <translation>ثالث</translation>
- </message>
- <message>
- <source>View</source>
- <translation>مرئى</translation>
- </message>
- <message>
- <source>E&amp;xit</source>
- <translation>أخرج</translation>
- </message>
- <message>
- <source>&amp;File</source>
- <translation>الملف</translation>
- </message>
- <message>
- <source>LTR</source>
- <translation>RTL</translation>
- </message>
-</context>
-</TS>
diff --git a/examples/widgets/tools/i18n/translations/i18n_cs.qm b/examples/widgets/tools/i18n/translations/i18n_cs.qm
deleted file mode 100644
index 5b7ff95b05..0000000000
--- a/examples/widgets/tools/i18n/translations/i18n_cs.qm
+++ /dev/null
Binary files differ
diff --git a/examples/widgets/tools/i18n/translations/i18n_cs.ts b/examples/widgets/tools/i18n/translations/i18n_cs.ts
deleted file mode 100644
index 6c4dee9b2e..0000000000
--- a/examples/widgets/tools/i18n/translations/i18n_cs.ts
+++ /dev/null
@@ -1,57 +0,0 @@
-<!DOCTYPE TS><TS>
-<context>
- <name>MainWindow</name>
- <message>
- <source>View</source>
- <translation>Pohled</translation>
- </message>
- <message>
- <source>&amp;File</source>
- <translation>&amp;Soubor</translation>
- </message>
- <message>
- <source>E&amp;xit</source>
- <translation>&amp;Konec</translation>
- </message>
- <message>
- <source>First</source>
- <translation>První</translation>
- </message>
- <message>
- <source>Third</source>
- <translation>Třetí</translation>
- </message>
- <message>
- <source>Language: %1</source>
- <translation>Jayzk: %1</translation>
- </message>
- <message>
- <source>English</source>
- <translation>Český</translation>
- </message>
- <message>
- <source>Oblique</source>
- <translation>Nakloněný</translation>
- </message>
- <message>
- <source>Second</source>
- <translation>Druhý</translation>
- </message>
- <message>
- <source>Isometric</source>
- <translation>Isometrický</translation>
- </message>
- <message>
- <source>Perspective</source>
- <translation>Perspektivní</translation>
- </message>
- <message>
- <source>Internationalization Example</source>
- <translation>Ukázka lokalizace</translation>
- </message>
- <message>
- <source>LTR</source>
- <translation>LTR</translation>
- </message>
-</context>
-</TS>
diff --git a/examples/widgets/tools/i18n/translations/i18n_de.qm b/examples/widgets/tools/i18n/translations/i18n_de.qm
deleted file mode 100644
index 177fc49b8b..0000000000
--- a/examples/widgets/tools/i18n/translations/i18n_de.qm
+++ /dev/null
Binary files differ
diff --git a/examples/widgets/tools/i18n/translations/i18n_de.ts b/examples/widgets/tools/i18n/translations/i18n_de.ts
deleted file mode 100644
index 249a61d020..0000000000
--- a/examples/widgets/tools/i18n/translations/i18n_de.ts
+++ /dev/null
@@ -1,57 +0,0 @@
-<!DOCTYPE TS><TS>
-<context>
- <name>MainWindow</name>
- <message>
- <source>View</source>
- <translation>Ansicht</translation>
- </message>
- <message>
- <source>&amp;File</source>
- <translation>&amp;Datei</translation>
- </message>
- <message>
- <source>E&amp;xit</source>
- <translation>Be&amp;enden</translation>
- </message>
- <message>
- <source>First</source>
- <translation>Erstens</translation>
- </message>
- <message>
- <source>Third</source>
- <translation>Drittens</translation>
- </message>
- <message>
- <source>English</source>
- <translation>Deutsch</translation>
- </message>
- <message>
- <source>Language: %1</source>
- <translation>Sprache: %1</translation>
- </message>
- <message>
- <source>Oblique</source>
- <translation>Schief</translation>
- </message>
- <message>
- <source>Second</source>
- <translation>Zweitens</translation>
- </message>
- <message>
- <source>Isometric</source>
- <translation>Isometrisch</translation>
- </message>
- <message>
- <source>Perspective</source>
- <translation>Perspektivisch</translation>
- </message>
- <message>
- <source>Internationalization Example</source>
- <translation>Internationalisierungsbeispiel</translation>
- </message>
- <message>
- <source>LTR</source>
- <translation>LTR</translation>
- </message>
-</context>
-</TS>
diff --git a/examples/widgets/tools/i18n/translations/i18n_el.qm b/examples/widgets/tools/i18n/translations/i18n_el.qm
deleted file mode 100644
index 5483291bb0..0000000000
--- a/examples/widgets/tools/i18n/translations/i18n_el.qm
+++ /dev/null
Binary files differ
diff --git a/examples/widgets/tools/i18n/translations/i18n_el.ts b/examples/widgets/tools/i18n/translations/i18n_el.ts
deleted file mode 100644
index d23a0aad3e..0000000000
--- a/examples/widgets/tools/i18n/translations/i18n_el.ts
+++ /dev/null
@@ -1,57 +0,0 @@
-<!DOCTYPE TS><TS>
-<context>
- <name>MainWindow</name>
- <message>
- <source>&amp;File</source>
- <translation>&amp;Αρχείο</translation>
- </message>
- <message>
- <source>E&amp;xit</source>
- <translation>Έ&amp;ξοδος</translation>
- </message>
- <message>
- <source>First</source>
- <translation>Πρώτο</translation>
- </message>
- <message>
- <source>Internationalization Example</source>
- <translation>Παράδειγμα διεθνοποίησης</translation>
- </message>
- <message>
- <source>Isometric</source>
- <translation>Ισομετρική</translation>
- </message>
- <message>
- <source>Language: %1</source>
- <translation>Γλώσσα: %1</translation>
- </message>
- <message>
- <source>English</source>
- <translation>Ελληνικά</translation>
- </message>
- <message>
- <source>Oblique</source>
- <translation>Πλάγια</translation>
- </message>
- <message>
- <source>Perspective</source>
- <translation>Προοπτική</translation>
- </message>
- <message>
- <source>Second</source>
- <translation>Δεύτερο</translation>
- </message>
- <message>
- <source>Third</source>
- <translation>Τρίτο</translation>
- </message>
- <message>
- <source>View</source>
- <translation>Όψη</translation>
- </message>
- <message>
- <source>LTR</source>
- <translation>LTR</translation>
- </message>
-</context>
-</TS>
diff --git a/examples/widgets/tools/i18n/translations/i18n_en.qm b/examples/widgets/tools/i18n/translations/i18n_en.qm
deleted file mode 100644
index 9190ac7e6f..0000000000
--- a/examples/widgets/tools/i18n/translations/i18n_en.qm
+++ /dev/null
Binary files differ
diff --git a/examples/widgets/tools/i18n/translations/i18n_en.ts b/examples/widgets/tools/i18n/translations/i18n_en.ts
deleted file mode 100644
index ca38e958c1..0000000000
--- a/examples/widgets/tools/i18n/translations/i18n_en.ts
+++ /dev/null
@@ -1,57 +0,0 @@
-<!DOCTYPE TS><TS>
-<context>
- <name>MainWindow</name>
- <message>
- <source>E&amp;xit</source>
- <translation>E&amp;xit</translation>
- </message>
- <message>
- <source>&amp;File</source>
- <translation>&amp;File</translation>
- </message>
- <message>
- <source>Internationalization Example</source>
- <translation>Internationalization Example</translation>
- </message>
- <message>
- <source>Language: %1</source>
- <translation>Language: %1</translation>
- </message>
- <message>
- <source>English</source>
- <translation>English</translation>
- </message>
- <message>
- <source>View</source>
- <translation>View</translation>
- </message>
- <message>
- <source>Perspective</source>
- <translation>Perspective</translation>
- </message>
- <message>
- <source>Isometric</source>
- <translation>Isometric</translation>
- </message>
- <message>
- <source>Oblique</source>
- <translation>Oblique</translation>
- </message>
- <message>
- <source>First</source>
- <translation>First</translation>
- </message>
- <message>
- <source>Second</source>
- <translation>Second</translation>
- </message>
- <message>
- <source>Third</source>
- <translation>Third</translation>
- </message>
- <message>
- <source>LTR</source>
- <translation>LTR</translation>
- </message>
-</context>
-</TS>
diff --git a/examples/widgets/tools/i18n/translations/i18n_eo.qm b/examples/widgets/tools/i18n/translations/i18n_eo.qm
deleted file mode 100644
index a8457bef06..0000000000
--- a/examples/widgets/tools/i18n/translations/i18n_eo.qm
+++ /dev/null
Binary files differ
diff --git a/examples/widgets/tools/i18n/translations/i18n_eo.ts b/examples/widgets/tools/i18n/translations/i18n_eo.ts
deleted file mode 100644
index 16a37becd9..0000000000
--- a/examples/widgets/tools/i18n/translations/i18n_eo.ts
+++ /dev/null
@@ -1,57 +0,0 @@
-<!DOCTYPE TS><TS>
-<context>
- <name>MainWindow</name>
- <message>
- <source>&amp;File</source>
- <translation>&amp;Dosiero</translation>
- </message>
- <message>
- <source>First</source>
- <translation>Unue</translation>
- </message>
- <message>
- <source>Internationalization Example</source>
- <translation>Ekzemplo pri internaciigo</translation>
- </message>
- <message>
- <source>Isometric</source>
- <translation>Isometria</translation>
- </message>
- <message>
- <source>Language: %1</source>
- <translation>Lingvo: %1</translation>
- </message>
- <message>
- <source>English</source>
- <translation>Esperanto</translation>
- </message>
- <message>
- <source>Oblique</source>
- <translation>Oblikva</translation>
- </message>
- <message>
- <source>Perspective</source>
- <translation>Perspektiva</translation>
- </message>
- <message>
- <source>Second</source>
- <translation>Due</translation>
- </message>
- <message>
- <source>Third</source>
- <translation>Trie</translation>
- </message>
- <message>
- <source>View</source>
- <translation>Aspekto</translation>
- </message>
- <message>
- <source>E&amp;xit</source>
- <translation>&amp;Fini</translation>
- </message>
- <message>
- <source>LTR</source>
- <translation>LTR</translation>
- </message>
-</context>
-</TS>
diff --git a/examples/widgets/tools/i18n/translations/i18n_fr.qm b/examples/widgets/tools/i18n/translations/i18n_fr.qm
deleted file mode 100644
index 3e8a69b80d..0000000000
--- a/examples/widgets/tools/i18n/translations/i18n_fr.qm
+++ /dev/null
Binary files differ
diff --git a/examples/widgets/tools/i18n/translations/i18n_fr.ts b/examples/widgets/tools/i18n/translations/i18n_fr.ts
deleted file mode 100644
index 0012892ef2..0000000000
--- a/examples/widgets/tools/i18n/translations/i18n_fr.ts
+++ /dev/null
@@ -1,57 +0,0 @@
-<!DOCTYPE TS><TS>
-<context>
- <name>MainWindow</name>
- <message>
- <source>View</source>
- <translation>Vue</translation>
- </message>
- <message>
- <source>&amp;File</source>
- <translation>&amp;Fichier</translation>
- </message>
- <message>
- <source>E&amp;xit</source>
- <translation>&amp;Quitter</translation>
- </message>
- <message>
- <source>First</source>
- <translation>Premier</translation>
- </message>
- <message>
- <source>Third</source>
- <translation>Troisième</translation>
- </message>
- <message>
- <source>Language: %1</source>
- <translation>Langue : %1</translation>
- </message>
- <message>
- <source>English</source>
- <translation>Français</translation>
- </message>
- <message>
- <source>Oblique</source>
- <translation>Oblique</translation>
- </message>
- <message>
- <source>Second</source>
- <translation>Deuxième</translation>
- </message>
- <message>
- <source>Isometric</source>
- <translation>Isométrique</translation>
- </message>
- <message>
- <source>Perspective</source>
- <translation>Perspective</translation>
- </message>
- <message>
- <source>Internationalization Example</source>
- <translation>Exemple d&apos;internationalisation</translation>
- </message>
- <message>
- <source>LTR</source>
- <translation>LTR</translation>
- </message>
-</context>
-</TS>
diff --git a/examples/widgets/tools/i18n/translations/i18n_it.qm b/examples/widgets/tools/i18n/translations/i18n_it.qm
deleted file mode 100644
index 3dffd30548..0000000000
--- a/examples/widgets/tools/i18n/translations/i18n_it.qm
+++ /dev/null
Binary files differ
diff --git a/examples/widgets/tools/i18n/translations/i18n_it.ts b/examples/widgets/tools/i18n/translations/i18n_it.ts
deleted file mode 100644
index d516a277b6..0000000000
--- a/examples/widgets/tools/i18n/translations/i18n_it.ts
+++ /dev/null
@@ -1,57 +0,0 @@
-<!DOCTYPE TS><TS>
-<context>
- <name>MainWindow</name>
- <message>
- <source>First</source>
- <translation>Primo</translation>
- </message>
- <message>
- <source>Internationalization Example</source>
- <translation>Esempio di localizzazione</translation>
- </message>
- <message>
- <source>Isometric</source>
- <translation>Isometrica</translation>
- </message>
- <message>
- <source>Language: %1</source>
- <translation>Lingua: %1</translation>
- </message>
- <message>
- <source>English</source>
- <translation>Italiano</translation>
- </message>
- <message>
- <source>Oblique</source>
- <translation>Obliqua</translation>
- </message>
- <message>
- <source>Perspective</source>
- <translation>Prospettica</translation>
- </message>
- <message>
- <source>Second</source>
- <translation>Secondo</translation>
- </message>
- <message>
- <source>Third</source>
- <translation>Terzo</translation>
- </message>
- <message>
- <source>View</source>
- <translation>Vista</translation>
- </message>
- <message>
- <source>E&amp;xit</source>
- <translation>&amp;Esci</translation>
- </message>
- <message>
- <source>&amp;File</source>
- <translation>&amp;File</translation>
- </message>
- <message>
- <source>LTR</source>
- <translation>LTR</translation>
- </message>
-</context>
-</TS>
diff --git a/examples/widgets/tools/i18n/translations/i18n_jp.qm b/examples/widgets/tools/i18n/translations/i18n_jp.qm
deleted file mode 100644
index 017bc96cfc..0000000000
--- a/examples/widgets/tools/i18n/translations/i18n_jp.qm
+++ /dev/null
Binary files differ
diff --git a/examples/widgets/tools/i18n/translations/i18n_jp.ts b/examples/widgets/tools/i18n/translations/i18n_jp.ts
deleted file mode 100644
index 067b5a8a0b..0000000000
--- a/examples/widgets/tools/i18n/translations/i18n_jp.ts
+++ /dev/null
@@ -1,57 +0,0 @@
-<!DOCTYPE TS><TS>
-<context>
- <name>MainWindow</name>
- <message>
- <source>&amp;File</source>
- <translation>ファイル(&amp;F)</translation>
- </message>
- <message>
- <source>E&amp;xit</source>
- <translation>終了(&amp;X)</translation>
- </message>
- <message>
- <source>First</source>
- <translation>第一行</translation>
- </message>
- <message>
- <source>Internationalization Example</source>
- <translation>国際化(i18n)の例</translation>
- </message>
- <message>
- <source>Isometric</source>
- <translation>等角投影法</translation>
- </message>
- <message>
- <source>Language: %1</source>
- <translation>言語: %1</translation>
- </message>
- <message>
- <source>English</source>
- <translation>日本語</translation>
- </message>
- <message>
- <source>Oblique</source>
- <translation>斜め投影法</translation>
- </message>
- <message>
- <source>Perspective</source>
- <translation>遠近法</translation>
- </message>
- <message>
- <source>Second</source>
- <translation>第二行</translation>
- </message>
- <message>
- <source>Third</source>
- <translation>第三行</translation>
- </message>
- <message>
- <source>View</source>
- <translation>表示方式</translation>
- </message>
- <message>
- <source>LTR</source>
- <translation>LTR</translation>
- </message>
-</context>
-</TS>
diff --git a/examples/widgets/tools/i18n/translations/i18n_ko.qm b/examples/widgets/tools/i18n/translations/i18n_ko.qm
deleted file mode 100644
index d61b93db39..0000000000
--- a/examples/widgets/tools/i18n/translations/i18n_ko.qm
+++ /dev/null
Binary files differ
diff --git a/examples/widgets/tools/i18n/translations/i18n_ko.ts b/examples/widgets/tools/i18n/translations/i18n_ko.ts
deleted file mode 100644
index bfd5924518..0000000000
--- a/examples/widgets/tools/i18n/translations/i18n_ko.ts
+++ /dev/null
@@ -1,57 +0,0 @@
-<!DOCTYPE TS><TS>
-<context>
- <name>MainWindow</name>
- <message>
- <source>&amp;File</source>
- <translation>파일&amp;F</translation>
- </message>
- <message>
- <source>E&amp;xit</source>
- <translation>종료&amp;X</translation>
- </message>
- <message>
- <source>First</source>
- <translation>첫번째</translation>
- </message>
- <message>
- <source>Internationalization Example</source>
- <translation>국제화 예제</translation>
- </message>
- <message>
- <source>Isometric</source>
- <translation>등측도</translation>
- </message>
- <message>
- <source>Language: %1</source>
- <translation>언어 : %1</translation>
- </message>
- <message>
- <source>English</source>
- <translation>한국어</translation>
- </message>
- <message>
- <source>Oblique</source>
- <translation>빗각</translation>
- </message>
- <message>
- <source>Perspective</source>
- <translation>원근화법</translation>
- </message>
- <message>
- <source>Second</source>
- <translation>두번째</translation>
- </message>
- <message>
- <source>Third</source>
- <translation>세번째</translation>
- </message>
- <message>
- <source>View</source>
- <translation>보기</translation>
- </message>
- <message>
- <source>LTR</source>
- <translation>LTR</translation>
- </message>
-</context>
-</TS>
diff --git a/examples/widgets/tools/i18n/translations/i18n_no.qm b/examples/widgets/tools/i18n/translations/i18n_no.qm
deleted file mode 100644
index c84b0d74ba..0000000000
--- a/examples/widgets/tools/i18n/translations/i18n_no.qm
+++ /dev/null
Binary files differ
diff --git a/examples/widgets/tools/i18n/translations/i18n_no.ts b/examples/widgets/tools/i18n/translations/i18n_no.ts
deleted file mode 100644
index 2e06974997..0000000000
--- a/examples/widgets/tools/i18n/translations/i18n_no.ts
+++ /dev/null
@@ -1,57 +0,0 @@
-<!DOCTYPE TS><TS>
-<context>
- <name>MainWindow</name>
- <message>
- <source>View</source>
- <translation>Vis</translation>
- </message>
- <message>
- <source>&amp;File</source>
- <translation>&amp;Fil</translation>
- </message>
- <message>
- <source>E&amp;xit</source>
- <translation>&amp;Avslutt</translation>
- </message>
- <message>
- <source>First</source>
- <translation>Første</translation>
- </message>
- <message>
- <source>Third</source>
- <translation>Tredje</translation>
- </message>
- <message>
- <source>Language: %1</source>
- <translation>Språk: %1</translation>
- </message>
- <message>
- <source>English</source>
- <translation>Norsk</translation>
- </message>
- <message>
- <source>Oblique</source>
- <translation>Skjevt</translation>
- </message>
- <message>
- <source>Second</source>
- <translation>Andre</translation>
- </message>
- <message>
- <source>Isometric</source>
- <translation>Isometrisk</translation>
- </message>
- <message>
- <source>Perspective</source>
- <translation>Perspektiv</translation>
- </message>
- <message>
- <source>Internationalization Example</source>
- <translation>Internasjonaliseringseksempel</translation>
- </message>
- <message>
- <source>LTR</source>
- <translation>LTR</translation>
- </message>
-</context>
-</TS>
diff --git a/examples/widgets/tools/i18n/translations/i18n_ru.qm b/examples/widgets/tools/i18n/translations/i18n_ru.qm
deleted file mode 100644
index a76e1b8703..0000000000
--- a/examples/widgets/tools/i18n/translations/i18n_ru.qm
+++ /dev/null
Binary files differ
diff --git a/examples/widgets/tools/i18n/translations/i18n_ru.ts b/examples/widgets/tools/i18n/translations/i18n_ru.ts
deleted file mode 100644
index 748cc12fd9..0000000000
--- a/examples/widgets/tools/i18n/translations/i18n_ru.ts
+++ /dev/null
@@ -1,59 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!DOCTYPE TS><TS version="1.1" language="ru">
-<defaultcodec></defaultcodec>
-<context>
- <name>MainWindow</name>
- <message>
- <source>View</source>
- <translation>Вид</translation>
- </message>
- <message>
- <source>&amp;File</source>
- <translation>Файл</translation>
- </message>
- <message>
- <source>E&amp;xit</source>
- <translation>Выход</translation>
- </message>
- <message>
- <source>First</source>
- <translation>Первый</translation>
- </message>
- <message>
- <source>Third</source>
- <translation>Третий</translation>
- </message>
- <message>
- <source>Language: %1</source>
- <translation>Язык: %1</translation>
- </message>
- <message>
- <source>English</source>
- <translation>Русский</translation>
- </message>
- <message>
- <source>Oblique</source>
- <translation>Курсив</translation>
- </message>
- <message>
- <source>Second</source>
- <translation>Второй</translation>
- </message>
- <message>
- <source>Isometric</source>
- <translation>Изометрический</translation>
- </message>
- <message>
- <source>Perspective</source>
- <translation>Перспектива</translation>
- </message>
- <message>
- <source>Internationalization Example</source>
- <translation>Пример интернационализации</translation>
- </message>
- <message>
- <source>LTR</source>
- <translation>LTR</translation>
- </message>
-</context>
-</TS>
diff --git a/examples/widgets/tools/i18n/translations/i18n_sv.qm b/examples/widgets/tools/i18n/translations/i18n_sv.qm
deleted file mode 100644
index 7204b308b1..0000000000
--- a/examples/widgets/tools/i18n/translations/i18n_sv.qm
+++ /dev/null
Binary files differ
diff --git a/examples/widgets/tools/i18n/translations/i18n_sv.ts b/examples/widgets/tools/i18n/translations/i18n_sv.ts
deleted file mode 100644
index ac4ab98bd3..0000000000
--- a/examples/widgets/tools/i18n/translations/i18n_sv.ts
+++ /dev/null
@@ -1,57 +0,0 @@
-<!DOCTYPE TS><TS>
-<context>
- <name>MainWindow</name>
- <message>
- <source>View</source>
- <translation>Visa</translation>
- </message>
- <message>
- <source>&amp;File</source>
- <translation>&amp;Arkiv</translation>
- </message>
- <message>
- <source>E&amp;xit</source>
- <translation>&amp;Avsluta</translation>
- </message>
- <message>
- <source>First</source>
- <translation>Första</translation>
- </message>
- <message>
- <source>Third</source>
- <translation>Tredje</translation>
- </message>
- <message>
- <source>Language: %1</source>
- <translation>Språk: %1</translation>
- </message>
- <message>
- <source>English</source>
- <translation>Svenska</translation>
- </message>
- <message>
- <source>Oblique</source>
- <translation>Skevt</translation>
- </message>
- <message>
- <source>Second</source>
- <translation>Andra</translation>
- </message>
- <message>
- <source>Isometric</source>
- <translation>Isometriskt</translation>
- </message>
- <message>
- <source>Perspective</source>
- <translation>Perspektivt</translation>
- </message>
- <message>
- <source>Internationalization Example</source>
- <translation>Internationaliseringsexempel</translation>
- </message>
- <message>
- <source>LTR</source>
- <translation>LTR</translation>
- </message>
-</context>
-</TS>
diff --git a/examples/widgets/tools/i18n/translations/i18n_zh.qm b/examples/widgets/tools/i18n/translations/i18n_zh.qm
deleted file mode 100644
index 32053f4633..0000000000
--- a/examples/widgets/tools/i18n/translations/i18n_zh.qm
+++ /dev/null
Binary files differ
diff --git a/examples/widgets/tools/i18n/translations/i18n_zh.ts b/examples/widgets/tools/i18n/translations/i18n_zh.ts
deleted file mode 100644
index 3b715470a8..0000000000
--- a/examples/widgets/tools/i18n/translations/i18n_zh.ts
+++ /dev/null
@@ -1,57 +0,0 @@
-<!DOCTYPE TS><TS>
-<context>
- <name>MainWindow</name>
- <message>
- <source>View</source>
- <translation>视图</translation>
- </message>
- <message>
- <source>&amp;File</source>
- <translation>文件[&amp;F]</translation>
- </message>
- <message>
- <source>E&amp;xit</source>
- <translation>退出[&amp;x]</translation>
- </message>
- <message>
- <source>First</source>
- <translation>第一个</translation>
- </message>
- <message>
- <source>Third</source>
- <translation>第三个</translation>
- </message>
- <message>
- <source>Language: %1</source>
- <translation>语言: %1</translation>
- </message>
- <message>
- <source>English</source>
- <translation>简体中文</translation>
- </message>
- <message>
- <source>Oblique</source>
- <translation>斜投影</translation>
- </message>
- <message>
- <source>Second</source>
- <translation>第二个</translation>
- </message>
- <message>
- <source>Isometric</source>
- <translation>等角投影</translation>
- </message>
- <message>
- <source>Perspective</source>
- <translation>透视投影</translation>
- </message>
- <message>
- <source>Internationalization Example</source>
- <translation>国际化范例</translation>
- </message>
- <message>
- <source>LTR</source>
- <translation>LTR</translation>
- </message>
-</context>
-</TS>
diff --git a/examples/widgets/tools/plugandpaint/CMakeLists.txt b/examples/widgets/tools/plugandpaint/CMakeLists.txt
index af5846a2a6..61b7ad728e 100644
--- a/examples/widgets/tools/plugandpaint/CMakeLists.txt
+++ b/examples/widgets/tools/plugandpaint/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(plugandpaint LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,5 +12,7 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/tools/plugandpaint")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
add_subdirectory(plugins)
add_subdirectory(app)
diff --git a/examples/widgets/tools/plugandpaint/app/CMakeLists.txt b/examples/widgets/tools/plugandpaint/app/CMakeLists.txt
index 5c4ec8228b..5ab3171284 100644
--- a/examples/widgets/tools/plugandpaint/app/CMakeLists.txt
+++ b/examples/widgets/tools/plugandpaint/app/CMakeLists.txt
@@ -1,5 +1,5 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
qt_add_executable(plugandpaint
interfaces.h
@@ -15,7 +15,7 @@ set_target_properties(plugandpaint PROPERTIES
)
target_link_libraries(plugandpaint PRIVATE
- Qt::Widgets
+ Qt6::Widgets
pnp_basictools
)
diff --git a/examples/widgets/tools/plugandpaint/plugins/basictools/CMakeLists.txt b/examples/widgets/tools/plugandpaint/plugins/basictools/CMakeLists.txt
index 59b9fe6050..77bb2fd1c2 100644
--- a/examples/widgets/tools/plugandpaint/plugins/basictools/CMakeLists.txt
+++ b/examples/widgets/tools/plugandpaint/plugins/basictools/CMakeLists.txt
@@ -1,5 +1,5 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
qt_add_plugin(pnp_basictools
STATIC
@@ -12,7 +12,7 @@ target_include_directories(pnp_basictools PUBLIC
)
target_link_libraries(pnp_basictools PRIVATE
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
diff --git a/examples/widgets/tools/plugandpaint/plugins/extrafilters/CMakeLists.txt b/examples/widgets/tools/plugandpaint/plugins/extrafilters/CMakeLists.txt
index de810305f5..6568de9bee 100644
--- a/examples/widgets/tools/plugandpaint/plugins/extrafilters/CMakeLists.txt
+++ b/examples/widgets/tools/plugandpaint/plugins/extrafilters/CMakeLists.txt
@@ -1,5 +1,5 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
qt_add_plugin(pnp_extrafilters
CLASS_NAME ExtraFiltersPlugin
@@ -15,9 +15,9 @@ target_include_directories(pnp_extrafilters PUBLIC
)
target_link_libraries(pnp_extrafilters PRIVATE
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
install(TARGETS pnp_extrafilters
diff --git a/examples/widgets/tools/regularexpression/CMakeLists.txt b/examples/widgets/tools/regularexpression/CMakeLists.txt
index b4a687f127..03a095ad6b 100644
--- a/examples/widgets/tools/regularexpression/CMakeLists.txt
+++ b/examples/widgets/tools/regularexpression/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(regularexpression LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/tools/regularexpression")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(regularexpression
main.cpp
regularexpressiondialog.cpp regularexpressiondialog.h
@@ -25,9 +25,9 @@ set_target_properties(regularexpression PROPERTIES
)
target_link_libraries(regularexpression PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
# Resources:
diff --git a/examples/widgets/tools/settingseditor/CMakeLists.txt b/examples/widgets/tools/settingseditor/CMakeLists.txt
index 8d774bfe47..652111c8f1 100644
--- a/examples/widgets/tools/settingseditor/CMakeLists.txt
+++ b/examples/widgets/tools/settingseditor/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(settingseditor LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/tools/settingseditor")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(settingseditor
locationdialog.cpp locationdialog.h
main.cpp
@@ -28,9 +28,9 @@ set_target_properties(settingseditor PROPERTIES
)
target_link_libraries(settingseditor PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
install(TARGETS settingseditor
diff --git a/examples/widgets/tools/styleplugin/CMakeLists.txt b/examples/widgets/tools/styleplugin/CMakeLists.txt
index 997f4f7161..7e46a7b2af 100644
--- a/examples/widgets/tools/styleplugin/CMakeLists.txt
+++ b/examples/widgets/tools/styleplugin/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(styleplugin LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,5 +12,7 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/tools/styleplugin")
find_package(Qt6 REQUIRED COMPONENTS Widgets)
+qt_standard_project_setup()
+
add_subdirectory(stylewindow)
add_subdirectory(plugin)
diff --git a/examples/widgets/tools/styleplugin/plugin/CMakeLists.txt b/examples/widgets/tools/styleplugin/plugin/CMakeLists.txt
index 90c43d5133..41df10c578 100644
--- a/examples/widgets/tools/styleplugin/plugin/CMakeLists.txt
+++ b/examples/widgets/tools/styleplugin/plugin/CMakeLists.txt
@@ -1,5 +1,5 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
qt_add_plugin(simplestyleplugin
CLASS_NAME SimpleStylePlugin
@@ -12,9 +12,9 @@ set_target_properties(simplestyleplugin PROPERTIES
)
target_link_libraries(simplestyleplugin PRIVATE
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
install(TARGETS simplestyleplugin
diff --git a/examples/widgets/tools/styleplugin/stylewindow/CMakeLists.txt b/examples/widgets/tools/styleplugin/stylewindow/CMakeLists.txt
index 9dd0b957a7..3c1ac7670f 100644
--- a/examples/widgets/tools/styleplugin/stylewindow/CMakeLists.txt
+++ b/examples/widgets/tools/styleplugin/stylewindow/CMakeLists.txt
@@ -1,5 +1,5 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
qt_add_executable(styleplugin
main.cpp
@@ -12,9 +12,9 @@ set_target_properties(styleplugin PROPERTIES
)
target_link_libraries(styleplugin PRIVATE
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
if(NOT QT6_IS_SHARED_LIBS_BUILD)
diff --git a/examples/widgets/tools/tools.pro b/examples/widgets/tools/tools.pro
index d2a02deb6b..cd8035336e 100644
--- a/examples/widgets/tools/tools.pro
+++ b/examples/widgets/tools/tools.pro
@@ -3,7 +3,6 @@ SUBDIRS = \
completer \
customcompleter \
echoplugin \
- i18n \
plugandpaint \
regularexpression \
settingseditor \
@@ -12,8 +11,6 @@ SUBDIRS = \
undo \
undoframework
-contains(DEFINES, QT_NO_TRANSLATION): SUBDIRS -= i18n
-
!qtConfig(library) {
SUBDIRS -= \
echoplugin \
diff --git a/examples/widgets/tools/treemodelcompleter/CMakeLists.txt b/examples/widgets/tools/treemodelcompleter/CMakeLists.txt
index 78c62fc07e..36ab9a5ebb 100644
--- a/examples/widgets/tools/treemodelcompleter/CMakeLists.txt
+++ b/examples/widgets/tools/treemodelcompleter/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(treemodelcompleter LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/tools/treemodelcompleter"
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(treemodelcompleter
main.cpp
mainwindow.cpp mainwindow.h
@@ -26,9 +26,9 @@ set_target_properties(treemodelcompleter PROPERTIES
)
target_link_libraries(treemodelcompleter PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
# Resources:
diff --git a/examples/widgets/tools/undo/CMakeLists.txt b/examples/widgets/tools/undo/CMakeLists.txt
index 451accbc8c..4a925ba006 100644
--- a/examples/widgets/tools/undo/CMakeLists.txt
+++ b/examples/widgets/tools/undo/CMakeLists.txt
@@ -1,14 +1,11 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(undo LANGUAGES CXX)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
-set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTOUIC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -17,6 +14,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/tools/undo")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(undo
commands.cpp commands.h
document.cpp document.h
@@ -30,9 +29,9 @@ set_target_properties(undo PROPERTIES
)
target_link_libraries(undo PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
# Resources:
diff --git a/examples/widgets/tools/undoframework/CMakeLists.txt b/examples/widgets/tools/undoframework/CMakeLists.txt
index cdf9638e8f..1d6d59e39b 100644
--- a/examples/widgets/tools/undoframework/CMakeLists.txt
+++ b/examples/widgets/tools/undoframework/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(undoframework LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/tools/undoframework")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(undoframework
commands.cpp commands.h
diagramitem.cpp diagramitem.h
@@ -28,9 +28,9 @@ set_target_properties(undoframework PROPERTIES
)
target_link_libraries(undoframework PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
# Resources:
diff --git a/examples/widgets/touch/CMakeLists.txt b/examples/widgets/touch/CMakeLists.txt
index 6980aa74b7..4cf7878963 100644
--- a/examples/widgets/touch/CMakeLists.txt
+++ b/examples/widgets/touch/CMakeLists.txt
@@ -1,7 +1,7 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
-if(NOT TARGET Qt::Widgets)
+if(NOT TARGET Qt6::Widgets)
return()
endif()
qt_internal_add_example(pinchzoom)
diff --git a/examples/widgets/touch/dials/CMakeLists.txt b/examples/widgets/touch/dials/CMakeLists.txt
index 2a7de18a2e..ff81297a88 100644
--- a/examples/widgets/touch/dials/CMakeLists.txt
+++ b/examples/widgets/touch/dials/CMakeLists.txt
@@ -1,12 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(dials LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTOUIC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -15,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/touch/dials")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(dials
dials.ui
main.cpp
@@ -26,9 +25,9 @@ set_target_properties(dials PROPERTIES
)
target_link_libraries(dials PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
install(TARGETS dials
diff --git a/examples/widgets/touch/fingerpaint/CMakeLists.txt b/examples/widgets/touch/fingerpaint/CMakeLists.txt
index 8bdbb6c1e4..77467ea1aa 100644
--- a/examples/widgets/touch/fingerpaint/CMakeLists.txt
+++ b/examples/widgets/touch/fingerpaint/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(fingerpaint LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -17,6 +15,8 @@ find_package(Qt6
OPTIONAL_COMPONENTS PrintSupport
)
+qt_standard_project_setup()
+
qt_add_executable(fingerpaint
main.cpp
mainwindow.cpp mainwindow.h
@@ -29,18 +29,18 @@ set_target_properties(fingerpaint PROPERTIES
)
target_link_libraries(fingerpaint PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
-if (TARGET Qt::PrintSupport)
- target_link_libraries(fingerpaint PUBLIC Qt::PrintSupport)
+if (TARGET Qt6::PrintSupport)
+ target_link_libraries(fingerpaint PUBLIC Qt6::PrintSupport)
endif()
-if(TARGET Qt::PrintSupport)
+if(TARGET Qt6::PrintSupport)
target_link_libraries(fingerpaint PUBLIC
- Qt::PrintSupport
+ Qt6::PrintSupport
)
endif()
diff --git a/examples/widgets/touch/knobs/CMakeLists.txt b/examples/widgets/touch/knobs/CMakeLists.txt
index 92c4ef2eaf..ac630253b6 100644
--- a/examples/widgets/touch/knobs/CMakeLists.txt
+++ b/examples/widgets/touch/knobs/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(knobs LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/touch/knobs")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(knobs
knob.cpp knob.h
main.cpp
@@ -25,9 +25,9 @@ set_target_properties(knobs PROPERTIES
)
target_link_libraries(knobs PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
install(TARGETS knobs
diff --git a/examples/widgets/touch/pinchzoom/CMakeLists.txt b/examples/widgets/touch/pinchzoom/CMakeLists.txt
index 210a707b43..b4e6e426ba 100644
--- a/examples/widgets/touch/pinchzoom/CMakeLists.txt
+++ b/examples/widgets/touch/pinchzoom/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(pinchzoom LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/touch/pinchzoom")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(pinchzoom
graphicsview.cpp graphicsview.h
main.cpp
@@ -26,9 +26,9 @@ set_target_properties(pinchzoom PROPERTIES
)
target_link_libraries(pinchzoom PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
# Resources:
diff --git a/examples/widgets/tutorials/CMakeLists.txt b/examples/widgets/tutorials/CMakeLists.txt
index ad4d8897d4..02d196db90 100644
--- a/examples/widgets/tutorials/CMakeLists.txt
+++ b/examples/widgets/tutorials/CMakeLists.txt
@@ -1,5 +1,5 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
add_subdirectory(addressbook)
add_subdirectory(widgets)
diff --git a/examples/widgets/tutorials/addressbook/CMakeLists.txt b/examples/widgets/tutorials/addressbook/CMakeLists.txt
index 066a323d61..c33e586df9 100644
--- a/examples/widgets/tutorials/addressbook/CMakeLists.txt
+++ b/examples/widgets/tutorials/addressbook/CMakeLists.txt
@@ -1,5 +1,5 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
qt_internal_add_example(part1)
qt_internal_add_example(part2)
diff --git a/examples/widgets/tutorials/addressbook/part1/CMakeLists.txt b/examples/widgets/tutorials/addressbook/part1/CMakeLists.txt
index e924eed9de..8a3791e65a 100644
--- a/examples/widgets/tutorials/addressbook/part1/CMakeLists.txt
+++ b/examples/widgets/tutorials/addressbook/part1/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(part1 LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/tutorials/addressbook/par
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(part1
addressbook.cpp addressbook.h
main.cpp
@@ -25,9 +25,9 @@ set_target_properties(part1 PROPERTIES
)
target_link_libraries(part1 PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
install(TARGETS part1
diff --git a/examples/widgets/tutorials/addressbook/part2/CMakeLists.txt b/examples/widgets/tutorials/addressbook/part2/CMakeLists.txt
index e7b06202fd..934e1265e4 100644
--- a/examples/widgets/tutorials/addressbook/part2/CMakeLists.txt
+++ b/examples/widgets/tutorials/addressbook/part2/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(part2 LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/tutorials/addressbook/par
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(part2
addressbook.cpp addressbook.h
main.cpp
@@ -25,9 +25,9 @@ set_target_properties(part2 PROPERTIES
)
target_link_libraries(part2 PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
install(TARGETS part2
diff --git a/examples/widgets/tutorials/addressbook/part3/CMakeLists.txt b/examples/widgets/tutorials/addressbook/part3/CMakeLists.txt
index 52d11cac41..c8a4a9c207 100644
--- a/examples/widgets/tutorials/addressbook/part3/CMakeLists.txt
+++ b/examples/widgets/tutorials/addressbook/part3/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(part3 LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/tutorials/addressbook/par
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(part3
addressbook.cpp addressbook.h
main.cpp
@@ -25,9 +25,9 @@ set_target_properties(part3 PROPERTIES
)
target_link_libraries(part3 PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
install(TARGETS part3
diff --git a/examples/widgets/tutorials/addressbook/part4/CMakeLists.txt b/examples/widgets/tutorials/addressbook/part4/CMakeLists.txt
index c26ab21244..5fe21cd692 100644
--- a/examples/widgets/tutorials/addressbook/part4/CMakeLists.txt
+++ b/examples/widgets/tutorials/addressbook/part4/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(part4 LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/tutorials/addressbook/par
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(part4
addressbook.cpp addressbook.h
main.cpp
@@ -25,9 +25,9 @@ set_target_properties(part4 PROPERTIES
)
target_link_libraries(part4 PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
install(TARGETS part4
diff --git a/examples/widgets/tutorials/addressbook/part5/CMakeLists.txt b/examples/widgets/tutorials/addressbook/part5/CMakeLists.txt
index 56e65c4d6c..4670f63f5a 100644
--- a/examples/widgets/tutorials/addressbook/part5/CMakeLists.txt
+++ b/examples/widgets/tutorials/addressbook/part5/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(part5 LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/tutorials/addressbook/par
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(part5
addressbook.cpp addressbook.h
finddialog.cpp finddialog.h
@@ -26,9 +26,9 @@ set_target_properties(part5 PROPERTIES
)
target_link_libraries(part5 PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
install(TARGETS part5
diff --git a/examples/widgets/tutorials/addressbook/part6/CMakeLists.txt b/examples/widgets/tutorials/addressbook/part6/CMakeLists.txt
index c3c58d5525..1b61157328 100644
--- a/examples/widgets/tutorials/addressbook/part6/CMakeLists.txt
+++ b/examples/widgets/tutorials/addressbook/part6/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(part6 LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/tutorials/addressbook/par
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(part6
addressbook.cpp addressbook.h
finddialog.cpp finddialog.h
@@ -26,9 +26,9 @@ set_target_properties(part6 PROPERTIES
)
target_link_libraries(part6 PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
install(TARGETS part6
diff --git a/examples/widgets/tutorials/addressbook/part7/CMakeLists.txt b/examples/widgets/tutorials/addressbook/part7/CMakeLists.txt
index 30ed95781b..e68ae1b445 100644
--- a/examples/widgets/tutorials/addressbook/part7/CMakeLists.txt
+++ b/examples/widgets/tutorials/addressbook/part7/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(part7 LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/tutorials/addressbook/par
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(part7
addressbook.cpp addressbook.h
finddialog.cpp finddialog.h
@@ -26,9 +26,9 @@ set_target_properties(part7 PROPERTIES
)
target_link_libraries(part7 PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
install(TARGETS part7
diff --git a/examples/widgets/tutorials/gettingStarted/gsQt/CMakeLists.txt b/examples/widgets/tutorials/gettingStarted/gsQt/CMakeLists.txt
index f10b452531..a0fd350393 100644
--- a/examples/widgets/tutorials/gettingStarted/gsQt/CMakeLists.txt
+++ b/examples/widgets/tutorials/gettingStarted/gsQt/CMakeLists.txt
@@ -1,5 +1,5 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
qt_internal_add_example(part1)
qt_internal_add_example(part2)
diff --git a/examples/widgets/tutorials/gettingStarted/gsQt/part1/CMakeLists.txt b/examples/widgets/tutorials/gettingStarted/gsQt/part1/CMakeLists.txt
index fcc7c3f49b..dcc437d3c9 100644
--- a/examples/widgets/tutorials/gettingStarted/gsQt/part1/CMakeLists.txt
+++ b/examples/widgets/tutorials/gettingStarted/gsQt/part1/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(getting_started_part1 LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/tutorials/gettingStarted/
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(getting_started_part1
main.cpp
)
@@ -24,9 +24,9 @@ set_target_properties(getting_started_part1 PROPERTIES
)
target_link_libraries(getting_started_part1 PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
install(TARGETS getting_started_part1
diff --git a/examples/widgets/tutorials/gettingStarted/gsQt/part2/CMakeLists.txt b/examples/widgets/tutorials/gettingStarted/gsQt/part2/CMakeLists.txt
index 2c3372072a..dbb33ca418 100644
--- a/examples/widgets/tutorials/gettingStarted/gsQt/part2/CMakeLists.txt
+++ b/examples/widgets/tutorials/gettingStarted/gsQt/part2/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(getting_started_part2 LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/tutorials/gettingStarted/
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(getting_started_part2
main.cpp
)
@@ -24,9 +24,9 @@ set_target_properties(getting_started_part2 PROPERTIES
)
target_link_libraries(getting_started_part2 PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
install(TARGETS getting_started_part2
diff --git a/examples/widgets/tutorials/gettingStarted/gsQt/part3/CMakeLists.txt b/examples/widgets/tutorials/gettingStarted/gsQt/part3/CMakeLists.txt
index 07324a4547..5851e5a365 100644
--- a/examples/widgets/tutorials/gettingStarted/gsQt/part3/CMakeLists.txt
+++ b/examples/widgets/tutorials/gettingStarted/gsQt/part3/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(getting_started_part3 LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/tutorials/gettingStarted/
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(getting_started_part3
main.cpp
)
@@ -24,9 +24,9 @@ set_target_properties(getting_started_part3 PROPERTIES
)
target_link_libraries(getting_started_part3 PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
install(TARGETS getting_started_part3
diff --git a/examples/widgets/tutorials/gettingStarted/gsQt/part4/CMakeLists.txt b/examples/widgets/tutorials/gettingStarted/gsQt/part4/CMakeLists.txt
index b99f40085e..5a7979e9bc 100644
--- a/examples/widgets/tutorials/gettingStarted/gsQt/part4/CMakeLists.txt
+++ b/examples/widgets/tutorials/gettingStarted/gsQt/part4/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(getting_started_part4 LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/tutorials/gettingStarted/
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(getting_started_part4
main.cpp
)
@@ -24,9 +24,9 @@ set_target_properties(getting_started_part4 PROPERTIES
)
target_link_libraries(getting_started_part4 PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
install(TARGETS getting_started_part4
diff --git a/examples/widgets/tutorials/gettingStarted/gsQt/part5/CMakeLists.txt b/examples/widgets/tutorials/gettingStarted/gsQt/part5/CMakeLists.txt
index a55663543d..d2dd23410c 100644
--- a/examples/widgets/tutorials/gettingStarted/gsQt/part5/CMakeLists.txt
+++ b/examples/widgets/tutorials/gettingStarted/gsQt/part5/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(getting_started_part5 LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/tutorials/gettingStarted/
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(getting_started_part5
main.cpp
)
@@ -24,9 +24,9 @@ set_target_properties(getting_started_part5 PROPERTIES
)
target_link_libraries(getting_started_part5 PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
install(TARGETS getting_started_part5
diff --git a/examples/widgets/tutorials/modelview/1_readonly/CMakeLists.txt b/examples/widgets/tutorials/modelview/1_readonly/CMakeLists.txt
index aaabefb13d..880ad6f45c 100644
--- a/examples/widgets/tutorials/modelview/1_readonly/CMakeLists.txt
+++ b/examples/widgets/tutorials/modelview/1_readonly/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(mv_readonly LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/tutorials/modelview/1_rea
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(mv_readonly
main.cpp
mymodel.cpp mymodel.h
@@ -25,9 +25,9 @@ set_target_properties(mv_readonly PROPERTIES
)
target_link_libraries(mv_readonly PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
install(TARGETS mv_readonly
diff --git a/examples/widgets/tutorials/modelview/2_formatting/CMakeLists.txt b/examples/widgets/tutorials/modelview/2_formatting/CMakeLists.txt
index dde4507a51..cec89b3723 100644
--- a/examples/widgets/tutorials/modelview/2_formatting/CMakeLists.txt
+++ b/examples/widgets/tutorials/modelview/2_formatting/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(mv_formatting LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/tutorials/modelview/2_for
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(mv_formatting
main.cpp
mymodel.cpp mymodel.h
@@ -25,9 +25,9 @@ set_target_properties(mv_formatting PROPERTIES
)
target_link_libraries(mv_formatting PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
install(TARGETS mv_formatting
diff --git a/examples/widgets/tutorials/modelview/3_changingmodel/CMakeLists.txt b/examples/widgets/tutorials/modelview/3_changingmodel/CMakeLists.txt
index 848bcda5ed..e314ad20e2 100644
--- a/examples/widgets/tutorials/modelview/3_changingmodel/CMakeLists.txt
+++ b/examples/widgets/tutorials/modelview/3_changingmodel/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(mv_changingmodel LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/tutorials/modelview/3_cha
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(mv_changingmodel
main.cpp
mymodel.cpp mymodel.h
@@ -25,9 +25,9 @@ set_target_properties(mv_changingmodel PROPERTIES
)
target_link_libraries(mv_changingmodel PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
install(TARGETS mv_changingmodel
diff --git a/examples/widgets/tutorials/modelview/4_headers/CMakeLists.txt b/examples/widgets/tutorials/modelview/4_headers/CMakeLists.txt
index 36b37115db..01535cefb1 100644
--- a/examples/widgets/tutorials/modelview/4_headers/CMakeLists.txt
+++ b/examples/widgets/tutorials/modelview/4_headers/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(mv_headers LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/tutorials/modelview/4_hea
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(mv_headers
main.cpp
mymodel.cpp mymodel.h
@@ -25,9 +25,9 @@ set_target_properties(mv_headers PROPERTIES
)
target_link_libraries(mv_headers PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
install(TARGETS mv_headers
diff --git a/examples/widgets/tutorials/modelview/5_edit/CMakeLists.txt b/examples/widgets/tutorials/modelview/5_edit/CMakeLists.txt
index 8ee877fde5..17c6c057e7 100644
--- a/examples/widgets/tutorials/modelview/5_edit/CMakeLists.txt
+++ b/examples/widgets/tutorials/modelview/5_edit/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(mv_edit LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/tutorials/modelview/5_edi
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(mv_edit
main.cpp
mainwindow.cpp mainwindow.h
@@ -26,9 +26,9 @@ set_target_properties(mv_edit PROPERTIES
)
target_link_libraries(mv_edit PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
install(TARGETS mv_edit
diff --git a/examples/widgets/tutorials/modelview/6_treeview/CMakeLists.txt b/examples/widgets/tutorials/modelview/6_treeview/CMakeLists.txt
index 4616fd557b..ac1527263c 100644
--- a/examples/widgets/tutorials/modelview/6_treeview/CMakeLists.txt
+++ b/examples/widgets/tutorials/modelview/6_treeview/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(mv_tree LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/tutorials/modelview/6_tre
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(mv_tree
main.cpp
mainwindow.cpp mainwindow.h
@@ -25,9 +25,9 @@ set_target_properties(mv_tree PROPERTIES
)
target_link_libraries(mv_tree PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
install(TARGETS mv_tree
diff --git a/examples/widgets/tutorials/modelview/7_selections/CMakeLists.txt b/examples/widgets/tutorials/modelview/7_selections/CMakeLists.txt
index 9946db73f7..66d69cd8da 100644
--- a/examples/widgets/tutorials/modelview/7_selections/CMakeLists.txt
+++ b/examples/widgets/tutorials/modelview/7_selections/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(mv_selections LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/tutorials/modelview/7_sel
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(mv_selections
main.cpp
mainwindow.cpp mainwindow.h
@@ -25,9 +25,9 @@ set_target_properties(mv_selections PROPERTIES
)
target_link_libraries(mv_selections PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
install(TARGETS mv_selections
diff --git a/examples/widgets/tutorials/modelview/CMakeLists.txt b/examples/widgets/tutorials/modelview/CMakeLists.txt
index cbf36834cb..feaacbcc2d 100644
--- a/examples/widgets/tutorials/modelview/CMakeLists.txt
+++ b/examples/widgets/tutorials/modelview/CMakeLists.txt
@@ -1,5 +1,5 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
qt_internal_add_example(1_readonly)
qt_internal_add_example(2_formatting)
diff --git a/examples/widgets/tutorials/notepad/CMakeLists.txt b/examples/widgets/tutorials/notepad/CMakeLists.txt
index a928f689e5..a334176b9a 100644
--- a/examples/widgets/tutorials/notepad/CMakeLists.txt
+++ b/examples/widgets/tutorials/notepad/CMakeLists.txt
@@ -1,12 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(notepad LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTOUIC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -18,6 +15,8 @@ find_package(Qt6
OPTIONAL_COMPONENTS PrintSupport
)
+qt_standard_project_setup()
+
qt_add_executable(notepad
main.cpp
notepad.cpp notepad.h notepad.ui
@@ -29,9 +28,9 @@ set_target_properties(notepad PROPERTIES
)
target_link_libraries(notepad PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
# Resources:
@@ -63,9 +62,9 @@ qt_add_resources(notepad "notepad"
${notepad_resource_files}
)
-if(TARGET Qt::PrintSupport)
+if(TARGET Qt6::PrintSupport)
target_link_libraries(notepad PUBLIC
- Qt::PrintSupport
+ Qt6::PrintSupport
)
endif()
diff --git a/examples/widgets/tutorials/widgets/CMakeLists.txt b/examples/widgets/tutorials/widgets/CMakeLists.txt
index 40590745a9..6e8d3fa3e4 100644
--- a/examples/widgets/tutorials/widgets/CMakeLists.txt
+++ b/examples/widgets/tutorials/widgets/CMakeLists.txt
@@ -1,5 +1,5 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
qt_internal_add_example(toplevel)
qt_internal_add_example(childwidget)
diff --git a/examples/widgets/tutorials/widgets/childwidget/CMakeLists.txt b/examples/widgets/tutorials/widgets/childwidget/CMakeLists.txt
index e152d837dd..0754d0d112 100644
--- a/examples/widgets/tutorials/widgets/childwidget/CMakeLists.txt
+++ b/examples/widgets/tutorials/widgets/childwidget/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(childwidget LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/tutorials/widgets/childwi
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(childwidget
main.cpp
)
@@ -24,9 +24,9 @@ set_target_properties(childwidget PROPERTIES
)
target_link_libraries(childwidget PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
install(TARGETS childwidget
diff --git a/examples/widgets/tutorials/widgets/nestedlayouts/CMakeLists.txt b/examples/widgets/tutorials/widgets/nestedlayouts/CMakeLists.txt
index 2ad6438790..ff8c0ac9ac 100644
--- a/examples/widgets/tutorials/widgets/nestedlayouts/CMakeLists.txt
+++ b/examples/widgets/tutorials/widgets/nestedlayouts/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(nestedlayouts LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/tutorials/widgets/nestedl
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(nestedlayouts
main.cpp
)
@@ -24,9 +24,9 @@ set_target_properties(nestedlayouts PROPERTIES
)
target_link_libraries(nestedlayouts PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
install(TARGETS nestedlayouts
diff --git a/examples/widgets/tutorials/widgets/toplevel/CMakeLists.txt b/examples/widgets/tutorials/widgets/toplevel/CMakeLists.txt
index c6db7a951f..41b9fca42c 100644
--- a/examples/widgets/tutorials/widgets/toplevel/CMakeLists.txt
+++ b/examples/widgets/tutorials/widgets/toplevel/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(toplevel LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/tutorials/widgets/topleve
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(toplevel
main.cpp
)
@@ -24,9 +24,9 @@ set_target_properties(toplevel PROPERTIES
)
target_link_libraries(toplevel PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
install(TARGETS toplevel
diff --git a/examples/widgets/tutorials/widgets/windowlayout/CMakeLists.txt b/examples/widgets/tutorials/widgets/windowlayout/CMakeLists.txt
index 71a83a2f48..065a43c7db 100644
--- a/examples/widgets/tutorials/widgets/windowlayout/CMakeLists.txt
+++ b/examples/widgets/tutorials/widgets/windowlayout/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(windowlayout LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/tutorials/widgets/windowl
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(windowlayout
main.cpp
)
@@ -24,9 +24,9 @@ set_target_properties(windowlayout PROPERTIES
)
target_link_libraries(windowlayout PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
install(TARGETS windowlayout
diff --git a/examples/widgets/widgets/CMakeLists.txt b/examples/widgets/widgets/CMakeLists.txt
index 8034bc2e30..35118b984d 100644
--- a/examples/widgets/widgets/CMakeLists.txt
+++ b/examples/widgets/widgets/CMakeLists.txt
@@ -1,5 +1,5 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
qt_internal_add_example(analogclock)
qt_internal_add_example(calculator)
@@ -18,6 +18,7 @@ endif()
qt_internal_add_example(mousebuttons)
qt_internal_add_example(scribble)
qt_internal_add_example(shapedclock)
+qt_internal_add_example(shortcuteditor)
qt_internal_add_example(sliders)
qt_internal_add_example(spinboxes)
qt_internal_add_example(styles)
diff --git a/examples/widgets/widgets/analogclock/CMakeLists.txt b/examples/widgets/widgets/analogclock/CMakeLists.txt
index f1ca5520cd..7033b8bc0e 100644
--- a/examples/widgets/widgets/analogclock/CMakeLists.txt
+++ b/examples/widgets/widgets/analogclock/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(analogclock LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/widgets/analogclock")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(analogclock
analogclock.cpp analogclock.h
main.cpp
@@ -25,9 +25,9 @@ set_target_properties(analogclock PROPERTIES
)
target_link_libraries(analogclock PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
install(TARGETS analogclock
diff --git a/examples/widgets/widgets/calculator/CMakeLists.txt b/examples/widgets/widgets/calculator/CMakeLists.txt
index c07e756243..280438d574 100644
--- a/examples/widgets/widgets/calculator/CMakeLists.txt
+++ b/examples/widgets/widgets/calculator/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(calculator LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/widgets/calculator")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(calculator
button.cpp button.h
calculator.cpp calculator.h
@@ -26,9 +26,9 @@ set_target_properties(calculator PROPERTIES
)
target_link_libraries(calculator PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
install(TARGETS calculator
diff --git a/examples/widgets/widgets/calendarwidget/CMakeLists.txt b/examples/widgets/widgets/calendarwidget/CMakeLists.txt
index 18c38f44db..6ed5744ebc 100644
--- a/examples/widgets/widgets/calendarwidget/CMakeLists.txt
+++ b/examples/widgets/widgets/calendarwidget/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(calendarwidget LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/widgets/calendarwidget")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(calendarwidget
main.cpp
window.cpp window.h
@@ -25,9 +25,9 @@ set_target_properties(calendarwidget PROPERTIES
)
target_link_libraries(calendarwidget PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
install(TARGETS calendarwidget
diff --git a/examples/widgets/widgets/charactermap/CMakeLists.txt b/examples/widgets/widgets/charactermap/CMakeLists.txt
index 0c3defdf40..d14cdb983c 100644
--- a/examples/widgets/widgets/charactermap/CMakeLists.txt
+++ b/examples/widgets/widgets/charactermap/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(charactermap LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/widgets/charactermap")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(charactermap
characterwidget.cpp characterwidget.h
main.cpp
@@ -26,9 +26,9 @@ set_target_properties(charactermap PROPERTIES
)
target_link_libraries(charactermap PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
install(TARGETS charactermap
diff --git a/examples/widgets/widgets/codeeditor/CMakeLists.txt b/examples/widgets/widgets/codeeditor/CMakeLists.txt
index f7e120640c..6aa8ce0f00 100644
--- a/examples/widgets/widgets/codeeditor/CMakeLists.txt
+++ b/examples/widgets/widgets/codeeditor/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(codeeditor LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/widgets/codeeditor")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(codeeditor
codeeditor.cpp codeeditor.h
main.cpp
@@ -25,9 +25,9 @@ set_target_properties(codeeditor PROPERTIES
)
target_link_libraries(codeeditor PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
install(TARGETS codeeditor
diff --git a/examples/widgets/widgets/digitalclock/CMakeLists.txt b/examples/widgets/widgets/digitalclock/CMakeLists.txt
index a328b783c7..6b2311319f 100644
--- a/examples/widgets/widgets/digitalclock/CMakeLists.txt
+++ b/examples/widgets/widgets/digitalclock/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(digitalclock LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/widgets/digitalclock")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(digitalclock
digitalclock.cpp digitalclock.h
main.cpp
@@ -25,9 +25,9 @@ set_target_properties(digitalclock PROPERTIES
)
target_link_libraries(digitalclock PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
install(TARGETS digitalclock
diff --git a/examples/widgets/widgets/elidedlabel/CMakeLists.txt b/examples/widgets/widgets/elidedlabel/CMakeLists.txt
index 286a342e1d..135d166728 100644
--- a/examples/widgets/widgets/elidedlabel/CMakeLists.txt
+++ b/examples/widgets/widgets/elidedlabel/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(elidedlabel LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/widgets/elidedlabel")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(elidedlabel
elidedlabel.cpp elidedlabel.h
main.cpp
@@ -26,9 +26,9 @@ set_target_properties(elidedlabel PROPERTIES
)
target_link_libraries(elidedlabel PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
install(TARGETS elidedlabel
diff --git a/examples/widgets/widgets/groupbox/CMakeLists.txt b/examples/widgets/widgets/groupbox/CMakeLists.txt
index 0963d4d7e6..aa6e6cb420 100644
--- a/examples/widgets/widgets/groupbox/CMakeLists.txt
+++ b/examples/widgets/widgets/groupbox/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(groupbox LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/widgets/groupbox")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(groupbox
main.cpp
window.cpp window.h
@@ -25,9 +25,9 @@ set_target_properties(groupbox PROPERTIES
)
target_link_libraries(groupbox PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
install(TARGETS groupbox
diff --git a/examples/widgets/widgets/icons/CMakeLists.txt b/examples/widgets/widgets/icons/CMakeLists.txt
index 7aa902b985..1047fc6757 100644
--- a/examples/widgets/widgets/icons/CMakeLists.txt
+++ b/examples/widgets/widgets/icons/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(icons LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/widgets/icons")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(icons
iconpreviewarea.cpp iconpreviewarea.h
iconsizespinbox.cpp iconsizespinbox.h
@@ -32,9 +32,9 @@ target_compile_definitions(icons PUBLIC
)
target_link_libraries(icons PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
install(TARGETS icons
diff --git a/examples/widgets/widgets/imageviewer/CMakeLists.txt b/examples/widgets/widgets/imageviewer/CMakeLists.txt
index 5680c32774..00e78fcdd5 100644
--- a/examples/widgets/widgets/imageviewer/CMakeLists.txt
+++ b/examples/widgets/widgets/imageviewer/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(imageviewer LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -17,6 +15,8 @@ find_package(Qt6
OPTIONAL_COMPONENTS PrintSupport
)
+qt_standard_project_setup()
+
qt_add_executable(imageviewer
imageviewer.cpp imageviewer.h
main.cpp
@@ -28,18 +28,18 @@ set_target_properties(imageviewer PROPERTIES
)
target_link_libraries(imageviewer PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
-if (TARGET Qt::PrintSupport)
- target_link_libraries(imageviewer PUBLIC Qt::PrintSupport)
+if (TARGET Qt6::PrintSupport)
+ target_link_libraries(imageviewer PUBLIC Qt6::PrintSupport)
endif()
-if(TARGET Qt::PrintSupport)
+if(TARGET Qt6::PrintSupport)
target_link_libraries(imageviewer PUBLIC
- Qt::PrintSupport
+ Qt6::PrintSupport
)
endif()
diff --git a/examples/widgets/widgets/lineedits/CMakeLists.txt b/examples/widgets/widgets/lineedits/CMakeLists.txt
index c494506d97..2ade89ee72 100644
--- a/examples/widgets/widgets/lineedits/CMakeLists.txt
+++ b/examples/widgets/widgets/lineedits/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(lineedits LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/widgets/lineedits")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(lineedits
main.cpp
window.cpp window.h
@@ -25,9 +25,9 @@ set_target_properties(lineedits PROPERTIES
)
target_link_libraries(lineedits PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
install(TARGETS lineedits
diff --git a/examples/widgets/widgets/mousebuttons/CMakeLists.txt b/examples/widgets/widgets/mousebuttons/CMakeLists.txt
index 08192ec3ed..e72075a2aa 100644
--- a/examples/widgets/widgets/mousebuttons/CMakeLists.txt
+++ b/examples/widgets/widgets/mousebuttons/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(mousebuttons LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/widgets/mousebuttons")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(mousebuttons
buttontester.cpp buttontester.h
main.cpp
@@ -25,9 +25,9 @@ set_target_properties(mousebuttons PROPERTIES
)
target_link_libraries(mousebuttons PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
install(TARGETS mousebuttons
diff --git a/examples/widgets/widgets/movie/CMakeLists.txt b/examples/widgets/widgets/movie/CMakeLists.txt
index 82a24daf0a..092eee3d28 100644
--- a/examples/widgets/widgets/movie/CMakeLists.txt
+++ b/examples/widgets/widgets/movie/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(movie LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/widgets/movie")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(movie
main.cpp
movieplayer.cpp movieplayer.h
@@ -25,9 +25,9 @@ set_target_properties(movie PROPERTIES
)
target_link_libraries(movie PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
install(TARGETS movie
diff --git a/examples/widgets/widgets/scribble/CMakeLists.txt b/examples/widgets/widgets/scribble/CMakeLists.txt
index b449059026..506c2a3b7c 100644
--- a/examples/widgets/widgets/scribble/CMakeLists.txt
+++ b/examples/widgets/widgets/scribble/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(scribble LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -17,6 +15,8 @@ find_package(Qt6
OPTIONAL_COMPONENTS PrintSupport
)
+qt_standard_project_setup()
+
qt_add_executable(scribble
main.cpp
mainwindow.cpp mainwindow.h
@@ -29,18 +29,18 @@ set_target_properties(scribble PROPERTIES
)
target_link_libraries(scribble PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
-if (TARGET Qt::PrintSupport)
- target_link_libraries(scribble PUBLIC Qt::PrintSupport)
+if (TARGET Qt6::PrintSupport)
+ target_link_libraries(scribble PUBLIC Qt6::PrintSupport)
endif()
-if(TARGET Qt::PrintSupport)
+if(TARGET Qt6::PrintSupport)
target_link_libraries(scribble PUBLIC
- Qt::PrintSupport
+ Qt6::PrintSupport
)
endif()
diff --git a/examples/widgets/widgets/scribble/mainwindow.cpp b/examples/widgets/widgets/scribble/mainwindow.cpp
index b7e08598f7..0a0a658265 100644
--- a/examples/widgets/widgets/scribble/mainwindow.cpp
+++ b/examples/widgets/widgets/scribble/mainwindow.cpp
@@ -153,7 +153,7 @@ void MainWindow::createMenus()
//! [15] //! [16]
{
saveAsMenu = new QMenu(tr("&Save As"), this);
- for (QAction *action : qAsConst(saveAsActs))
+ for (QAction *action : std::as_const(saveAsActs))
saveAsMenu->addAction(action);
fileMenu = new QMenu(tr("&File"), this);
diff --git a/examples/widgets/widgets/shapedclock/CMakeLists.txt b/examples/widgets/widgets/shapedclock/CMakeLists.txt
index 344c18fc6c..9f77bb6a63 100644
--- a/examples/widgets/widgets/shapedclock/CMakeLists.txt
+++ b/examples/widgets/widgets/shapedclock/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(shapedclock LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/widgets/shapedclock")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(shapedclock
main.cpp
shapedclock.cpp shapedclock.h
@@ -25,9 +25,9 @@ set_target_properties(shapedclock PROPERTIES
)
target_link_libraries(shapedclock PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
install(TARGETS shapedclock
diff --git a/examples/widgets/widgets/shortcuteditor/CMakeLists.txt b/examples/widgets/widgets/shortcuteditor/CMakeLists.txt
new file mode 100644
index 0000000000..8d063cd59a
--- /dev/null
+++ b/examples/widgets/widgets/shortcuteditor/CMakeLists.txt
@@ -0,0 +1,39 @@
+cmake_minimum_required(VERSION 3.16)
+project(shortcuteditor LANGUAGES CXX)
+
+if(NOT DEFINED INSTALL_EXAMPLESDIR)
+ set(INSTALL_EXAMPLESDIR "examples")
+endif()
+
+set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/widgets/shortcuteditor")
+
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+
+qt_standard_project_setup()
+
+qt_add_executable(shortcuteditor
+ actionmanager.cpp actionmanager.h
+ application.cpp application.h
+ main.cpp
+ mainwindow.cpp mainwindow.h
+ shortcuteditordelegate.cpp shortcuteditordelegate.h
+ shortcuteditormodel.cpp shortcuteditormodel.h
+ shortcuteditorwidget.cpp shortcuteditorwidget.h
+)
+
+set_target_properties(shortcuteditor PROPERTIES
+ WIN32_EXECUTABLE TRUE
+ MACOSX_BUNDLE TRUE
+)
+
+target_link_libraries(shortcuteditor PUBLIC
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
+)
+
+install(TARGETS shortcuteditor
+ RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
+ BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
+ LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
+)
diff --git a/examples/widgets/widgets/shortcuteditor/actionmanager.cpp b/examples/widgets/widgets/shortcuteditor/actionmanager.cpp
new file mode 100644
index 0000000000..cfe5f42674
--- /dev/null
+++ b/examples/widgets/widgets/shortcuteditor/actionmanager.cpp
@@ -0,0 +1,57 @@
+// Copyright (C) 2022 Laszlo Papp <lpapp@kde.org>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+#include "actionmanager.h"
+
+#include <QAction>
+#include <QApplication>
+#include <QString>
+#include <QVariant>
+
+static const char *kDefaultShortcutPropertyName = "defaultShortcuts";
+static const char *kIdPropertyName = "id";
+static const char *kAuthorName = "qt";
+
+struct ActionIdentifier {
+ QString author;
+ QString context;
+ QString category;
+ QString name;
+};
+
+QList<QAction *> ActionManager::registeredActions() const
+{
+ return m_actions;
+}
+
+void ActionManager::registerAction(QAction *action)
+{
+ action->setProperty(kDefaultShortcutPropertyName, QVariant::fromValue(action->shortcut()));
+ m_actions.append(action);
+}
+
+void ActionManager::registerAction(QAction *action, const QString &context, const QString &category)
+{
+ action->setProperty(kIdPropertyName, QVariant::fromValue(ActionIdentifier{
+ kAuthorName, context, category, action->text()
+ }));
+ registerAction(action);
+}
+
+QAction *ActionManager::registerAction(const QString &name, const QString &shortcut, const QString &context, const QString &category)
+{
+ QAction *action = new QAction(name, qApp);
+ action->setShortcut(QKeySequence(shortcut));
+ registerAction(action, context, category);
+ return action;
+}
+
+QString ActionManager::contextForAction(QAction *action)
+{
+ return action->property(kIdPropertyName).value<ActionIdentifier>().context;
+}
+
+QString ActionManager::categoryForAction(QAction *action)
+{
+ return action->property(kIdPropertyName).value<ActionIdentifier>().category;
+}
diff --git a/examples/widgets/widgets/shortcuteditor/actionmanager.h b/examples/widgets/widgets/shortcuteditor/actionmanager.h
new file mode 100644
index 0000000000..da20cd8840
--- /dev/null
+++ b/examples/widgets/widgets/shortcuteditor/actionmanager.h
@@ -0,0 +1,33 @@
+// Copyright (C) 2022 Laszlo Papp <lpapp@kde.org>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+#ifndef ACTIONMANAGER_H
+#define ACTIONMANAGER_H
+
+#include <QList>
+#include <QString>
+
+QT_BEGIN_NAMESPACE
+class QAction;
+QT_END_NAMESPACE
+
+class ActionManager
+{
+public:
+ ActionManager() = default;
+ ~ActionManager() = default;
+
+ QList<QAction*> registeredActions() const;
+
+ void registerAction(QAction *action);
+ void registerAction(QAction *action, const QString &context, const QString &category);
+ QAction *registerAction(const QString &name, const QString &shortcut, const QString &context, const QString &category);
+
+ QString contextForAction(QAction *action);
+ QString categoryForAction(QAction *action);
+
+private:
+ QList<QAction *> m_actions;
+};
+
+#endif
diff --git a/examples/widgets/widgets/shortcuteditor/application.cpp b/examples/widgets/widgets/shortcuteditor/application.cpp
new file mode 100644
index 0000000000..4ac76682d0
--- /dev/null
+++ b/examples/widgets/widgets/shortcuteditor/application.cpp
@@ -0,0 +1,15 @@
+// Copyright (C) 2022 Laszlo Papp <lpapp@kde.org>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+#include "application.h"
+
+Application::Application(int &argc, char **argv)
+ : QApplication(argc, argv)
+{
+ m_actionManager = std::make_unique<ActionManager>();
+}
+
+ActionManager *Application::actionManager() const
+{
+ return m_actionManager.get();
+}
diff --git a/examples/widgets/widgets/shortcuteditor/application.h b/examples/widgets/widgets/shortcuteditor/application.h
new file mode 100644
index 0000000000..38808c3ad2
--- /dev/null
+++ b/examples/widgets/widgets/shortcuteditor/application.h
@@ -0,0 +1,27 @@
+// Copyright (C) 2022 Laszlo Papp <lpapp@kde.org>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+#ifndef APPLICATION_H
+#define APPLICATION_H
+
+#include "actionmanager.h"
+
+#include <QApplication>
+
+#include <memory>
+
+class Application : public QApplication
+{
+ Q_OBJECT
+
+public:
+ Application(int &argc, char **argv);
+ ~Application() override = default;
+
+ ActionManager *actionManager() const;
+
+private:
+ std::unique_ptr<ActionManager> m_actionManager;
+};
+
+#endif
diff --git a/examples/widgets/widgets/shortcuteditor/main.cpp b/examples/widgets/widgets/shortcuteditor/main.cpp
new file mode 100644
index 0000000000..029f7a351a
--- /dev/null
+++ b/examples/widgets/widgets/shortcuteditor/main.cpp
@@ -0,0 +1,13 @@
+// Copyright (C) 2022 Laszlo Papp <lpapp@kde.org>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+#include "application.h"
+#include "mainwindow.h"
+
+int main(int argc, char *argv[])
+{
+ Application app(argc, argv);
+ MainWindow window;
+ window.show();
+ return app.exec();
+}
diff --git a/examples/widgets/widgets/shortcuteditor/mainwindow.cpp b/examples/widgets/widgets/shortcuteditor/mainwindow.cpp
new file mode 100644
index 0000000000..587dbbc5b5
--- /dev/null
+++ b/examples/widgets/widgets/shortcuteditor/mainwindow.cpp
@@ -0,0 +1,46 @@
+// Copyright (C) 2022 Laszlo Papp <lpapp@kde.org>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+#include "mainwindow.h"
+
+#include "actionmanager.h"
+#include "application.h"
+#include "shortcuteditorwidget.h"
+
+#include <QAction>
+#include <QHBoxLayout>
+#include <QPushButton>
+#include <QVBoxLayout>
+
+MainWindow::MainWindow()
+{
+ QPushButton *topPushButton = new QPushButton("Left");
+ QPushButton *bottomPushButton = new QPushButton("Right");
+ for (auto nameShortcut : std::vector<std::vector<const char *>>{{"red", "r", "shift+r"}, {"green", "g", "shift+g"}, {"blue", "b", "shift+b"}}) {
+ Application *application = static_cast<Application *>(QCoreApplication::instance());
+ ActionManager *actionManager = application->actionManager();
+ QAction *action = actionManager->registerAction(nameShortcut[0], nameShortcut[1], "top", "color");
+ topPushButton->addAction(action);
+ connect(action, &QAction::triggered, this, [topPushButton, nameShortcut]() {
+ topPushButton->setText(nameShortcut[0]);
+ });
+
+ action = actionManager->registerAction(nameShortcut[0], nameShortcut[2], "bottom", "color");
+ bottomPushButton->addAction(action);
+ connect(action, &QAction::triggered, this, [bottomPushButton, nameShortcut]() {
+ bottomPushButton->setText(nameShortcut[0]);
+ });
+ }
+
+ QVBoxLayout *vBoxLayout = new QVBoxLayout;
+ vBoxLayout->addWidget(topPushButton);
+ vBoxLayout->addWidget(bottomPushButton);
+
+ QHBoxLayout *hBoxLayout = new QHBoxLayout;
+ hBoxLayout->addWidget(new ShortcutEditorWidget);
+ hBoxLayout->addLayout(vBoxLayout);
+
+ QWidget *centralWidget = new QWidget;
+ centralWidget->setLayout(hBoxLayout);
+ setCentralWidget(centralWidget);
+}
diff --git a/examples/widgets/widgets/shortcuteditor/mainwindow.h b/examples/widgets/widgets/shortcuteditor/mainwindow.h
new file mode 100644
index 0000000000..702b3f2d87
--- /dev/null
+++ b/examples/widgets/widgets/shortcuteditor/mainwindow.h
@@ -0,0 +1,22 @@
+// Copyright (C) 2022 Laszlo Papp <lpapp@kde.org>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+#ifndef MAINWINDOW_H
+#define MAINWINDOW_H
+
+#include <QMainWindow>
+
+QT_BEGIN_NAMESPACE
+class QPushButton;
+QT_END_NAMESPACE
+
+class MainWindow : public QMainWindow
+{
+ Q_OBJECT
+
+public:
+ MainWindow();
+ ~MainWindow() override = default;
+};
+
+#endif
diff --git a/examples/widgets/widgets/shortcuteditor/shortcuteditordelegate.cpp b/examples/widgets/widgets/shortcuteditor/shortcuteditordelegate.cpp
new file mode 100644
index 0000000000..a8b32bc06a
--- /dev/null
+++ b/examples/widgets/widgets/shortcuteditor/shortcuteditordelegate.cpp
@@ -0,0 +1,71 @@
+// Copyright (C) 2022 Laszlo Papp <lpapp@kde.org>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+#include "shortcuteditordelegate.h"
+
+#include <QAbstractItemModel>
+#include <QKeySequenceEdit>
+
+//! [0]
+ShortcutEditorDelegate::ShortcutEditorDelegate(QObject *parent)
+ : QStyledItemDelegate(parent)
+{
+}
+//! [0]
+
+//! [1]
+QWidget *ShortcutEditorDelegate::createEditor(QWidget *parent,
+ const QStyleOptionViewItem &/*option*/,
+ const QModelIndex &/*index*/) const
+{
+ QKeySequenceEdit *editor = new QKeySequenceEdit(parent);
+ connect(editor, &QKeySequenceEdit::editingFinished, this, &ShortcutEditorDelegate::commitAndCloseEditor);
+ return editor;
+}
+//! [1]
+
+//! [2]
+void ShortcutEditorDelegate::commitAndCloseEditor()
+{
+ QKeySequenceEdit *editor = static_cast<QKeySequenceEdit *>(sender());
+ Q_EMIT commitData(editor);
+ Q_EMIT closeEditor(editor);
+}
+//! [2]
+
+//! [3]
+void ShortcutEditorDelegate::setEditorData(QWidget *editor,
+ const QModelIndex &index) const
+{
+ if (!editor || !index.isValid())
+ return;
+
+ QString value = index.model()->data(index, Qt::EditRole).toString();
+
+ QKeySequenceEdit *keySequenceEdit = static_cast<QKeySequenceEdit *>(editor);
+ keySequenceEdit->setKeySequence(value);
+}
+//! [3]
+
+//! [4]
+void ShortcutEditorDelegate::setModelData(QWidget *editor, QAbstractItemModel *model,
+ const QModelIndex &index) const
+{
+ if (!editor || !model || !index.isValid())
+ return;
+
+ const QKeySequenceEdit *keySequenceEdit = static_cast<QKeySequenceEdit *>(editor);
+ const QKeySequence keySequence = keySequenceEdit->keySequence();
+ QString keySequenceString = keySequence.toString(QKeySequence::NativeText);
+ model->setData(index, keySequenceString);
+}
+//! [4]
+
+//! [5]
+void ShortcutEditorDelegate::updateEditorGeometry(QWidget *editor,
+ const QStyleOptionViewItem &option,
+ const QModelIndex &/*index*/) const
+{
+ editor->setGeometry(option.rect);
+}
+//! [5]
diff --git a/examples/widgets/widgets/shortcuteditor/shortcuteditordelegate.h b/examples/widgets/widgets/shortcuteditor/shortcuteditordelegate.h
new file mode 100644
index 0000000000..2818438db3
--- /dev/null
+++ b/examples/widgets/widgets/shortcuteditor/shortcuteditordelegate.h
@@ -0,0 +1,34 @@
+// Copyright (C) 2022 Laszlo Papp <lpapp@kde.org>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+#ifndef SHORTCUTEDITORDELEGATE_H
+#define SHORTCUTEDITORDELEGATE_H
+
+#include <QStyledItemDelegate>
+
+//! [0]
+class ShortcutEditorDelegate : public QStyledItemDelegate
+{
+ Q_OBJECT
+
+public:
+ explicit ShortcutEditorDelegate(QObject *parent = nullptr);
+ ~ShortcutEditorDelegate() override = default;
+
+protected:
+ QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option,
+ const QModelIndex &index) const override;
+
+ void setEditorData(QWidget *editor, const QModelIndex &index) const override;
+ void setModelData(QWidget *editor, QAbstractItemModel *model,
+ const QModelIndex &index) const override;
+
+ void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option,
+ const QModelIndex &index) const override;
+
+private:
+ void commitAndCloseEditor();
+};
+//! [0]
+
+#endif
diff --git a/examples/widgets/widgets/shortcuteditor/shortcuteditormodel.cpp b/examples/widgets/widgets/shortcuteditor/shortcuteditormodel.cpp
new file mode 100644
index 0000000000..4355f029e1
--- /dev/null
+++ b/examples/widgets/widgets/shortcuteditor/shortcuteditormodel.cpp
@@ -0,0 +1,273 @@
+// Copyright (C) 2022 Laszlo Papp <lpapp@kde.org>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+#include "shortcuteditormodel.h"
+
+#include "actionmanager.h"
+#include "application.h"
+
+#include <QAction>
+#include <QModelIndex>
+
+// List of actions for all categories
+using CategoryActionsMap = QMap<QString, QList<QAction *>>;
+
+// List of categories for all contexts
+using ActionsMap = QMap<QString, CategoryActionsMap>;
+
+
+ShortcutEditorModel::ShortcutEditorModelItem::ShortcutEditorModelItem(const QList<QVariant> &data, ShortcutEditorModelItem *parent)
+ : m_itemData(data)
+ , m_parentItem(parent)
+{
+}
+
+ShortcutEditorModel::ShortcutEditorModelItem::~ShortcutEditorModelItem()
+{
+ qDeleteAll(m_childItems);
+}
+
+void ShortcutEditorModel::ShortcutEditorModelItem::appendChild(ShortcutEditorModelItem *item)
+{
+ m_childItems.push_back(item);
+}
+
+ShortcutEditorModel::ShortcutEditorModelItem *ShortcutEditorModel::ShortcutEditorModelItem::child(int row) const
+{
+ if (row < 0 || row >= m_childItems.size())
+ return nullptr;
+
+ return m_childItems.at(row);
+}
+
+int ShortcutEditorModel::ShortcutEditorModelItem::childCount() const
+{
+ return m_childItems.count();
+}
+
+int ShortcutEditorModel::ShortcutEditorModelItem::columnCount() const
+{
+ return m_itemData.count();
+}
+
+QVariant ShortcutEditorModel::ShortcutEditorModelItem::data(int column) const
+{
+ if (column < 0 || column >= m_itemData.size())
+ return QVariant();
+
+ QVariant columnVariant = m_itemData.at(column);
+ if (column != static_cast<int>(Column::Shortcut) || columnVariant.canConvert<QString>())
+ return columnVariant;
+
+ QAction *action = static_cast<QAction *>(columnVariant.value<void *>());
+ if (!action)
+ return QVariant();
+
+ QKeySequence keySequence = action->shortcut();
+ QString keySequenceString = keySequence.toString(QKeySequence::NativeText);
+ return keySequenceString;
+}
+
+ShortcutEditorModel::ShortcutEditorModelItem *ShortcutEditorModel::ShortcutEditorModelItem::parentItem() const
+{
+ return m_parentItem;
+}
+
+int ShortcutEditorModel::ShortcutEditorModelItem::row() const
+{
+ if (m_parentItem)
+ return m_parentItem->m_childItems.indexOf(const_cast<ShortcutEditorModelItem*>(this));
+
+ return 0;
+}
+
+QAction *ShortcutEditorModel::ShortcutEditorModelItem::action() const
+{
+ QVariant actionVariant = m_itemData.at(static_cast<int>(Column::Shortcut));
+ return static_cast<QAction*>(actionVariant.value<void *>());
+}
+
+
+//! [0]
+ShortcutEditorModel::ShortcutEditorModel(QObject *parent)
+ : QAbstractItemModel(parent)
+{
+ m_rootItem = new ShortcutEditorModelItem({tr("Name"), tr("Shortcut")});
+}
+//! [0]
+
+//! [1]
+ShortcutEditorModel::~ShortcutEditorModel()
+{
+ delete m_rootItem;
+}
+//! [1]
+
+//! [2]
+void ShortcutEditorModel::setActions()
+{
+ beginResetModel();
+ setupModelData(m_rootItem);
+ endResetModel();
+}
+//! [2]
+
+//! [3]
+QModelIndex ShortcutEditorModel::index(int row, int column, const QModelIndex &parent) const
+{
+ if (!hasIndex(row, column, parent))
+ return QModelIndex();
+
+ ShortcutEditorModelItem *parentItem;
+ if (!parent.isValid())
+ parentItem = m_rootItem;
+ else
+ parentItem = static_cast<ShortcutEditorModelItem*>(parent.internalPointer());
+
+ ShortcutEditorModelItem *childItem = parentItem->child(row);
+ if (childItem)
+ return createIndex(row, column, childItem);
+
+ return QModelIndex();
+}
+//! [3]
+
+//! [4]
+QModelIndex ShortcutEditorModel::parent(const QModelIndex &index) const
+{
+ if (!index.isValid())
+ return QModelIndex();
+
+ ShortcutEditorModelItem *childItem = static_cast<ShortcutEditorModelItem*>(index.internalPointer());
+ ShortcutEditorModelItem *parentItem = childItem->parentItem();
+
+ if (parentItem == m_rootItem)
+ return QModelIndex();
+
+ return createIndex(parentItem->row(), 0, parentItem);
+}
+//! [4]
+
+//! [5]
+int ShortcutEditorModel::rowCount(const QModelIndex &parent) const
+{
+ ShortcutEditorModelItem *parentItem;
+ if (parent.column() > 0)
+ return 0;
+
+ if (!parent.isValid())
+ parentItem = m_rootItem;
+ else
+ parentItem = static_cast<ShortcutEditorModelItem*>(parent.internalPointer());
+
+ return parentItem->childCount();
+}
+//! [5]
+
+//! [6]
+int ShortcutEditorModel::columnCount(const QModelIndex &parent) const
+{
+ if (parent.isValid())
+ return static_cast<ShortcutEditorModelItem*>(parent.internalPointer())->columnCount();
+
+ return m_rootItem->columnCount();
+}
+//! [6]
+
+//! [7]
+QVariant ShortcutEditorModel::data(const QModelIndex &index, int role) const
+{
+ if (!index.isValid())
+ return QVariant();
+
+ if (role != Qt::DisplayRole && role != Qt::EditRole)
+ return QVariant();
+
+ ShortcutEditorModelItem *item = static_cast<ShortcutEditorModelItem*>(index.internalPointer());
+ return item->data(index.column());
+}
+//! [7]
+
+//! [8]
+Qt::ItemFlags ShortcutEditorModel::flags(const QModelIndex &index) const
+{
+ if (!index.isValid())
+ return Qt::NoItemFlags;
+
+ Qt::ItemFlags modelFlags = QAbstractItemModel::flags(index);
+ if (index.column() == static_cast<int>(Column::Shortcut))
+ modelFlags |= Qt::ItemIsEditable;
+
+ return modelFlags;
+}
+//! [8]
+
+//! [9]
+QVariant ShortcutEditorModel::headerData(int section, Qt::Orientation orientation, int role) const
+{
+ if (orientation == Qt::Horizontal && role == Qt::DisplayRole) {
+ return m_rootItem->data(section);
+ }
+
+ return QVariant();
+}
+//! [9]
+
+//! [10]
+void ShortcutEditorModel::setupModelData(ShortcutEditorModelItem *parent)
+{
+ ActionsMap actionsMap;
+ Application *application = static_cast<Application *>(QCoreApplication::instance());
+ ActionManager *actionManager = application->actionManager();
+ const QList<QAction *> registeredActions = actionManager->registeredActions();
+ for (QAction *action : registeredActions) {
+ QString context = actionManager->contextForAction(action);
+ QString category = actionManager->categoryForAction(action);
+ actionsMap[context][category].append(action);
+ }
+
+ QAction *nullAction = nullptr;
+ const QString contextIdPrefix = "root";
+ // Go through each context, one context - many categories each iteration
+ for (const auto &contextLevel : actionsMap.keys()) {
+ ShortcutEditorModelItem *contextLevelItem = new ShortcutEditorModelItem({contextLevel, QVariant::fromValue(nullAction)}, parent);
+ parent->appendChild(contextLevelItem);
+
+ // Go through each category, one category - many actions each iteration
+ for (const auto &categoryLevel : actionsMap[contextLevel].keys()) {
+ ShortcutEditorModelItem *categoryLevelItem = new ShortcutEditorModelItem({categoryLevel, QVariant::fromValue(nullAction)}, contextLevelItem);
+ contextLevelItem->appendChild(categoryLevelItem);
+ for (QAction *action : actionsMap[contextLevel][categoryLevel]) {
+ QString name = action->text();
+ if (name.isEmpty() || !action)
+ continue;
+
+ ShortcutEditorModelItem *actionLevelItem = new ShortcutEditorModelItem({name, QVariant::fromValue(reinterpret_cast<void *>(action))}, categoryLevelItem);
+ categoryLevelItem->appendChild(actionLevelItem);
+ }
+ }
+ }
+}
+//! [10]
+
+//! [11]
+bool ShortcutEditorModel::setData(const QModelIndex &index, const QVariant &value, int role)
+{
+ if (role == Qt::EditRole && index.column() == static_cast<int>(Column::Shortcut)) {
+ QString keySequenceString = value.toString();
+ ShortcutEditorModelItem *item = static_cast<ShortcutEditorModelItem *>(index.internalPointer());
+ QAction *itemAction = item->action();
+ if (itemAction
+ && keySequenceString == itemAction->shortcut().toString(QKeySequence::NativeText))
+ return true;
+
+ itemAction->setShortcut(keySequenceString);
+ Q_EMIT dataChanged(index, index);
+
+ if (keySequenceString.isEmpty())
+ return true;
+ }
+
+ return QAbstractItemModel::setData(index, value, role);
+}
+//! [11]
diff --git a/examples/widgets/widgets/shortcuteditor/shortcuteditormodel.h b/examples/widgets/widgets/shortcuteditor/shortcuteditormodel.h
new file mode 100644
index 0000000000..c687bb4129
--- /dev/null
+++ b/examples/widgets/widgets/shortcuteditor/shortcuteditormodel.h
@@ -0,0 +1,71 @@
+// Copyright (C) 2022 Laszlo Papp <lpapp@kde.org>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+#ifndef SHORTCUTEDITORMODEL_H
+#define SHORTCUTEDITORMODEL_H
+
+#include <QAbstractItemModel>
+#include <QList>
+#include <QVariant>
+
+QT_BEGIN_NAMESPACE
+class QAction;
+QT_END_NAMESPACE
+
+enum class Column : uint8_t {
+ Name,
+ Shortcut
+};
+
+//! [0]
+class ShortcutEditorModel : public QAbstractItemModel
+{
+ Q_OBJECT
+
+ class ShortcutEditorModelItem
+ {
+ public:
+ explicit ShortcutEditorModelItem(const QList<QVariant> &data,
+ ShortcutEditorModelItem *parentItem = nullptr);
+ ~ShortcutEditorModelItem();
+
+ void appendChild(ShortcutEditorModelItem *child);
+
+ ShortcutEditorModelItem *child(int row) const;
+ int childCount() const;
+ int columnCount() const;
+ QVariant data(int column) const;
+ int row() const;
+ ShortcutEditorModelItem *parentItem() const;
+ QAction *action() const;
+
+ private:
+ QList<ShortcutEditorModelItem *> m_childItems;
+ QList<QVariant> m_itemData;
+ ShortcutEditorModelItem *m_parentItem;
+ };
+
+public:
+ explicit ShortcutEditorModel(QObject *parent = nullptr);
+ ~ShortcutEditorModel() override;
+
+ QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
+ Qt::ItemFlags flags(const QModelIndex &index) const override;
+ QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
+ QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override;
+ QModelIndex parent(const QModelIndex &index) const override;
+ int rowCount(const QModelIndex &index = QModelIndex()) const override;
+ int columnCount(const QModelIndex &index = QModelIndex()) const override;
+
+ bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
+
+ void setActions();
+
+private:
+ void setupModelData(ShortcutEditorModelItem *parent);
+
+ ShortcutEditorModelItem *m_rootItem;
+};
+//! [0]
+
+#endif
diff --git a/examples/widgets/widgets/shortcuteditor/shortcuteditorwidget.cpp b/examples/widgets/widgets/shortcuteditor/shortcuteditorwidget.cpp
new file mode 100644
index 0000000000..3e8a027f38
--- /dev/null
+++ b/examples/widgets/widgets/shortcuteditor/shortcuteditorwidget.cpp
@@ -0,0 +1,33 @@
+// Copyright (C) 2022 Laszlo Papp <lpapp@kde.org>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+#include "shortcuteditorwidget.h"
+
+#include "shortcuteditordelegate.h"
+#include "shortcuteditormodel.h"
+
+#include <QHeaderView>
+#include <QTreeView>
+#include <QVBoxLayout>
+
+//! [0]
+ShortcutEditorWidget::ShortcutEditorWidget(QWidget *parent)
+ : QWidget(parent)
+{
+ m_model = new ShortcutEditorModel(this);
+ m_delegate = new ShortcutEditorDelegate(this);
+ m_view = new QTreeView(this);
+ m_view->setModel(m_model);
+ m_view->setItemDelegateForColumn(static_cast<int>(Column::Shortcut), m_delegate);
+ m_view->setSizeAdjustPolicy(QAbstractScrollArea::AdjustToContents);
+ m_view->setAllColumnsShowFocus(true);
+ m_view->header()->resizeSection(0, 250);
+
+ QVBoxLayout *layout = new QVBoxLayout;
+ layout->setContentsMargins(0, 0, 0, 0);
+ layout->addWidget(m_view);
+ setLayout(layout);
+
+ m_model->setActions();
+}
+//! [0]
diff --git a/examples/widgets/widgets/shortcuteditor/shortcuteditorwidget.h b/examples/widgets/widgets/shortcuteditor/shortcuteditorwidget.h
new file mode 100644
index 0000000000..44735e65e2
--- /dev/null
+++ b/examples/widgets/widgets/shortcuteditor/shortcuteditorwidget.h
@@ -0,0 +1,32 @@
+// Copyright (C) 2022 Laszlo Papp <lpapp@kde.org>
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+
+#ifndef SHORTCUTEDITORWIDGET_H
+#define SHORTCUTEDITORWIDGET_H
+
+#include <QWidget>
+
+class ShortcutEditorDelegate;
+class ShortcutEditorModel;
+
+QT_BEGIN_NAMESPACE
+class QTreeView;
+QT_END_NAMESPACE
+
+//! [0]
+class ShortcutEditorWidget : public QWidget
+{
+ Q_OBJECT
+
+public:
+ explicit ShortcutEditorWidget(QWidget *parent = nullptr);
+ ~ShortcutEditorWidget() override = default;
+
+private:
+ ShortcutEditorDelegate *m_delegate;
+ ShortcutEditorModel *m_model;
+ QTreeView *m_view;
+};
+//! [0]
+
+#endif
diff --git a/examples/widgets/widgets/sliders/CMakeLists.txt b/examples/widgets/widgets/sliders/CMakeLists.txt
index 9fb2a56979..9ba160de4b 100644
--- a/examples/widgets/widgets/sliders/CMakeLists.txt
+++ b/examples/widgets/widgets/sliders/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(sliders LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/widgets/sliders")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(sliders
main.cpp
slidersgroup.cpp slidersgroup.h
@@ -26,9 +26,9 @@ set_target_properties(sliders PROPERTIES
)
target_link_libraries(sliders PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
install(TARGETS sliders
diff --git a/examples/widgets/widgets/spinboxes/CMakeLists.txt b/examples/widgets/widgets/spinboxes/CMakeLists.txt
index bcfa436dc4..1bdd89c692 100644
--- a/examples/widgets/widgets/spinboxes/CMakeLists.txt
+++ b/examples/widgets/widgets/spinboxes/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(spinboxes LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/widgets/spinboxes")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(spinboxes
main.cpp
window.cpp window.h
@@ -25,9 +25,9 @@ set_target_properties(spinboxes PROPERTIES
)
target_link_libraries(spinboxes PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
install(TARGETS spinboxes
diff --git a/examples/widgets/widgets/styles/CMakeLists.txt b/examples/widgets/widgets/styles/CMakeLists.txt
index f1cbb08060..0f6c415dba 100644
--- a/examples/widgets/widgets/styles/CMakeLists.txt
+++ b/examples/widgets/widgets/styles/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(styles LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/widgets/styles")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(styles
main.cpp
norwegianwoodstyle.cpp norwegianwoodstyle.h
@@ -26,9 +26,9 @@ set_target_properties(styles PROPERTIES
)
target_link_libraries(styles PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
# Resources:
diff --git a/examples/widgets/widgets/stylesheet/CMakeLists.txt b/examples/widgets/widgets/stylesheet/CMakeLists.txt
index f41af051ee..9ece28037b 100644
--- a/examples/widgets/widgets/stylesheet/CMakeLists.txt
+++ b/examples/widgets/widgets/stylesheet/CMakeLists.txt
@@ -1,12 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(stylesheet LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTOUIC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -15,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/widgets/stylesheet")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(stylesheet
main.cpp
mainwindow.cpp mainwindow.h mainwindow.ui
@@ -27,9 +26,9 @@ set_target_properties(stylesheet PROPERTIES
)
target_link_libraries(stylesheet PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
# Resources:
diff --git a/examples/widgets/widgets/stylesheet/mainwindow.cpp b/examples/widgets/widgets/stylesheet/mainwindow.cpp
index a2f477c83d..a43613c757 100644
--- a/examples/widgets/widgets/stylesheet/mainwindow.cpp
+++ b/examples/widgets/widgets/stylesheet/mainwindow.cpp
@@ -12,6 +12,7 @@ MainWindow::MainWindow(QWidget *parent)
ui.setupUi(this);
ui.nameLabel->setProperty("class", "mandatory QLabel");
+ ui.nameCombo->lineEdit()->setPlaceholderText(tr("Last, First"));
styleSheetEditor = new StyleSheetEditor(this);
diff --git a/examples/widgets/widgets/stylesheet/qss/coffee.qss b/examples/widgets/widgets/stylesheet/qss/coffee.qss
index 4571d42d7e..8f72a15ee5 100644
--- a/examples/widgets/widgets/stylesheet/qss/coffee.qss
+++ b/examples/widgets/widgets/stylesheet/qss/coffee.qss
@@ -59,6 +59,11 @@ QComboBox, QLineEdit, QSpinBox, QTextEdit, QListView {
selection-background-color: #C19A6B;
}
+/* Make placeholder text a matching semi-transparent color */
+QComboBox, QLineEdit {
+ placeholder-text-color: #80C19A6B;
+}
+
QListView {
show-decoration-selected: 1;
}
diff --git a/examples/widgets/widgets/tablet/CMakeLists.txt b/examples/widgets/widgets/tablet/CMakeLists.txt
index 10191aac22..55daa61142 100644
--- a/examples/widgets/widgets/tablet/CMakeLists.txt
+++ b/examples/widgets/widgets/tablet/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(qttablet LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/widgets/tablet")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(qttablet
main.cpp
mainwindow.cpp mainwindow.h
@@ -27,9 +27,9 @@ set_target_properties(qttablet PROPERTIES
)
target_link_libraries(qttablet PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
# Resources:
diff --git a/examples/widgets/widgets/tetrix/CMakeLists.txt b/examples/widgets/widgets/tetrix/CMakeLists.txt
index 2c8c166761..de1a4e82d1 100644
--- a/examples/widgets/widgets/tetrix/CMakeLists.txt
+++ b/examples/widgets/widgets/tetrix/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(tetrix LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/widgets/tetrix")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(tetrix
main.cpp
tetrixboard.cpp tetrixboard.h
@@ -27,9 +27,9 @@ set_target_properties(tetrix PROPERTIES
)
target_link_libraries(tetrix PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
install(TARGETS tetrix
diff --git a/examples/widgets/widgets/tooltips/CMakeLists.txt b/examples/widgets/widgets/tooltips/CMakeLists.txt
index 0cdbabea0e..b1c357dce4 100644
--- a/examples/widgets/widgets/tooltips/CMakeLists.txt
+++ b/examples/widgets/widgets/tooltips/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(tooltips LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/widgets/tooltips")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(tooltips
main.cpp
shapeitem.cpp shapeitem.h
@@ -26,9 +26,9 @@ set_target_properties(tooltips PROPERTIES
)
target_link_libraries(tooltips PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
# Resources:
diff --git a/examples/widgets/widgets/tooltips/sortingbox.cpp b/examples/widgets/widgets/tooltips/sortingbox.cpp
index 2b9127f5bd..1f6de0bd8c 100644
--- a/examples/widgets/widgets/tooltips/sortingbox.cpp
+++ b/examples/widgets/widgets/tooltips/sortingbox.cpp
@@ -97,7 +97,7 @@ void SortingBox::paintEvent(QPaintEvent * /* event */)
{
QPainter painter(this);
painter.setRenderHint(QPainter::Antialiasing);
- for (const ShapeItem &shapeItem : qAsConst(shapeItems)) {
+ for (const ShapeItem &shapeItem : std::as_const(shapeItems)) {
//! [8] //! [9]
painter.translate(shapeItem.position());
//! [9] //! [10]
diff --git a/examples/widgets/widgets/validators/CMakeLists.txt b/examples/widgets/widgets/validators/CMakeLists.txt
index 2c1dffa380..7575e5e308 100644
--- a/examples/widgets/widgets/validators/CMakeLists.txt
+++ b/examples/widgets/widgets/validators/CMakeLists.txt
@@ -1,14 +1,11 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(validators LANGUAGES CXX)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
-set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTOUIC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -17,6 +14,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/widgets/validators")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(validators
ledwidget.cpp ledwidget.h
localeselector.cpp localeselector.h
@@ -31,9 +30,9 @@ set_target_properties(validators PROPERTIES
)
target_link_libraries(validators PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
# Resources:
diff --git a/examples/widgets/widgets/wiggly/CMakeLists.txt b/examples/widgets/widgets/wiggly/CMakeLists.txt
index bfdd06a8cc..d9bcdb6936 100644
--- a/examples/widgets/widgets/wiggly/CMakeLists.txt
+++ b/examples/widgets/widgets/wiggly/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(wiggly LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/widgets/wiggly")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(wiggly
dialog.cpp dialog.h
main.cpp
@@ -26,9 +26,9 @@ set_target_properties(wiggly PROPERTIES
)
target_link_libraries(wiggly PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
install(TARGETS wiggly
diff --git a/examples/widgets/widgets/windowflags/CMakeLists.txt b/examples/widgets/widgets/windowflags/CMakeLists.txt
index dced29c0b9..99fa127aec 100644
--- a/examples/widgets/widgets/windowflags/CMakeLists.txt
+++ b/examples/widgets/widgets/windowflags/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(windowflags LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/widgets/windowflags")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+qt_standard_project_setup()
+
qt_add_executable(windowflags
controllerwindow.cpp controllerwindow.h
main.cpp
@@ -26,9 +26,9 @@ set_target_properties(windowflags PROPERTIES
)
target_link_libraries(windowflags PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
)
install(TARGETS windowflags
diff --git a/examples/widgets/windowcontainer/CMakeLists.txt b/examples/widgets/windowcontainer/CMakeLists.txt
index 5d299d06fb..cd79a9a9b2 100644
--- a/examples/widgets/windowcontainer/CMakeLists.txt
+++ b/examples/widgets/windowcontainer/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(windowcontainer LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/windowcontainer")
find_package(Qt6 REQUIRED COMPONENTS Core Gui OpenGL Widgets)
+qt_standard_project_setup()
+
qt_add_executable(windowcontainer
../../opengl/openglwindow/openglwindow.cpp ../../opengl/openglwindow/openglwindow.h
windowcontainer.cpp
@@ -29,10 +29,10 @@ target_include_directories(windowcontainer PUBLIC
)
target_link_libraries(windowcontainer PUBLIC
- Qt::Core
- Qt::Gui
- Qt::OpenGL
- Qt::Widgets
+ Qt6::Core
+ Qt6::Gui
+ Qt6::OpenGL
+ Qt6::Widgets
)
install(TARGETS windowcontainer
diff --git a/examples/xml/CMakeLists.txt b/examples/xml/CMakeLists.txt
index bdfdec514c..f9dadb1455 100644
--- a/examples/xml/CMakeLists.txt
+++ b/examples/xml/CMakeLists.txt
@@ -1,12 +1,12 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
qt_internal_add_example(htmlinfo)
qt_internal_add_example(xmlstreamlint)
-if(TARGET Qt::Widgets)
+if(TARGET Qt6::Widgets)
qt_internal_add_example(dombookmarks)
qt_internal_add_example(streambookmarks)
endif()
-if(TARGET Qt::Network AND TARGET Qt::Widgets)
+if(TARGET Qt6::Network AND TARGET Qt6::Widgets)
qt_internal_add_example(rsslisting)
endif()
diff --git a/examples/xml/dombookmarks/CMakeLists.txt b/examples/xml/dombookmarks/CMakeLists.txt
index 0def172d61..159567a67a 100644
--- a/examples/xml/dombookmarks/CMakeLists.txt
+++ b/examples/xml/dombookmarks/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(dombookmarks LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/xml/dombookmarks")
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets Xml)
+qt_standard_project_setup()
+
qt_add_executable(dombookmarks
main.cpp
mainwindow.cpp mainwindow.h
@@ -26,10 +26,10 @@ set_target_properties(dombookmarks PROPERTIES
)
target_link_libraries(dombookmarks PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
- Qt::Xml
+ Qt6::Core
+ Qt6::Gui
+ Qt6::Widgets
+ Qt6::Xml
)
install(TARGETS dombookmarks
diff --git a/examples/xml/htmlinfo/CMakeLists.txt b/examples/xml/htmlinfo/CMakeLists.txt
index 7f687c6ff9..62b354c346 100644
--- a/examples/xml/htmlinfo/CMakeLists.txt
+++ b/examples/xml/htmlinfo/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(htmlinfo LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
endif()
@@ -14,6 +12,8 @@ set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/xml/htmlinfo")
find_package(Qt6 REQUIRED COMPONENTS Core)
+qt_standard_project_setup()
+
qt_add_executable(htmlinfo
main.cpp
)
@@ -24,7 +24,7 @@ set_target_properties(htmlinfo PROPERTIES
)
target_link_libraries(htmlinfo PUBLIC
- Qt::Core
+ Qt6::Core
)
# Resources:
diff --git a/examples/xml/htmlinfo/main.cpp b/examples/xml/htmlinfo/main.cpp
index d9fc9a1861..d01421ff84 100644
--- a/examples/xml/htmlinfo/main.cpp
+++ b/examples/xml/htmlinfo/main.cpp
@@ -51,7 +51,7 @@ void parseHtmlFile(QTextStream &out, const QString &fileName)
while (links.size() > 5)
links.removeLast();
- for (const QString &link : qAsConst(links))
+ for (const QString &link : std::as_const(links))
out << " " << link << Qt::endl;
out << Qt::endl << Qt::endl;
}
diff --git a/examples/xml/rsslisting/CMakeLists.txt b/examples/xml/rsslisting/CMakeLists.txt
index 7f904e6531..2e02ef2752 100644
--- a/examples/xml/rsslisting/CMakeLists.txt
+++ b/examples/xml/rsslisting/CMakeLists.txt
@@ -1,11 +1,9 @@
# Copyright (C) 2022 The Qt Company Ltd.
-# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
+# SPDX-License-Identifier: BSD-3-Clause
cmake_minimum_required(VERSION 3.16)
project(rsslisting LANGUAGES CXX)
-set(CMAKE_AUTOMOC ON)
-
if(NOT DEFINE