summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/corelib/CMakeLists.txt3
-rw-r--r--examples/corelib/bindableproperties/CMakeLists.txt2
-rw-r--r--examples/corelib/bindableproperties/bindableproperties.pro4
-rw-r--r--examples/corelib/bindableproperties/bindablesubscription/CMakeLists.txt48
-rw-r--r--examples/corelib/bindableproperties/bindablesubscription/bindablesubscription.cpp98
-rw-r--r--examples/corelib/bindableproperties/bindablesubscription/bindablesubscription.h91
-rw-r--r--examples/corelib/bindableproperties/bindablesubscription/bindablesubscription.pro22
-rw-r--r--examples/corelib/bindableproperties/bindablesubscription/bindableuser.cpp65
-rw-r--r--examples/corelib/bindableproperties/bindablesubscription/bindableuser.h86
-rw-r--r--examples/corelib/bindableproperties/bindablesubscription/main.cpp118
-rw-r--r--examples/corelib/bindableproperties/doc/images/bindable_properties_example.pngbin0 -> 18831 bytes
-rw-r--r--examples/corelib/bindableproperties/doc/src/bindableproperties.qdoc202
-rw-r--r--examples/corelib/bindableproperties/shared/countries.qrc7
-rw-r--r--examples/corelib/bindableproperties/shared/finland.pngbin0 -> 1062 bytes
-rw-r--r--examples/corelib/bindableproperties/shared/germany.pngbin0 -> 483 bytes
-rw-r--r--examples/corelib/bindableproperties/shared/norway.pngbin0 -> 5190 bytes
-rw-r--r--examples/corelib/bindableproperties/shared/subscriptionwindow.cpp63
-rw-r--r--examples/corelib/bindableproperties/shared/subscriptionwindow.h76
-rw-r--r--examples/corelib/bindableproperties/shared/subscriptionwindow.ui280
-rw-r--r--examples/corelib/bindableproperties/subscription/CMakeLists.txt48
-rw-r--r--examples/corelib/bindableproperties/subscription/main.cpp138
-rw-r--r--examples/corelib/bindableproperties/subscription/subscription.cpp126
-rw-r--r--examples/corelib/bindableproperties/subscription/subscription.h95
-rw-r--r--examples/corelib/bindableproperties/subscription/subscription.pro22
-rw-r--r--examples/corelib/bindableproperties/subscription/user.cpp71
-rw-r--r--examples/corelib/bindableproperties/subscription/user.h86
-rw-r--r--examples/corelib/ipc/CMakeLists.txt2
-rw-r--r--examples/corelib/ipc/localfortuneclient/CMakeLists.txt15
-rw-r--r--examples/corelib/ipc/localfortuneserver/CMakeLists.txt15
-rw-r--r--examples/corelib/ipc/sharedmemory/CMakeLists.txt13
-rw-r--r--examples/corelib/mimetypes/CMakeLists.txt2
-rw-r--r--examples/corelib/mimetypes/mimetypebrowser/CMakeLists.txt14
-rw-r--r--examples/corelib/platform/androidnotifier/CMakeLists.txt77
-rw-r--r--examples/corelib/serialization/CMakeLists.txt2
-rw-r--r--examples/corelib/serialization/cbordump/CMakeLists.txt15
-rw-r--r--examples/corelib/serialization/convert/CMakeLists.txt15
-rw-r--r--examples/corelib/serialization/savegame/CMakeLists.txt15
-rw-r--r--examples/corelib/threads/CMakeLists.txt2
-rw-r--r--examples/corelib/threads/mandelbrot/CMakeLists.txt20
-rw-r--r--examples/corelib/threads/mandelbrot/mandelbrot.pro2
-rw-r--r--examples/corelib/threads/queuedcustomtype/CMakeLists.txt14
-rw-r--r--examples/corelib/threads/semaphores/CMakeLists.txt15
-rw-r--r--examples/corelib/threads/waitconditions/CMakeLists.txt15
-rw-r--r--examples/corelib/tools/CMakeLists.txt2
-rw-r--r--examples/corelib/tools/contiguouscache/CMakeLists.txt14
-rw-r--r--examples/corelib/tools/customtype/CMakeLists.txt14
-rw-r--r--examples/corelib/tools/customtypesending/CMakeLists.txt14
-rw-r--r--examples/dbus/CMakeLists.txt2
-rw-r--r--examples/dbus/chat/.prev_CMakeLists.txt43
-rw-r--r--examples/dbus/chat/CMakeLists.txt22
-rw-r--r--examples/dbus/complexpingpong/CMakeLists.txt56
-rw-r--r--examples/dbus/listnames/CMakeLists.txt22
-rw-r--r--examples/dbus/pingpong/CMakeLists.txt54
-rw-r--r--examples/dbus/remotecontrolledcar/CMakeLists.txt2
-rw-r--r--examples/dbus/remotecontrolledcar/car/.prev_CMakeLists.txt42
-rw-r--r--examples/dbus/remotecontrolledcar/car/CMakeLists.txt20
-rw-r--r--examples/dbus/remotecontrolledcar/controller/.prev_CMakeLists.txt42
-rw-r--r--examples/dbus/remotecontrolledcar/controller/CMakeLists.txt19
-rw-r--r--examples/embedded/CMakeLists.txt2
-rw-r--r--examples/embedded/digiflip/CMakeLists.txt14
-rw-r--r--examples/embedded/flickable/CMakeLists.txt14
-rw-r--r--examples/embedded/flightinfo/.prev_CMakeLists.txt47
-rw-r--r--examples/embedded/flightinfo/CMakeLists.txt17
-rw-r--r--examples/embedded/lightmaps/CMakeLists.txt15
-rw-r--r--examples/embedded/raycasting/CMakeLists.txt17
-rw-r--r--examples/embedded/styleexample/.prev_CMakeLists.txt52
-rw-r--r--examples/embedded/styleexample/CMakeLists.txt16
-rw-r--r--examples/gui/CMakeLists.txt2
-rw-r--r--examples/gui/analogclock/.prev_CMakeLists.txt42
-rw-r--r--examples/gui/analogclock/CMakeLists.txt32
-rw-r--r--examples/gui/rasterwindow/.prev_CMakeLists.txt42
-rw-r--r--examples/gui/rasterwindow/CMakeLists.txt18
-rw-r--r--examples/gui/rasterwindow/rasterwindow.h3
-rw-r--r--examples/network/.prev_CMakeLists.txt38
-rw-r--r--examples/network/CMakeLists.txt2
-rw-r--r--examples/network/blockingfortuneclient/CMakeLists.txt15
-rw-r--r--examples/network/broadcastreceiver/CMakeLists.txt15
-rw-r--r--examples/network/broadcastsender/CMakeLists.txt15
-rw-r--r--examples/network/dnslookup/CMakeLists.txt16
-rw-r--r--examples/network/download/CMakeLists.txt16
-rw-r--r--examples/network/downloadmanager/CMakeLists.txt16
-rw-r--r--examples/network/fortuneclient/CMakeLists.txt15
-rw-r--r--examples/network/fortuneserver/CMakeLists.txt15
-rw-r--r--examples/network/googlesuggest/CMakeLists.txt15
-rw-r--r--examples/network/http/CMakeLists.txt14
-rw-r--r--examples/network/loopback/CMakeLists.txt15
-rw-r--r--examples/network/multicastreceiver/CMakeLists.txt15
-rw-r--r--examples/network/multicastsender/CMakeLists.txt15
-rw-r--r--examples/network/multistreamclient/CMakeLists.txt15
-rw-r--r--examples/network/multistreamclient/timeconsumer.cpp2
-rw-r--r--examples/network/multistreamserver/CMakeLists.txt15
-rw-r--r--examples/network/multistreamserver/timeprovider.cpp2
-rw-r--r--examples/network/network-chat/CMakeLists.txt14
-rw-r--r--examples/network/securesocketclient/CMakeLists.txt17
-rw-r--r--examples/network/secureudpclient/CMakeLists.txt14
-rw-r--r--examples/network/secureudpserver/CMakeLists.txt14
-rw-r--r--examples/network/threadedfortuneserver/CMakeLists.txt15
-rw-r--r--examples/network/torrent/CMakeLists.txt17
-rw-r--r--examples/network/torrent/mainwindow.cpp2
-rw-r--r--examples/opengl/2dpainting/CMakeLists.txt16
-rw-r--r--examples/opengl/CMakeLists.txt2
-rw-r--r--examples/opengl/computegles31/CMakeLists.txt17
-rw-r--r--examples/opengl/contextinfo/CMakeLists.txt15
-rw-r--r--examples/opengl/cube/CMakeLists.txt18
-rw-r--r--examples/opengl/hellogl2/CMakeLists.txt16
-rw-r--r--examples/opengl/hellogles3/CMakeLists.txt17
-rw-r--r--examples/opengl/hellowindow/CMakeLists.txt14
-rw-r--r--examples/opengl/openglwindow/.prev_CMakeLists.txt36
-rw-r--r--examples/opengl/openglwindow/CMakeLists.txt16
-rw-r--r--examples/opengl/paintedwindow/CMakeLists.txt14
-rw-r--r--examples/opengl/qopenglwidget/CMakeLists.txt17
-rw-r--r--examples/opengl/qopenglwindow/CMakeLists.txt19
-rw-r--r--examples/opengl/textures/CMakeLists.txt17
-rw-r--r--examples/opengl/threadedqopenglwidget/CMakeLists.txt17
-rw-r--r--examples/opengl/threadedqopenglwidget/glwidget.cpp255
-rw-r--r--examples/opengl/threadedqopenglwidget/glwidget.h57
-rw-r--r--examples/opengl/threadedqopenglwidget/main.cpp6
-rw-r--r--examples/opengl/threadedqopenglwidget/mainwindow.cpp2
-rw-r--r--examples/opengl/threadedqopenglwidget/mainwindow.h2
-rw-r--r--examples/opengl/threadedqopenglwidget/renderer.cpp314
-rw-r--r--examples/opengl/threadedqopenglwidget/renderer.h108
-rw-r--r--examples/opengl/threadedqopenglwidget/threadedqopenglwidget.pro6
-rw-r--r--examples/qpa/CMakeLists.txt2
-rw-r--r--examples/qpa/qrasterwindow/.prev_CMakeLists.txt29
-rw-r--r--examples/qpa/qrasterwindow/CMakeLists.txt13
-rw-r--r--examples/qpa/windows/CMakeLists.txt13
-rw-r--r--examples/qtconcurrent/CMakeLists.txt2
-rw-r--r--examples/qtconcurrent/imagescaling/CMakeLists.txt15
-rw-r--r--examples/qtconcurrent/map/.prev_CMakeLists.txt39
-rw-r--r--examples/qtconcurrent/map/CMakeLists.txt18
-rw-r--r--examples/qtconcurrent/progressdialog/CMakeLists.txt15
-rw-r--r--examples/qtconcurrent/runfunction/CMakeLists.txt18
-rw-r--r--examples/qtconcurrent/wordcount/CMakeLists.txt18
-rw-r--r--examples/qtestlib/CMakeLists.txt2
-rw-r--r--examples/qtestlib/tutorial1/CMakeLists.txt15
-rw-r--r--examples/qtestlib/tutorial2/CMakeLists.txt15
-rw-r--r--examples/qtestlib/tutorial3/CMakeLists.txt15
-rw-r--r--examples/qtestlib/tutorial4/CMakeLists.txt15
-rw-r--r--examples/qtestlib/tutorial5/CMakeLists.txt15
-rw-r--r--examples/sql/.prev_CMakeLists.txt18
-rw-r--r--examples/sql/CMakeLists.txt4
-rw-r--r--examples/sql/books/CMakeLists.txt19
-rw-r--r--examples/sql/cachedtable/CMakeLists.txt15
-rw-r--r--examples/sql/drilldown/CMakeLists.txt18
-rw-r--r--examples/sql/masterdetail/CMakeLists.txt19
-rw-r--r--examples/sql/querymodel/CMakeLists.txt15
-rw-r--r--examples/sql/relationaltablemodel/CMakeLists.txt15
-rw-r--r--examples/sql/sqlbrowser/CMakeLists.txt12
-rw-r--r--examples/sql/sqlwidgetmapper/CMakeLists.txt15
-rw-r--r--examples/sql/tablemodel/CMakeLists.txt15
-rw-r--r--examples/vulkan/CMakeLists.txt2
-rw-r--r--examples/vulkan/hellovulkancubes/CMakeLists.txt18
-rw-r--r--examples/vulkan/hellovulkantexture/CMakeLists.txt16
-rw-r--r--examples/vulkan/hellovulkantriangle/CMakeLists.txt18
-rw-r--r--examples/vulkan/hellovulkanwidget/CMakeLists.txt19
-rw-r--r--examples/vulkan/hellovulkanwindow/CMakeLists.txt13
-rw-r--r--examples/widgets/.prev_CMakeLists.txt32
-rw-r--r--examples/widgets/CMakeLists.txt4
-rw-r--r--examples/widgets/animation/CMakeLists.txt2
-rw-r--r--examples/widgets/animation/easing/CMakeLists.txt16
-rw-r--r--examples/widgets/desktop/CMakeLists.txt2
-rw-r--r--examples/widgets/desktop/screenshot/CMakeLists.txt14
-rw-r--r--examples/widgets/desktop/systray/CMakeLists.txt17
-rw-r--r--examples/widgets/desktop/systray/doc/src/systray.qdoc8
-rw-r--r--examples/widgets/desktop/systray/window.cpp5
-rw-r--r--examples/widgets/dialogs/.prev_CMakeLists.txt13
-rw-r--r--examples/widgets/dialogs/CMakeLists.txt2
-rw-r--r--examples/widgets/dialogs/classwizard/CMakeLists.txt17
-rw-r--r--examples/widgets/dialogs/extension/CMakeLists.txt14
-rw-r--r--examples/widgets/dialogs/findfiles/CMakeLists.txt14
-rw-r--r--examples/widgets/dialogs/licensewizard/CMakeLists.txt18
-rw-r--r--examples/widgets/dialogs/standarddialogs/CMakeLists.txt14
-rw-r--r--examples/widgets/dialogs/tabdialog/CMakeLists.txt14
-rw-r--r--examples/widgets/dialogs/trivialwizard/CMakeLists.txt14
-rw-r--r--examples/widgets/draganddrop/CMakeLists.txt2
-rw-r--r--examples/widgets/draganddrop/draggableicons/CMakeLists.txt17
-rw-r--r--examples/widgets/draganddrop/draggabletext/CMakeLists.txt17
-rw-r--r--examples/widgets/draganddrop/dropsite/CMakeLists.txt14
-rw-r--r--examples/widgets/draganddrop/fridgemagnets/CMakeLists.txt17
-rw-r--r--examples/widgets/draganddrop/puzzle/.prev_CMakeLists.txt55
-rw-r--r--examples/widgets/draganddrop/puzzle/CMakeLists.txt27
-rw-r--r--examples/widgets/draganddrop/puzzle/puzzlewidget.cpp4
-rw-r--r--examples/widgets/effects/CMakeLists.txt2
-rw-r--r--examples/widgets/effects/blurpicker/CMakeLists.txt17
-rw-r--r--examples/widgets/effects/fademessage/CMakeLists.txt17
-rw-r--r--examples/widgets/gallery/CMakeLists.txt14
-rw-r--r--examples/widgets/gestures/CMakeLists.txt2
-rw-r--r--examples/widgets/gestures/imagegestures/CMakeLists.txt14
-rw-r--r--examples/widgets/graphicsview/CMakeLists.txt2
-rw-r--r--examples/widgets/graphicsview/anchorlayout/CMakeLists.txt14
-rw-r--r--examples/widgets/graphicsview/basicgraphicslayouts/CMakeLists.txt17
-rw-r--r--examples/widgets/graphicsview/chip/.prev_CMakeLists.txt66
-rw-r--r--examples/widgets/graphicsview/chip/CMakeLists.txt22
-rw-r--r--examples/widgets/graphicsview/collidingmice/CMakeLists.txt17
-rw-r--r--examples/widgets/graphicsview/diagramscene/CMakeLists.txt17
-rw-r--r--examples/widgets/graphicsview/dragdroprobot/CMakeLists.txt17
-rw-r--r--examples/widgets/graphicsview/elasticnodes/CMakeLists.txt14
-rw-r--r--examples/widgets/graphicsview/embeddeddialogs/CMakeLists.txt16
-rw-r--r--examples/widgets/graphicsview/flowlayout/.prev_CMakeLists.txt41
-rw-r--r--examples/widgets/graphicsview/flowlayout/CMakeLists.txt24
-rw-r--r--examples/widgets/graphicsview/simpleanchorlayout/CMakeLists.txt14
-rw-r--r--examples/widgets/graphicsview/weatheranchorlayout/CMakeLists.txt17
-rw-r--r--examples/widgets/itemviews/.prev_CMakeLists.txt27
-rw-r--r--examples/widgets/itemviews/CMakeLists.txt2
-rw-r--r--examples/widgets/itemviews/addressbook/CMakeLists.txt14
-rw-r--r--examples/widgets/itemviews/basicsortfiltermodel/CMakeLists.txt14
-rw-r--r--examples/widgets/itemviews/chart/CMakeLists.txt17
-rw-r--r--examples/widgets/itemviews/coloreditorfactory/CMakeLists.txt14
-rw-r--r--examples/widgets/itemviews/combowidgetmapper/CMakeLists.txt14
-rw-r--r--examples/widgets/itemviews/customsortfiltermodel/CMakeLists.txt17
-rw-r--r--examples/widgets/itemviews/dirview/CMakeLists.txt14
-rw-r--r--examples/widgets/itemviews/editabletreemodel/CMakeLists.txt16
-rw-r--r--examples/widgets/itemviews/fetchmore/CMakeLists.txt14
-rw-r--r--examples/widgets/itemviews/flattreeview/CMakeLists.txt14
-rw-r--r--examples/widgets/itemviews/frozencolumn/CMakeLists.txt17
-rw-r--r--examples/widgets/itemviews/interview/CMakeLists.txt17
-rw-r--r--examples/widgets/itemviews/pixelator/.prev_CMakeLists.txt61
-rw-r--r--examples/widgets/itemviews/pixelator/CMakeLists.txt21
-rw-r--r--examples/widgets/itemviews/puzzle/.prev_CMakeLists.txt55
-rw-r--r--examples/widgets/itemviews/puzzle/CMakeLists.txt25
-rw-r--r--examples/widgets/itemviews/puzzle/puzzlewidget.cpp4
-rw-r--r--examples/widgets/itemviews/simpledommodel/CMakeLists.txt15
-rw-r--r--examples/widgets/itemviews/simpletreemodel/CMakeLists.txt17
-rw-r--r--examples/widgets/itemviews/simplewidgetmapper/CMakeLists.txt14
-rw-r--r--examples/widgets/itemviews/spinboxdelegate/CMakeLists.txt14
-rw-r--r--examples/widgets/itemviews/spreadsheet/.prev_CMakeLists.txt62
-rw-r--r--examples/widgets/itemviews/spreadsheet/CMakeLists.txt24
-rw-r--r--examples/widgets/itemviews/stardelegate/CMakeLists.txt14
-rw-r--r--examples/widgets/itemviews/storageview/CMakeLists.txt14
-rw-r--r--examples/widgets/layouts/CMakeLists.txt2
-rw-r--r--examples/widgets/layouts/basiclayouts/CMakeLists.txt14
-rw-r--r--examples/widgets/layouts/borderlayout/CMakeLists.txt14
-rw-r--r--examples/widgets/layouts/dynamiclayouts/CMakeLists.txt14
-rw-r--r--examples/widgets/layouts/flowlayout/CMakeLists.txt14
-rw-r--r--examples/widgets/mainwindows/CMakeLists.txt2
-rw-r--r--examples/widgets/mainwindows/application/CMakeLists.txt17
-rw-r--r--examples/widgets/mainwindows/dockwidgets/.prev_CMakeLists.txt62
-rw-r--r--examples/widgets/mainwindows/dockwidgets/CMakeLists.txt24
-rw-r--r--examples/widgets/mainwindows/mainwindow/CMakeLists.txt17
-rw-r--r--examples/widgets/mainwindows/mdi/CMakeLists.txt17
-rw-r--r--examples/widgets/mainwindows/menus/CMakeLists.txt14
-rw-r--r--examples/widgets/mainwindows/sdi/CMakeLists.txt17
-rw-r--r--examples/widgets/painting/.prev_CMakeLists.txt13
-rw-r--r--examples/widgets/painting/CMakeLists.txt5
-rw-r--r--examples/widgets/painting/affine/.prev_CMakeLists.txt118
-rw-r--r--examples/widgets/painting/affine/CMakeLists.txt28
-rw-r--r--examples/widgets/painting/basicdrawing/CMakeLists.txt17
-rw-r--r--examples/widgets/painting/composition/.prev_CMakeLists.txt119
-rw-r--r--examples/widgets/painting/composition/CMakeLists.txt28
-rw-r--r--examples/widgets/painting/concentriccircles/CMakeLists.txt14
-rw-r--r--examples/widgets/painting/deform/.prev_CMakeLists.txt117
-rw-r--r--examples/widgets/painting/deform/CMakeLists.txt28
-rw-r--r--examples/widgets/painting/fontsampler/CMakeLists.txt17
-rw-r--r--examples/widgets/painting/gradients/.prev_CMakeLists.txt117
-rw-r--r--examples/widgets/painting/gradients/CMakeLists.txt28
-rw-r--r--examples/widgets/painting/imagecomposition/CMakeLists.txt17
-rw-r--r--examples/widgets/painting/painterpaths/CMakeLists.txt14
-rw-r--r--examples/widgets/painting/pathstroke/.prev_CMakeLists.txt117
-rw-r--r--examples/widgets/painting/pathstroke/CMakeLists.txt28
-rw-r--r--examples/widgets/painting/shared/CMakeLists.txt4
-rw-r--r--examples/widgets/painting/transformations/CMakeLists.txt14
-rw-r--r--examples/widgets/qnx/foreignwindows/collector.cpp2
-rw-r--r--examples/widgets/qnx/foreignwindows/collector.h2
-rw-r--r--examples/widgets/richtext/CMakeLists.txt2
-rw-r--r--examples/widgets/richtext/calendar/CMakeLists.txt14
-rw-r--r--examples/widgets/richtext/orderform/CMakeLists.txt14
-rw-r--r--examples/widgets/richtext/syntaxhighlighter/CMakeLists.txt14
-rw-r--r--examples/widgets/richtext/textedit/.prev_CMakeLists.txt108
-rw-r--r--examples/widgets/richtext/textedit/CMakeLists.txt24
-rw-r--r--examples/widgets/scroller/CMakeLists.txt2
-rw-r--r--examples/widgets/scroller/graphicsview/CMakeLists.txt14
-rw-r--r--examples/widgets/tools/.prev_CMakeLists.txt17
-rw-r--r--examples/widgets/tools/CMakeLists.txt11
-rw-r--r--examples/widgets/tools/completer/CMakeLists.txt17
-rw-r--r--examples/widgets/tools/customcompleter/CMakeLists.txt17
-rw-r--r--examples/widgets/tools/echoplugin/CMakeLists.txt2
-rw-r--r--examples/widgets/tools/echoplugin/echowindow/.prev_CMakeLists.txt41
-rw-r--r--examples/widgets/tools/echoplugin/echowindow/CMakeLists.txt2
-rw-r--r--examples/widgets/tools/echoplugin/plugin/.prev_CMakeLists.txt35
-rw-r--r--examples/widgets/tools/echoplugin/plugin/CMakeLists.txt3
-rw-r--r--examples/widgets/tools/i18n/CMakeLists.txt17
-rw-r--r--examples/widgets/tools/plugandpaint/CMakeLists.txt4
-rw-r--r--examples/widgets/tools/plugandpaint/app/.prev_CMakeLists.txt74
-rw-r--r--examples/widgets/tools/plugandpaint/app/CMakeLists.txt2
-rw-r--r--examples/widgets/tools/plugandpaint/plugins/basictools/.prev_CMakeLists.txt36
-rw-r--r--examples/widgets/tools/plugandpaint/plugins/basictools/CMakeLists.txt2
-rw-r--r--examples/widgets/tools/plugandpaint/plugins/extrafilters/.prev_CMakeLists.txt36
-rw-r--r--examples/widgets/tools/plugandpaint/plugins/extrafilters/CMakeLists.txt3
-rw-r--r--examples/widgets/tools/regularexpression/CMakeLists.txt17
-rw-r--r--examples/widgets/tools/settingseditor/CMakeLists.txt14
-rw-r--r--examples/widgets/tools/styleplugin/.prev_CMakeLists.txt4
-rw-r--r--examples/widgets/tools/styleplugin/CMakeLists.txt2
-rw-r--r--examples/widgets/tools/styleplugin/plugin/.prev_CMakeLists.txt32
-rw-r--r--examples/widgets/tools/styleplugin/plugin/CMakeLists.txt3
-rw-r--r--examples/widgets/tools/styleplugin/stylewindow/CMakeLists.txt3
-rw-r--r--examples/widgets/tools/treemodelcompleter/CMakeLists.txt17
-rw-r--r--examples/widgets/tools/undo/CMakeLists.txt14
-rw-r--r--examples/widgets/tools/undoframework/CMakeLists.txt17
-rw-r--r--examples/widgets/touch/CMakeLists.txt2
-rw-r--r--examples/widgets/touch/dials/CMakeLists.txt13
-rw-r--r--examples/widgets/touch/fingerpaint/.prev_CMakeLists.txt47
-rw-r--r--examples/widgets/touch/fingerpaint/CMakeLists.txt21
-rw-r--r--examples/widgets/touch/knobs/CMakeLists.txt14
-rw-r--r--examples/widgets/touch/pinchzoom/CMakeLists.txt17
-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.txt14
-rw-r--r--examples/widgets/tutorials/addressbook/part2/CMakeLists.txt14
-rw-r--r--examples/widgets/tutorials/addressbook/part3/CMakeLists.txt14
-rw-r--r--examples/widgets/tutorials/addressbook/part4/CMakeLists.txt14
-rw-r--r--examples/widgets/tutorials/addressbook/part5/CMakeLists.txt14
-rw-r--r--examples/widgets/tutorials/addressbook/part6/CMakeLists.txt14
-rw-r--r--examples/widgets/tutorials/addressbook/part7/CMakeLists.txt14
-rw-r--r--examples/widgets/tutorials/gettingStarted/gsQt/CMakeLists.txt2
-rw-r--r--examples/widgets/tutorials/gettingStarted/gsQt/part1/CMakeLists.txt14
-rw-r--r--examples/widgets/tutorials/gettingStarted/gsQt/part2/CMakeLists.txt14
-rw-r--r--examples/widgets/tutorials/gettingStarted/gsQt/part3/CMakeLists.txt14
-rw-r--r--examples/widgets/tutorials/gettingStarted/gsQt/part4/CMakeLists.txt14
-rw-r--r--examples/widgets/tutorials/gettingStarted/gsQt/part5/CMakeLists.txt14
-rw-r--r--examples/widgets/tutorials/modelview/1_readonly/CMakeLists.txt14
-rw-r--r--examples/widgets/tutorials/modelview/2_formatting/CMakeLists.txt14
-rw-r--r--examples/widgets/tutorials/modelview/3_changingmodel/CMakeLists.txt14
-rw-r--r--examples/widgets/tutorials/modelview/4_headers/CMakeLists.txt14
-rw-r--r--examples/widgets/tutorials/modelview/5_edit/CMakeLists.txt14
-rw-r--r--examples/widgets/tutorials/modelview/6_treeview/CMakeLists.txt14
-rw-r--r--examples/widgets/tutorials/modelview/7_selections/CMakeLists.txt14
-rw-r--r--examples/widgets/tutorials/modelview/CMakeLists.txt2
-rw-r--r--examples/widgets/tutorials/notepad/.prev_CMakeLists.txt76
-rw-r--r--examples/widgets/tutorials/notepad/CMakeLists.txt20
-rw-r--r--examples/widgets/tutorials/widgets/CMakeLists.txt2
-rw-r--r--examples/widgets/tutorials/widgets/childwidget/CMakeLists.txt14
-rw-r--r--examples/widgets/tutorials/widgets/nestedlayouts/CMakeLists.txt14
-rw-r--r--examples/widgets/tutorials/widgets/toplevel/CMakeLists.txt14
-rw-r--r--examples/widgets/tutorials/widgets/windowlayout/CMakeLists.txt14
-rw-r--r--examples/widgets/widgets/CMakeLists.txt2
-rw-r--r--examples/widgets/widgets/analogclock/CMakeLists.txt14
-rw-r--r--examples/widgets/widgets/calculator/CMakeLists.txt14
-rw-r--r--examples/widgets/widgets/calendarwidget/CMakeLists.txt14
-rw-r--r--examples/widgets/widgets/charactermap/CMakeLists.txt14
-rw-r--r--examples/widgets/widgets/codeeditor/CMakeLists.txt14
-rw-r--r--examples/widgets/widgets/digitalclock/CMakeLists.txt14
-rw-r--r--examples/widgets/widgets/elidedlabel/CMakeLists.txt14
-rw-r--r--examples/widgets/widgets/groupbox/CMakeLists.txt14
-rw-r--r--examples/widgets/widgets/icons/.prev_CMakeLists.txt47
-rw-r--r--examples/widgets/widgets/icons/CMakeLists.txt16
-rw-r--r--examples/widgets/widgets/imageviewer/.prev_CMakeLists.txt46
-rw-r--r--examples/widgets/widgets/imageviewer/CMakeLists.txt21
-rw-r--r--examples/widgets/widgets/lineedits/CMakeLists.txt14
-rw-r--r--examples/widgets/widgets/mousebuttons/CMakeLists.txt14
-rw-r--r--examples/widgets/widgets/movie/CMakeLists.txt14
-rw-r--r--examples/widgets/widgets/scribble/.prev_CMakeLists.txt47
-rw-r--r--examples/widgets/widgets/scribble/CMakeLists.txt21
-rw-r--r--examples/widgets/widgets/shapedclock/CMakeLists.txt14
-rw-r--r--examples/widgets/widgets/sliders/CMakeLists.txt14
-rw-r--r--examples/widgets/widgets/spinboxes/CMakeLists.txt14
-rw-r--r--examples/widgets/widgets/styles/CMakeLists.txt17
-rw-r--r--examples/widgets/widgets/stylesheet/CMakeLists.txt16
-rw-r--r--examples/widgets/widgets/tablet/CMakeLists.txt17
-rw-r--r--examples/widgets/widgets/tetrix/CMakeLists.txt14
-rw-r--r--examples/widgets/widgets/tooltips/CMakeLists.txt17
-rw-r--r--examples/widgets/widgets/validators/CMakeLists.txt14
-rw-r--r--examples/widgets/widgets/wiggly/CMakeLists.txt14
-rw-r--r--examples/widgets/widgets/windowflags/CMakeLists.txt14
-rw-r--r--examples/widgets/windowcontainer/CMakeLists.txt15
-rw-r--r--examples/xml/CMakeLists.txt2
-rw-r--r--examples/xml/dombookmarks/CMakeLists.txt15
-rw-r--r--examples/xml/htmlinfo/.prev_CMakeLists.txt44
-rw-r--r--examples/xml/htmlinfo/CMakeLists.txt15
-rw-r--r--examples/xml/rsslisting/CMakeLists.txt16
-rw-r--r--examples/xml/streambookmarks/CMakeLists.txt15
-rw-r--r--examples/xml/xmlstreamlint/.prev_CMakeLists.txt35
-rw-r--r--examples/xml/xmlstreamlint/CMakeLists.txt14
372 files changed, 3357 insertions, 5452 deletions
diff --git a/examples/corelib/CMakeLists.txt b/examples/corelib/CMakeLists.txt
index 08b44649b7..aff53c8202 100644
--- a/examples/corelib/CMakeLists.txt
+++ b/examples/corelib/CMakeLists.txt
@@ -1,5 +1,4 @@
-# Generated from corelib.pro.
-
+add_subdirectory(bindableproperties)
add_subdirectory(ipc)
add_subdirectory(mimetypes)
add_subdirectory(serialization)
diff --git a/examples/corelib/bindableproperties/CMakeLists.txt b/examples/corelib/bindableproperties/CMakeLists.txt
new file mode 100644
index 0000000000..c6d9076fd8
--- /dev/null
+++ b/examples/corelib/bindableproperties/CMakeLists.txt
@@ -0,0 +1,2 @@
+qt_internal_add_example(bindablesubscription)
+qt_internal_add_example(subscription)
diff --git a/examples/corelib/bindableproperties/bindableproperties.pro b/examples/corelib/bindableproperties/bindableproperties.pro
new file mode 100644
index 0000000000..fab8d8107a
--- /dev/null
+++ b/examples/corelib/bindableproperties/bindableproperties.pro
@@ -0,0 +1,4 @@
+TEMPLATE = subdirs
+SUBDIRS = \
+ bindablesubscription \
+ subscription
diff --git a/examples/corelib/bindableproperties/bindablesubscription/CMakeLists.txt b/examples/corelib/bindableproperties/bindablesubscription/CMakeLists.txt
new file mode 100644
index 0000000000..6332c45e1a
--- /dev/null
+++ b/examples/corelib/bindableproperties/bindablesubscription/CMakeLists.txt
@@ -0,0 +1,48 @@
+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()
+
+set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/corelib/bindableproperties/bindablesubscription")
+
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+
+qt_add_executable(bindablesubscription
+ ../shared/subscriptionwindow.cpp ../shared/subscriptionwindow.h ../shared/subscriptionwindow.ui
+ main.cpp
+ bindablesubscription.cpp bindablesubscription.h
+ bindableuser.cpp bindableuser.h
+)
+
+target_link_libraries(bindablesubscription PUBLIC
+ Qt::Core
+ Qt::Gui
+ Qt::Widgets
+)
+
+# Resources:
+set(countries_resource_files
+ "../shared/finland.png"
+ "../shared/germany.png"
+ "../shared/norway.png"
+)
+
+qt_add_resources(bindablesubscription "countries"
+ PREFIX
+ "/"
+ BASE
+ "../shared"
+ FILES
+ ${countries_resource_files}
+)
+
+install(TARGETS bindablesubscription
+ RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
+ BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
+ LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
+)
diff --git a/examples/corelib/bindableproperties/bindablesubscription/bindablesubscription.cpp b/examples/corelib/bindableproperties/bindablesubscription/bindablesubscription.cpp
new file mode 100644
index 0000000000..14b28b3fae
--- /dev/null
+++ b/examples/corelib/bindableproperties/bindablesubscription/bindablesubscription.cpp
@@ -0,0 +1,98 @@
+/****************************************************************************
+**
+** Copyright (C) 2021 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "bindablesubscription.h"
+#include "bindableuser.h"
+
+//! [binding-expressions]
+
+BindableSubscription::BindableSubscription(BindableUser *user) : m_user(user)
+{
+ Q_ASSERT(user);
+
+ m_price.setBinding([this] { return qRound(calculateDiscount() * m_duration * basePrice()); });
+
+ m_isValid.setBinding([this] {
+ return m_user->country() != BindableUser::None && m_user->age() > 12;
+ });
+}
+
+//! [binding-expressions]
+
+//! [set-duration]
+
+void BindableSubscription::setDuration(Duration newDuration)
+{
+ m_duration = newDuration;
+}
+
+//! [set-duration]
+
+double BindableSubscription::calculateDiscount() const
+{
+ switch (m_duration) {
+ case Monthly:
+ return 1;
+ case Quarterly:
+ return 0.9;
+ case Yearly:
+ return 0.6;
+ }
+ Q_ASSERT(false);
+ return -1;
+}
+
+int BindableSubscription::basePrice() const
+{
+ if (m_user->country() == BindableUser::None)
+ return 0;
+
+ return (m_user->country() == BindableUser::Norway) ? 100 : 80;
+}
diff --git a/examples/corelib/bindableproperties/bindablesubscription/bindablesubscription.h b/examples/corelib/bindableproperties/bindablesubscription/bindablesubscription.h
new file mode 100644
index 0000000000..763864d627
--- /dev/null
+++ b/examples/corelib/bindableproperties/bindablesubscription/bindablesubscription.h
@@ -0,0 +1,91 @@
+/****************************************************************************
+**
+** Copyright (C) 2021 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef BINDABLESUBSCRIPTION_H
+#define BINDABLESUBSCRIPTION_H
+
+#include <QPointer>
+#include <QProperty>
+
+class BindableUser;
+
+//! [bindable-subscription-class]
+
+class BindableSubscription
+{
+public:
+ enum Duration { Monthly = 1, Quarterly = 4, Yearly = 12 };
+
+ BindableSubscription(BindableUser *user);
+ BindableSubscription(const BindableSubscription &) = delete;
+
+ int price() const { return m_price; }
+ QBindable<int> bindablePrice() { return &m_price; }
+
+ Duration duration() const { return m_duration; }
+ void setDuration(Duration newDuration);
+ QBindable<Duration> bindableDuration() { return &m_duration; }
+
+ bool isValid() const { return m_isValid; }
+ QBindable<bool> bindableIsValid() { return &m_isValid; }
+
+private:
+ double calculateDiscount() const;
+ int basePrice() const;
+
+ BindableUser *m_user;
+ QProperty<Duration> m_duration { Monthly };
+ QProperty<int> m_price { 0 };
+ QProperty<bool> m_isValid { false };
+};
+
+//! [bindable-subscription-class]
+
+#endif // BNDABLESUBSCRIPTION_H
diff --git a/examples/corelib/bindableproperties/bindablesubscription/bindablesubscription.pro b/examples/corelib/bindableproperties/bindablesubscription/bindablesubscription.pro
new file mode 100644
index 0000000000..321a1226c4
--- /dev/null
+++ b/examples/corelib/bindableproperties/bindablesubscription/bindablesubscription.pro
@@ -0,0 +1,22 @@
+QT += widgets
+TARGET = bindablesubscription
+
+SOURCES += main.cpp \
+ bindablesubscription.cpp \
+ bindableuser.cpp \
+ ../shared/subscriptionwindow.cpp
+
+target.path = $$[QT_INSTALL_EXAMPLES]/corelib/bindableproperties/bindablesubscription
+INSTALLS += target
+
+FORMS += \
+ ../shared/subscriptionwindow.ui
+
+HEADERS += \
+ bindablesubscription.h \
+ bindableuser.h \
+ ../shared/subscriptionwindow.h
+
+RESOURCES += \
+ ../shared/countries.qrc
+
diff --git a/examples/corelib/bindableproperties/bindablesubscription/bindableuser.cpp b/examples/corelib/bindableproperties/bindablesubscription/bindableuser.cpp
new file mode 100644
index 0000000000..d30e203b61
--- /dev/null
+++ b/examples/corelib/bindableproperties/bindablesubscription/bindableuser.cpp
@@ -0,0 +1,65 @@
+/****************************************************************************
+**
+** Copyright (C) 2021 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "bindableuser.h"
+
+//! [bindable-user-setters]
+
+void BindableUser::setCountry(Country country)
+{
+ m_country = country;
+}
+
+void BindableUser::setAge(int age)
+{
+ m_age = age;
+}
+
+//! [bindable-user-setters]
diff --git a/examples/corelib/bindableproperties/bindablesubscription/bindableuser.h b/examples/corelib/bindableproperties/bindablesubscription/bindableuser.h
new file mode 100644
index 0000000000..65541e6ac1
--- /dev/null
+++ b/examples/corelib/bindableproperties/bindablesubscription/bindableuser.h
@@ -0,0 +1,86 @@
+/****************************************************************************
+**
+** Copyright (C) 2021 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef BINDABLEUSER_H
+#define BINDABLEUSER_H
+
+#include <QProperty>
+
+//! [bindable-user-class]
+
+class BindableUser
+{
+public:
+ enum Country {
+ None,
+ Finland,
+ Germany,
+ Norway,
+ };
+
+ BindableUser() = default;
+ BindableUser(const BindableUser &) = delete;
+
+ Country country() const { return m_country; }
+ void setCountry(Country country);
+ QBindable<Country> bindableCountry() { return &m_country; }
+
+ int age() const { return m_age; }
+ void setAge(int age);
+ QBindable<int> bindableAge() { return &m_age; }
+
+private:
+ QProperty<Country> m_country { None };
+ QProperty<int> m_age { 0 };
+};
+
+//! [bindable-user-class]
+
+#endif // BINDABLEUSER_H
diff --git a/examples/corelib/bindableproperties/bindablesubscription/main.cpp b/examples/corelib/bindableproperties/bindablesubscription/main.cpp
new file mode 100644
index 0000000000..df935679ad
--- /dev/null
+++ b/examples/corelib/bindableproperties/bindablesubscription/main.cpp
@@ -0,0 +1,118 @@
+/****************************************************************************
+**
+** Copyright (C) 2021 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "../shared/subscriptionwindow.h"
+#include "bindablesubscription.h"
+#include "bindableuser.h"
+
+#include <QApplication>
+#include <QButtonGroup>
+#include <QLabel>
+#include <QPushButton>
+#include <QRadioButton>
+#include <QSpinBox>
+
+int main(int argc, char *argv[])
+{
+ QApplication a(argc, argv);
+ BindableUser user;
+ BindableSubscription subscription(&user);
+
+ SubscriptionWindow w;
+
+ // Initialize subscription data
+ QRadioButton *monthly = w.findChild<QRadioButton *>("btnMonthly");
+ QObject::connect(monthly, &QRadioButton::clicked, [&] {
+ subscription.setDuration(BindableSubscription::Monthly);
+ });
+ QRadioButton *quarterly = w.findChild<QRadioButton *>("btnQuarterly");
+ QObject::connect(quarterly, &QRadioButton::clicked, [&] {
+ subscription.setDuration(BindableSubscription::Quarterly);
+ });
+ QRadioButton *yearly = w.findChild<QRadioButton *>("btnYearly");
+ QObject::connect(yearly, &QRadioButton::clicked, [&] {
+ subscription.setDuration(BindableSubscription::Yearly);
+ });
+
+ // Initialize user data
+ QPushButton *germany = w.findChild<QPushButton *>("btnGermany");
+ QObject::connect(germany, &QPushButton::clicked, [&] {
+ user.setCountry(BindableUser::Germany);
+ });
+ QPushButton *finland = w.findChild<QPushButton *>("btnFinland");
+ QObject::connect(finland, &QPushButton::clicked, [&] {
+ user.setCountry(BindableUser::Finland);
+ });
+ QPushButton *norway = w.findChild<QPushButton *>("btnNorway");
+ QObject::connect(norway, &QPushButton::clicked, [&] {
+ user.setCountry(BindableUser::Norway);
+ });
+
+ QSpinBox *ageSpinBox = w.findChild<QSpinBox *>("ageSpinBox");
+ QObject::connect(ageSpinBox, &QSpinBox::valueChanged, [&](int value) {
+ user.setAge(value);
+ });
+
+ QLabel *priceDisplay = w.findChild<QLabel *>("priceDisplay");
+
+ // Track price changes
+//! [update-ui]
+ auto priceChangeHandler = subscription.bindablePrice().subscribe([&] {
+ priceDisplay->setText(QString::number(subscription.price()));
+ });
+
+ auto priceValidHandler = subscription.bindableIsValid().subscribe([&] {
+ priceDisplay->setEnabled(subscription.isValid());
+ });
+//! [update-ui]
+
+ w.show();
+ return a.exec();
+}
diff --git a/examples/corelib/bindableproperties/doc/images/bindable_properties_example.png b/examples/corelib/bindableproperties/doc/images/bindable_properties_example.png
new file mode 100644
index 0000000000..f38261a217
--- /dev/null
+++ b/examples/corelib/bindableproperties/doc/images/bindable_properties_example.png
Binary files differ
diff --git a/examples/corelib/bindableproperties/doc/src/bindableproperties.qdoc b/examples/corelib/bindableproperties/doc/src/bindableproperties.qdoc
new file mode 100644
index 0000000000..8c36921ff8
--- /dev/null
+++ b/examples/corelib/bindableproperties/doc/src/bindableproperties.qdoc
@@ -0,0 +1,202 @@
+/****************************************************************************
+**
+** Copyright (C) 2021 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Free Documentation License Usage
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \example bindableproperties
+ \title Bindable Properties Example
+ \brief Demonstrates how the usage of bindable properties can simplify
+ your C++ code.
+
+ In this example we will demonstrate two approaches for expressing the
+ relationships between different objects depending on each other:
+ signal/slot connection-based and bindable property-based. For this
+ purpose we will consider a subscription service model to calculate the
+ cost of the subscription.
+
+ \image bindable_properties_example.png
+
+ \section1 Modelling Subscription System with Signal/Slot Approach
+
+ Let's first consider the usual pre-Qt 6 implementation.
+ To model the subscription service the \c Subscription class is used:
+
+ \snippet bindableproperties/subscription/subscription.h subscription-class
+
+ It stores the information about the subscription and provides corresponding
+ getters, setters, and notifier signals for informing the listeners about the
+ subscription information changes. It also keeps a pointer to an instance of
+ the \c User class.
+
+ The price of the subscription is calculated based on the duration of the
+ subscription:
+
+ \snippet bindableproperties/subscription/subscription.cpp calculate-discount
+
+ And user's location:
+
+ \snippet bindableproperties/subscription/subscription.cpp calculate-base-price
+
+ When the price changes, the \c priceChanged() signal is emitted, to notify the
+ listeners about the change:
+
+ \snippet bindableproperties/subscription/subscription.cpp calculate-price
+
+ Similarly, when the duration of the subscription changes, the \c durationChanged()
+ signal is emitted.
+
+ \snippet bindableproperties/subscription/subscription.cpp set-duration
+
+ \note Both methods need to check if the data is actually changed and
+ only then emit the signals. \c setDuration() also needs to recalculate
+ the price, when the duration has changed.
+
+ The \c Subscription is not valid unless the user has a valid country and
+ age, so the validity is updated in the following way:
+
+ \snippet bindableproperties/subscription/subscription.cpp update-validity
+
+ The \c User class is simple: it stores country and age of the user and
+ provides the corresponding getters, setters, and notifier signals:
+
+ \snippet bindableproperties/subscription/user.h user-class
+
+ \snippet bindableproperties/subscription/user.cpp user-setters
+
+ In the \c main() function we initialize instances of \c User and
+ \c Subsrcription:
+
+ \snippet bindableproperties/subscription/main.cpp init
+
+ And do the proper signal-slot connections, to update the \c user and
+ \c subsrcription data when UI elements change. That is straightforward,
+ so we will skip this part.
+
+ Next, we connect to \c Subscription::priceChanged(), to update the price
+ in the UI when the price changes.
+
+ \snippet bindableproperties/subscription/main.cpp connect-price-changed
+
+ We also connect to \c Subscription::isValidChanged(), to disable the price
+ display if the subscription isn't valid.
+
+ \snippet bindableproperties/subscription/main.cpp connect-validity-changed
+
+ Because the subsrcription price and validity also depend on the user's
+ country and age, we also need to connect to the \c User::countryChanged()
+ and \c User::ageChanged() signals and update \c subscription accordingly.
+
+ \snippet bindableproperties/subscription/main.cpp connect-user
+
+ This works, but there are some problems:
+
+ \list
+ \li There's a lot of boilerplate code for the signal-slot connections,
+ to be able to react to changes to \c user or \c subscription. If any of
+ the dependencies of the price changes, we need to remember to emit the
+ corresponding notifier signals, to recalculate the price and update it in
+ the UI.
+ \li If more dependencies for price calculation are added in future, we'll
+ need to add more signal-slot connections and make sure all the dependencies
+ are properly updated whenever any of them changes. The overall complexity
+ will grow, and the code will become harder to maintain.
+ \li The \c Subscription and \c User classes depend on the metaobject system
+ to be able to use the signal/slot mechanism.
+ \endlist
+
+ Can we do better?
+
+ \section1 Modeling Subscription System with Bindbable Properties
+
+ Now let's see how the \l {Qt Bindable Properties} can help to solve the
+ same problem. First, let's have a look at the \c BindableSubscription class,
+ which is similar to the \c Subscription class, but is implemented using the
+ bindable properties:
+
+ \snippet bindableproperties/bindablesubscription/bindablesubscription.h bindable-subscription-class
+
+ The first difference we can notice, is that the data fields are now wrapped
+ inside \l QProperty classes, and the notifier signals (and as a consequence the
+ dependency from the metaobject system) are gone, and new methods returning a
+ \l QBindable for each \l QProperty are added instead. The \c calculatePrice()
+ and \c updateValidty() methods are also removed. We'll see below why they aren't
+ needed anymore.
+
+ The \c BindableUser class differs from the \c User class in a similar way:
+
+ \snippet bindableproperties/bindablesubscription/bindableuser.h bindable-user-class
+
+ The second differenece is in the implementation of these calsses. First of
+ all, the dependencies between \c subscription and \c user are now tracked via
+ binding expressions:
+
+ \snippet bindableproperties/bindablesubscription/bindablesubscription.cpp binding-expressions
+
+ Behind the scenes the bindable properties track the dependency changes and
+ update the property's value whenever a change is detected. So if, for example,
+ user's country or age is changed, subscription's price and validity will be
+ updated automatically.
+
+ Another difference is that the setters are now trivial:
+
+ \snippet bindableproperties/bindablesubscription/bindablesubscription.cpp set-duration
+
+ \snippet bindableproperties/bindablesubscription/bindableuser.cpp bindable-user-setters
+
+ There's no need to check inside the setters if the property's value has
+ actually changed, \l QProperty already does that. The dependent properties
+ will be notified about the change only if the value has actually changed.
+
+ The code for updating the information about the price in the UI is also
+ simplified:
+
+ \snippet bindableproperties/bindablesubscription/main.cpp update-ui
+
+ We subscribe to changes via \c bindablePrice() and \c bindableIsValid()
+ and update the price display accordingly when any of these properties
+ changes the value. The subscriptions will stay alive as long as the
+ corresponding handlers are alive.
+
+ Also note that the copy constructors of both \c BindableSubsrciption and
+ \c BindableUser are disabled, since it's not defined what should happen
+ with their bindings when copying.
+
+ As you can see, the code became much simpler, and the problems mentioned
+ above are solved:
+
+ \list
+ \li The boilerplate code for the signal-slot connections is removed, the
+ dependencies are now tracked automatically.
+ \li The code is easier to maintain. Adding more dependencies in future
+ will only require adding the corresponding bindable properties and setting
+ the binding expressions that reflect the relationships between each other.
+ \li The \c Subscription and \c User classes don't depend on the metaobject
+ system anymore. Of course, you can still expose them to the metaobject
+ system and add \l {Q_PROPERTY}s if you need, and have the advantages of
+ bindable properties both in \c C++ and \c QML code. You can use the
+ \l QObjectBindableProperty class for that.
+ \endlist
+*/
diff --git a/examples/corelib/bindableproperties/shared/countries.qrc b/examples/corelib/bindableproperties/shared/countries.qrc
new file mode 100644
index 0000000000..cdf6312ebb
--- /dev/null
+++ b/examples/corelib/bindableproperties/shared/countries.qrc
@@ -0,0 +1,7 @@
+<RCC>
+ <qresource prefix="/">
+ <file>germany.png</file>
+ <file>norway.png</file>
+ <file>finland.png</file>
+ </qresource>
+</RCC>
diff --git a/examples/corelib/bindableproperties/shared/finland.png b/examples/corelib/bindableproperties/shared/finland.png
new file mode 100644
index 0000000000..92653289c1
--- /dev/null
+++ b/examples/corelib/bindableproperties/shared/finland.png
Binary files differ
diff --git a/examples/corelib/bindableproperties/shared/germany.png b/examples/corelib/bindableproperties/shared/germany.png
new file mode 100644
index 0000000000..efc389f52a
--- /dev/null
+++ b/examples/corelib/bindableproperties/shared/germany.png
Binary files differ
diff --git a/examples/corelib/bindableproperties/shared/norway.png b/examples/corelib/bindableproperties/shared/norway.png
new file mode 100644
index 0000000000..daee6c3c15
--- /dev/null
+++ b/examples/corelib/bindableproperties/shared/norway.png
Binary files differ
diff --git a/examples/corelib/bindableproperties/shared/subscriptionwindow.cpp b/examples/corelib/bindableproperties/shared/subscriptionwindow.cpp
new file mode 100644
index 0000000000..03269dfa0c
--- /dev/null
+++ b/examples/corelib/bindableproperties/shared/subscriptionwindow.cpp
@@ -0,0 +1,63 @@
+/****************************************************************************
+**
+** Copyright (C) 2021 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "subscriptionwindow.h"
+#include "ui_subscriptionwindow.h"
+
+SubscriptionWindow::SubscriptionWindow(QWidget *parent)
+ : QWidget(parent), ui(new Ui::SubscriptionWindow)
+{
+ ui->setupUi(this);
+}
+
+SubscriptionWindow::~SubscriptionWindow()
+{
+ delete ui;
+}
diff --git a/examples/corelib/bindableproperties/shared/subscriptionwindow.h b/examples/corelib/bindableproperties/shared/subscriptionwindow.h
new file mode 100644
index 0000000000..9bc3acd91a
--- /dev/null
+++ b/examples/corelib/bindableproperties/shared/subscriptionwindow.h
@@ -0,0 +1,76 @@
+/****************************************************************************
+**
+** Copyright (C) 2021 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef SUBSCRIPTIONWINDOW_H
+#define SUBSCRIPTIONWINDOW_H
+
+#include <QWidget>
+
+QT_BEGIN_NAMESPACE
+namespace Ui {
+class SubscriptionWindow;
+}
+QT_END_NAMESPACE
+
+class User;
+
+class SubscriptionWindow : public QWidget
+{
+ Q_OBJECT
+
+public:
+ explicit SubscriptionWindow(QWidget *parent = nullptr);
+ ~SubscriptionWindow();
+
+private:
+ Ui::SubscriptionWindow *ui;
+};
+
+#endif // SUBSCRIPTIONWINDOW_H
diff --git a/examples/corelib/bindableproperties/shared/subscriptionwindow.ui b/examples/corelib/bindableproperties/shared/subscriptionwindow.ui
new file mode 100644
index 0000000000..7bc2931373
--- /dev/null
+++ b/examples/corelib/bindableproperties/shared/subscriptionwindow.ui
@@ -0,0 +1,280 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>SubscriptionWindow</class>
+ <widget class="QWidget" name="SubscriptionWindow">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>639</width>
+ <height>269</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Subscription</string>
+ </property>
+ <layout class="QHBoxLayout" name="horizontalLayout_5">
+ <item>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_4" stretch="0,0,0,0">
+ <item>
+ <spacer name="horizontalSpacer_3">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QPushButton" name="btnGermany">
+ <property name="toolTip">
+ <string>Germany</string>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ <property name="icon">
+ <iconset>
+ <normaloff>:/germany.png</normaloff>:/germany.png</iconset>
+ </property>
+ <property name="iconSize">
+ <size>
+ <width>32</width>
+ <height>32</height>
+ </size>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="btnNorway">
+ <property name="toolTip">
+ <string>Norway</string>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ <property name="icon">
+ <iconset>
+ <normaloff>:/norway.png</normaloff>:/norway.png</iconset>
+ </property>
+ <property name="iconSize">
+ <size>
+ <width>32</width>
+ <height>32</height>
+ </size>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="btnFinland">
+ <property name="toolTip">
+ <string>Finland</string>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ <property name="icon">
+ <iconset>
+ <normaloff>:/finland.png</normaloff>:/finland.png</iconset>
+ </property>
+ <property name="iconSize">
+ <size>
+ <width>32</width>
+ <height>32</height>
+ </size>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <item>
+ <widget class="QLabel" name="ageLabel">
+ <property name="font">
+ <font>
+ <pointsize>14</pointsize>
+ <weight>75</weight>
+ <bold>true</bold>
+ </font>
+ </property>
+ <property name="text">
+ <string>Age</string>
+ </property>
+ <property name="margin">
+ <number>3</number>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QSpinBox" name="ageSpinBox">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>80</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="value">
+ <number>0</number>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <spacer name="verticalSpacer">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_2">
+ <item>
+ <widget class="QLabel" name="intervalLabel">
+ <property name="font">
+ <font>
+ <pointsize>14</pointsize>
+ <weight>75</weight>
+ <bold>true</bold>
+ </font>
+ </property>
+ <property name="text">
+ <string>Interval</string>
+ </property>
+ <property name="margin">
+ <number>3</number>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QRadioButton" name="btnMonthly">
+ <property name="text">
+ <string>Monthly</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QRadioButton" name="btnQuarterly">
+ <property name="text">
+ <string>Quarterly</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QRadioButton" name="btnYearly">
+ <property name="text">
+ <string>Yearly</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <spacer name="verticalSpacer_2">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_3">
+ <item>
+ <widget class="QLabel" name="priceLabel">
+ <property name="font">
+ <font>
+ <pointsize>14</pointsize>
+ <weight>75</weight>
+ <bold>true</bold>
+ </font>
+ </property>
+ <property name="text">
+ <string>Price/month</string>
+ </property>
+ <property name="margin">
+ <number>3</number>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="priceDisplay">
+ <property name="text">
+ <string>0.0</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer_2">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <spacer name="verticalSpacer_3">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/examples/corelib/bindableproperties/subscription/CMakeLists.txt b/examples/corelib/bindableproperties/subscription/CMakeLists.txt
new file mode 100644
index 0000000000..9b624e4e29
--- /dev/null
+++ b/examples/corelib/bindableproperties/subscription/CMakeLists.txt
@@ -0,0 +1,48 @@
+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()
+
+set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/corelib/bindableproperties/subscription")
+
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
+
+qt_add_executable(subscription
+ ../shared/subscriptionwindow.cpp ../shared/subscriptionwindow.h ../shared/subscriptionwindow.ui
+ main.cpp
+ subscription.cpp subscription.h
+ user.cpp user.h
+)
+
+target_link_libraries(subscription PUBLIC
+ Qt::Core
+ Qt::Gui
+ Qt::Widgets
+)
+
+# Resources:
+set(countries_resource_files
+ "../shared/finland.png"
+ "../shared/germany.png"
+ "../shared/norway.png"
+)
+
+qt_add_resources(subscription "countries"
+ PREFIX
+ "/"
+ BASE
+ "../shared"
+ FILES
+ ${countries_resource_files}
+)
+
+install(TARGETS subscription
+ RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
+ BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
+ LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
+)
diff --git a/examples/corelib/bindableproperties/subscription/main.cpp b/examples/corelib/bindableproperties/subscription/main.cpp
new file mode 100644
index 0000000000..6ff0c960f1
--- /dev/null
+++ b/examples/corelib/bindableproperties/subscription/main.cpp
@@ -0,0 +1,138 @@
+/****************************************************************************
+**
+** Copyright (C) 2021 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "../shared/subscriptionwindow.h"
+#include "subscription.h"
+#include "user.h"
+
+#include <QApplication>
+#include <QButtonGroup>
+#include <QLabel>
+#include <QPushButton>
+#include <QRadioButton>
+#include <QSpinBox>
+
+int main(int argc, char *argv[])
+{
+ QApplication a(argc, argv);
+
+//! [init]
+ User user;
+ Subscription subscription(&user);
+//! [init]
+
+ SubscriptionWindow w;
+
+ // Initialize subscription data
+ QRadioButton *monthly = w.findChild<QRadioButton *>("btnMonthly");
+ QObject::connect(monthly, &QRadioButton::clicked, &subscription, [&] {
+ subscription.setDuration(Subscription::Monthly);
+ });
+ QRadioButton *quarterly = w.findChild<QRadioButton *>("btnQuarterly");
+ QObject::connect(quarterly, &QRadioButton::clicked, &subscription, [&] {
+ subscription.setDuration(Subscription::Quarterly);
+ });
+ QRadioButton *yearly = w.findChild<QRadioButton *>("btnYearly");
+ QObject::connect(yearly, &QRadioButton::clicked, &subscription, [&] {
+ subscription.setDuration(Subscription::Yearly);
+ });
+
+ // Initialize user data
+ QPushButton *germany = w.findChild<QPushButton *>("btnGermany");
+ QObject::connect(germany, &QPushButton::clicked, &user, [&] {
+ user.setCountry(User::Germany);
+ });
+ QPushButton *finland = w.findChild<QPushButton *>("btnFinland");
+ QObject::connect(finland, &QPushButton::clicked, &user, [&] {
+ user.setCountry(User::Finland);
+ });
+ QPushButton *norway = w.findChild<QPushButton *>("btnNorway");
+ QObject::connect(norway, &QPushButton::clicked, &user, [&] {
+ user.setCountry(User::Norway);
+ });
+
+ QSpinBox *ageSpinBox = w.findChild<QSpinBox *>("ageSpinBox");
+ QObject::connect(ageSpinBox, &QSpinBox::valueChanged, &user, [&](int value) {
+ user.setAge(value);
+ });
+
+ // Initialize price data
+ QLabel *priceDisplay = w.findChild<QLabel *>("priceDisplay");
+ priceDisplay->setText(QString::number(subscription.price()));
+ priceDisplay->setEnabled(subscription.isValid());
+
+ // Track the price changes
+
+//! [connect-price-changed]
+ QObject::connect(&subscription, &Subscription::priceChanged, [&] {
+ priceDisplay->setText(QString::number(subscription.price()));
+ });
+//! [connect-price-changed]
+
+//! [connect-validity-changed]
+ QObject::connect(&subscription, &Subscription::isValidChanged, [&] {
+ priceDisplay->setEnabled(subscription.isValid());
+ });
+//! [connect-validity-changed]
+
+//! [connect-user]
+ QObject::connect(&user, &User::countryChanged, [&] {
+ subscription.calculatePrice();
+ subscription.updateValidity();
+ });
+
+ QObject::connect(&user, &User::ageChanged, [&] {
+ subscription.updateValidity();
+ });
+//! [connect-user]
+
+ w.show();
+ return a.exec();
+}
diff --git a/examples/corelib/bindableproperties/subscription/subscription.cpp b/examples/corelib/bindableproperties/subscription/subscription.cpp
new file mode 100644
index 0000000000..20efe825f3
--- /dev/null
+++ b/examples/corelib/bindableproperties/subscription/subscription.cpp
@@ -0,0 +1,126 @@
+/****************************************************************************
+**
+** Copyright (C) 2021 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "subscription.h"
+#include "user.h"
+
+Subscription::Subscription(User *user) : m_user(user)
+{
+ Q_ASSERT(user);
+}
+
+//! [calculate-price]
+
+void Subscription::calculatePrice()
+{
+ const auto oldPrice = m_price;
+
+ m_price = qRound(calculateDiscount() * m_duration * basePrice());
+ if (m_price != oldPrice)
+ emit priceChanged();
+}
+
+//! [calculate-price]
+
+//! [set-duration]
+
+void Subscription::setDuration(Duration newDuration)
+{
+ if (newDuration != m_duration) {
+ m_duration = newDuration;
+ calculatePrice();
+ emit durationChanged();
+ }
+}
+
+//! [set-duration]
+
+//! [calculate-discount]
+
+double Subscription::calculateDiscount() const
+{
+ switch (m_duration) {
+ case Monthly:
+ return 1;
+ case Quarterly:
+ return 0.9;
+ case Yearly:
+ return 0.6;
+ }
+ Q_ASSERT(false);
+ return -1;
+}
+
+//! [calculate-discount]
+
+//! [calculate-base-price]
+
+int Subscription::basePrice() const
+{
+ if (m_user->country() == User::None)
+ return 0;
+
+ return (m_user->country() == User::Norway) ? 100 : 80;
+}
+
+//! [calculate-base-price]
+
+//! [update-validity]
+
+void Subscription::updateValidity()
+{
+ bool isValid = m_isValid;
+ m_isValid = m_user->country() != User::None && m_user->age() > 12;
+
+ if (m_isValid != isValid)
+ emit isValidChanged();
+}
+
+//! [update-validity]
diff --git a/examples/corelib/bindableproperties/subscription/subscription.h b/examples/corelib/bindableproperties/subscription/subscription.h
new file mode 100644
index 0000000000..41d052e86f
--- /dev/null
+++ b/examples/corelib/bindableproperties/subscription/subscription.h
@@ -0,0 +1,95 @@
+/****************************************************************************
+**
+** Copyright (C) 2021 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef SUBSCRIPTION_H
+#define SUBSCRIPTION_H
+
+#include <QObject>
+#include <QPointer>
+
+class User;
+
+//! [subscription-class]
+
+class Subscription : public QObject
+{
+ Q_OBJECT
+public:
+ enum Duration { Monthly = 1, Quarterly = 4, Yearly = 12 };
+
+ Subscription(User *user);
+
+ void calculatePrice();
+ int price() const { return m_price; }
+
+ Duration duration() const { return m_duration; }
+ void setDuration(Duration newDuration);
+
+ bool isValid() const { return m_isValid; }
+ void updateValidity();
+
+signals:
+ void priceChanged();
+ void durationChanged();
+ void isValidChanged();
+
+private:
+ double calculateDiscount() const;
+ int basePrice() const;
+
+ QPointer<User> m_user;
+ Duration m_duration = Monthly;
+ int m_price = 0;
+ bool m_isValid = false;
+};
+
+//! [subscription-class]
+
+#endif // SUBSCRIPTION_H
diff --git a/examples/corelib/bindableproperties/subscription/subscription.pro b/examples/corelib/bindableproperties/subscription/subscription.pro
new file mode 100644
index 0000000000..68910904bb
--- /dev/null
+++ b/examples/corelib/bindableproperties/subscription/subscription.pro
@@ -0,0 +1,22 @@
+QT += widgets
+TARGET = subscription
+
+SOURCES += main.cpp \
+ subscription.cpp \
+ user.cpp \
+ ../shared/subscriptionwindow.cpp
+
+target.path = $$[QT_INSTALL_EXAMPLES]/corelib/bindableproperties/subscription
+INSTALLS += target
+
+FORMS += \
+ ../shared/subscriptionwindow.ui
+
+HEADERS += \
+ subscription.h \
+ user.h \
+ ../shared/subscriptionwindow.h
+
+RESOURCES += \
+ ../shared/countries.qrc
+
diff --git a/examples/corelib/bindableproperties/subscription/user.cpp b/examples/corelib/bindableproperties/subscription/user.cpp
new file mode 100644
index 0000000000..c2b0835330
--- /dev/null
+++ b/examples/corelib/bindableproperties/subscription/user.cpp
@@ -0,0 +1,71 @@
+/****************************************************************************
+**
+** Copyright (C) 2021 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "user.h"
+
+//! [user-setters]
+
+void User::setCountry(Country country)
+{
+ if (m_country != country) {
+ m_country = country;
+ emit countryChanged();
+ }
+}
+
+void User::setAge(int age)
+{
+ if (m_age != age) {
+ m_age = age;
+ emit ageChanged();
+ }
+}
+
+//! [user-setters]
diff --git a/examples/corelib/bindableproperties/subscription/user.h b/examples/corelib/bindableproperties/subscription/user.h
new file mode 100644
index 0000000000..8c9ebb1009
--- /dev/null
+++ b/examples/corelib/bindableproperties/subscription/user.h
@@ -0,0 +1,86 @@
+/****************************************************************************
+**
+** Copyright (C) 2021 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef USER_H
+#define USER_H
+
+#include <QObject>
+
+//! [user-class]
+
+class User : public QObject
+{
+ Q_OBJECT
+
+public:
+ enum Country {
+ None,
+ Finland,
+ Germany,
+ Norway,
+ };
+
+ Country country() const { return m_country; }
+ void setCountry(Country country);
+
+ int age() const { return m_age; }
+ void setAge(int age);
+
+signals:
+ void countryChanged();
+ void ageChanged();
+
+private:
+ Country m_country = Country::None;
+ int m_age = 0;
+};
+
+//! [user-class]
+#endif // USER_H
diff --git a/examples/corelib/ipc/CMakeLists.txt b/examples/corelib/ipc/CMakeLists.txt
index 214fa4c553..9cc34c8ea2 100644
--- a/examples/corelib/ipc/CMakeLists.txt
+++ b/examples/corelib/ipc/CMakeLists.txt
@@ -1,5 +1,3 @@
-# Generated from ipc.pro.
-
if(NOT TARGET Qt::Widgets)
return()
endif()
diff --git a/examples/corelib/ipc/localfortuneclient/CMakeLists.txt b/examples/corelib/ipc/localfortuneclient/CMakeLists.txt
index e989a8e87f..c6b5d53e37 100644
--- a/examples/corelib/ipc/localfortuneclient/CMakeLists.txt
+++ b/examples/corelib/ipc/localfortuneclient/CMakeLists.txt
@@ -1,33 +1,26 @@
-# Generated from localfortuneclient.pro.
-
cmake_minimum_required(VERSION 3.16)
project(localfortuneclient LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/corelib/ipc/localfortuneclient")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Network)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Network Widgets)
qt_add_executable(localfortuneclient
client.cpp client.h
main.cpp
)
+
set_target_properties(localfortuneclient PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(localfortuneclient PUBLIC
Qt::Core
Qt::Gui
diff --git a/examples/corelib/ipc/localfortuneserver/CMakeLists.txt b/examples/corelib/ipc/localfortuneserver/CMakeLists.txt
index 85ec67238a..990dfddf3e 100644
--- a/examples/corelib/ipc/localfortuneserver/CMakeLists.txt
+++ b/examples/corelib/ipc/localfortuneserver/CMakeLists.txt
@@ -1,33 +1,26 @@
-# Generated from localfortuneserver.pro.
-
cmake_minimum_required(VERSION 3.16)
project(localfortuneserver LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/corelib/ipc/localfortuneserver")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Network)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Network Widgets)
qt_add_executable(localfortuneserver
main.cpp
server.cpp server.h
)
+
set_target_properties(localfortuneserver PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(localfortuneserver PUBLIC
Qt::Core
Qt::Gui
diff --git a/examples/corelib/ipc/sharedmemory/CMakeLists.txt b/examples/corelib/ipc/sharedmemory/CMakeLists.txt
index c98caf79f8..323c356b72 100644
--- a/examples/corelib/ipc/sharedmemory/CMakeLists.txt
+++ b/examples/corelib/ipc/sharedmemory/CMakeLists.txt
@@ -1,32 +1,27 @@
-# Generated from sharedmemory.pro.
-
cmake_minimum_required(VERSION 3.16)
project(sharedmemory LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/corelib/ipc/sharedmemory")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
qt_add_executable(sharedmemory
dialog.cpp dialog.h dialog.ui
main.cpp
)
+
set_target_properties(sharedmemory PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(sharedmemory PUBLIC
Qt::Core
Qt::Gui
diff --git a/examples/corelib/mimetypes/CMakeLists.txt b/examples/corelib/mimetypes/CMakeLists.txt
index 3124006aaa..79561aa0be 100644
--- a/examples/corelib/mimetypes/CMakeLists.txt
+++ b/examples/corelib/mimetypes/CMakeLists.txt
@@ -1,5 +1,3 @@
-# Generated from mimetypes.pro.
-
if(TARGET Qt::Widgets)
qt_internal_add_example(mimetypebrowser)
endif()
diff --git a/examples/corelib/mimetypes/mimetypebrowser/CMakeLists.txt b/examples/corelib/mimetypes/mimetypebrowser/CMakeLists.txt
index 313676fa8e..38abfba4b2 100644
--- a/examples/corelib/mimetypes/mimetypebrowser/CMakeLists.txt
+++ b/examples/corelib/mimetypes/mimetypebrowser/CMakeLists.txt
@@ -1,33 +1,27 @@
-# Generated from mimetypebrowser.pro.
-
cmake_minimum_required(VERSION 3.16)
project(mimetypebrowser LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/corelib/mimetypes/mimetypebrowser")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
qt_add_executable(mimetypebrowser
main.cpp
mainwindow.cpp mainwindow.h
mimetypemodel.cpp mimetypemodel.h
)
+
set_target_properties(mimetypebrowser PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE FALSE
)
+
target_link_libraries(mimetypebrowser PUBLIC
Qt::Core
Qt::Gui
diff --git a/examples/corelib/platform/androidnotifier/CMakeLists.txt b/examples/corelib/platform/androidnotifier/CMakeLists.txt
index fa5a7ce023..0caa208a95 100644
--- a/examples/corelib/platform/androidnotifier/CMakeLists.txt
+++ b/examples/corelib/platform/androidnotifier/CMakeLists.txt
@@ -1,55 +1,50 @@
cmake_minimum_required(VERSION 3.16)
project(androidnotifier LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
+if(NOT ANDROID)
+ message(FATAL_ERROR "Example only works on Android")
+endif()
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
-find_package(QT NAMES Qt6 Qt5 COMPONENTS Widgets REQUIRED)
-find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Widgets REQUIRED)
+find_package(Qt6 REQUIRED COMPONENTS Widgets)
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/corelib/platform/androidnotifier")
-set(PROJECT_SOURCES
- main.cpp
- notificationclient.cpp
- notificationclient.h
+qt_add_executable(androidnotifier
+ MANUAL_FINALIZATION
+ main.cpp
+ notificationclient.cpp
+ notificationclient.h
)
-if(ANDROID)
- qt_add_executable(androidnotifier
- MANUAL_FINALIZATION
- ${PROJECT_SOURCES})
- target_link_libraries(androidnotifier PRIVATE Qt${QT_VERSION_MAJOR}::Widgets)
-
- set_property(TARGET androidnotifier APPEND PROPERTY QT_ANDROID_PACKAGE_SOURCE_DIR
- ${CMAKE_CURRENT_SOURCE_DIR}/android)
-
- if(QT_VERSION_MAJOR EQUAL 6)
- qt_finalize_executable(androidnotifier)
- endif()
-
- set(qml_resource_files
- "images/happy.png"
- "images/sad.png"
- )
-
- qt6_add_resources(androidnotifier "main"
- PREFIX
- "/"
- FILES
- ${qml_resource_files}
- )
-
- install(TARGETS androidnotifier
- RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
- )
-endif()
+target_link_libraries(androidnotifier PRIVATE
+ Qt6::Widgets
+)
+
+set_property(TARGET androidnotifier APPEND PROPERTY QT_ANDROID_PACKAGE_SOURCE_DIR
+ ${CMAKE_CURRENT_SOURCE_DIR}/android)
+
+qt_finalize_executable(androidnotifier)
+
+set(qml_resource_files
+ "images/happy.png"
+ "images/sad.png"
+)
+
+qt_add_resources(androidnotifier "main"
+ PREFIX
+ "/"
+ FILES
+ ${qml_resource_files}
+)
+
+install(TARGETS androidnotifier
+ RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
+ BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
+ LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
+)
diff --git a/examples/corelib/serialization/CMakeLists.txt b/examples/corelib/serialization/CMakeLists.txt
index 486f5d0c14..7f3701ad99 100644
--- a/examples/corelib/serialization/CMakeLists.txt
+++ b/examples/corelib/serialization/CMakeLists.txt
@@ -1,5 +1,3 @@
-# Generated from serialization.pro.
-
qt_internal_add_example(cbordump)
qt_internal_add_example(convert)
qt_internal_add_example(savegame)
diff --git a/examples/corelib/serialization/cbordump/CMakeLists.txt b/examples/corelib/serialization/cbordump/CMakeLists.txt
index 106df4b24d..b64ec2524c 100644
--- a/examples/corelib/serialization/cbordump/CMakeLists.txt
+++ b/examples/corelib/serialization/cbordump/CMakeLists.txt
@@ -1,29 +1,20 @@
-# Generated from cbordump.pro.
-
cmake_minimum_required(VERSION 3.16)
project(cbordump LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/corelib/serialization/cbordump")
-find_package(Qt6 COMPONENTS Core)
+find_package(Qt6 REQUIRED COMPONENTS Core)
qt_add_executable(cbordump
main.cpp
)
-set_target_properties(cbordump PROPERTIES
- WIN32_EXECUTABLE FALSE
- MACOSX_BUNDLE FALSE
-)
+
target_link_libraries(cbordump PUBLIC
Qt::Core
)
diff --git a/examples/corelib/serialization/convert/CMakeLists.txt b/examples/corelib/serialization/convert/CMakeLists.txt
index 14de45381a..b8476253e6 100644
--- a/examples/corelib/serialization/convert/CMakeLists.txt
+++ b/examples/corelib/serialization/convert/CMakeLists.txt
@@ -1,21 +1,15 @@
-# Generated from convert.pro.
-
cmake_minimum_required(VERSION 3.16)
project(convert LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/corelib/serialization/convert")
-find_package(Qt6 COMPONENTS Core)
+find_package(Qt6 REQUIRED COMPONENTS Core)
qt_add_executable(convert
cborconverter.cpp cborconverter.h
@@ -27,10 +21,7 @@ qt_add_executable(convert
textconverter.cpp textconverter.h
xmlconverter.cpp xmlconverter.h
)
-set_target_properties(convert PROPERTIES
- WIN32_EXECUTABLE FALSE
- MACOSX_BUNDLE FALSE
-)
+
target_link_libraries(convert PUBLIC
Qt::Core
)
diff --git a/examples/corelib/serialization/savegame/CMakeLists.txt b/examples/corelib/serialization/savegame/CMakeLists.txt
index 18eda05e5d..f757d1359b 100644
--- a/examples/corelib/serialization/savegame/CMakeLists.txt
+++ b/examples/corelib/serialization/savegame/CMakeLists.txt
@@ -1,21 +1,15 @@
-# Generated from savegame.pro.
-
cmake_minimum_required(VERSION 3.16)
project(savegame LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/corelib/serialization/savegame")
-find_package(Qt6 COMPONENTS Core)
+find_package(Qt6 REQUIRED COMPONENTS Core)
qt_add_executable(savegame
character.cpp character.h
@@ -23,10 +17,7 @@ qt_add_executable(savegame
level.cpp level.h
main.cpp
)
-set_target_properties(savegame PROPERTIES
- WIN32_EXECUTABLE FALSE
- MACOSX_BUNDLE FALSE
-)
+
target_link_libraries(savegame PUBLIC
Qt::Core
)
diff --git a/examples/corelib/threads/CMakeLists.txt b/examples/corelib/threads/CMakeLists.txt
index 848880d076..fab084385f 100644
--- a/examples/corelib/threads/CMakeLists.txt
+++ b/examples/corelib/threads/CMakeLists.txt
@@ -1,5 +1,3 @@
-# Generated from threads.pro.
-
qt_internal_add_example(semaphores)
qt_internal_add_example(waitconditions)
if(TARGET Qt::Widgets)
diff --git a/examples/corelib/threads/mandelbrot/CMakeLists.txt b/examples/corelib/threads/mandelbrot/CMakeLists.txt
index cb026b9bb0..7fd70ebbd6 100644
--- a/examples/corelib/threads/mandelbrot/CMakeLists.txt
+++ b/examples/corelib/threads/mandelbrot/CMakeLists.txt
@@ -1,45 +1,33 @@
-# Generated from mandelbrot.pro.
-
cmake_minimum_required(VERSION 3.16)
project(mandelbrot LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/corelib/threads/mandelbrot")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
qt_add_executable(mandelbrot
main.cpp
mandelbrotwidget.cpp mandelbrotwidget.h
renderthread.cpp renderthread.h
)
+
set_target_properties(mandelbrot PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(mandelbrot PUBLIC
Qt::Core
Qt::Gui
Qt::Widgets
)
-if(UNIX AND NOT APPLE AND NOT HAIKU AND NOT INTEGRITY AND NOT VXWORKS)
- target_link_libraries(mandelbrot PUBLIC
- m
- )
-endif()
-
install(TARGETS mandelbrot
RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
diff --git a/examples/corelib/threads/mandelbrot/mandelbrot.pro b/examples/corelib/threads/mandelbrot/mandelbrot.pro
index 92010fdc1f..7edf01ff30 100644
--- a/examples/corelib/threads/mandelbrot/mandelbrot.pro
+++ b/examples/corelib/threads/mandelbrot/mandelbrot.pro
@@ -6,8 +6,6 @@ SOURCES = main.cpp \
mandelbrotwidget.cpp \
renderthread.cpp
-unix:!mac:!vxworks:!integrity:!haiku:LIBS += -lm
-
# install
target.path = $$[QT_INSTALL_EXAMPLES]/corelib/threads/mandelbrot
INSTALLS += target
diff --git a/examples/corelib/threads/queuedcustomtype/CMakeLists.txt b/examples/corelib/threads/queuedcustomtype/CMakeLists.txt
index 921aa1faa4..2086b83492 100644
--- a/examples/corelib/threads/queuedcustomtype/CMakeLists.txt
+++ b/examples/corelib/threads/queuedcustomtype/CMakeLists.txt
@@ -1,23 +1,15 @@
-# Generated from queuedcustomtype.pro.
-
cmake_minimum_required(VERSION 3.16)
project(queuedcustomtype LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/corelib/threads/queuedcustomtype")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
qt_add_executable(queuedcustomtype
block.cpp block.h
@@ -25,10 +17,12 @@ qt_add_executable(queuedcustomtype
renderthread.cpp renderthread.h
window.cpp window.h
)
+
set_target_properties(queuedcustomtype PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(queuedcustomtype PUBLIC
Qt::Core
Qt::Gui
diff --git a/examples/corelib/threads/semaphores/CMakeLists.txt b/examples/corelib/threads/semaphores/CMakeLists.txt
index e6ea405673..49169583a3 100644
--- a/examples/corelib/threads/semaphores/CMakeLists.txt
+++ b/examples/corelib/threads/semaphores/CMakeLists.txt
@@ -1,29 +1,20 @@
-# Generated from semaphores.pro.
-
cmake_minimum_required(VERSION 3.16)
project(semaphores LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/corelib/threads/semaphores")
-find_package(Qt6 COMPONENTS Core)
+find_package(Qt6 REQUIRED COMPONENTS Core)
qt_add_executable(semaphores
semaphores.cpp
)
-set_target_properties(semaphores PROPERTIES
- WIN32_EXECUTABLE FALSE
- MACOSX_BUNDLE FALSE
-)
+
target_link_libraries(semaphores PUBLIC
Qt::Core
)
diff --git a/examples/corelib/threads/waitconditions/CMakeLists.txt b/examples/corelib/threads/waitconditions/CMakeLists.txt
index 233717c2aa..c15dc19551 100644
--- a/examples/corelib/threads/waitconditions/CMakeLists.txt
+++ b/examples/corelib/threads/waitconditions/CMakeLists.txt
@@ -1,29 +1,20 @@
-# Generated from waitconditions.pro.
-
cmake_minimum_required(VERSION 3.16)
project(waitconditions LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/corelib/threads/waitconditions")
-find_package(Qt6 COMPONENTS Core)
+find_package(Qt6 REQUIRED COMPONENTS Core)
qt_add_executable(waitconditions
waitconditions.cpp
)
-set_target_properties(waitconditions PROPERTIES
- WIN32_EXECUTABLE FALSE
- MACOSX_BUNDLE FALSE
-)
+
target_link_libraries(waitconditions PUBLIC
Qt::Core
)
diff --git a/examples/corelib/tools/CMakeLists.txt b/examples/corelib/tools/CMakeLists.txt
index 27e7699f26..a8db41edee 100644
--- a/examples/corelib/tools/CMakeLists.txt
+++ b/examples/corelib/tools/CMakeLists.txt
@@ -1,5 +1,3 @@
-# Generated from tools.pro.
-
if(NOT TARGET Qt::Widgets)
return()
endif()
diff --git a/examples/corelib/tools/contiguouscache/CMakeLists.txt b/examples/corelib/tools/contiguouscache/CMakeLists.txt
index b53a82045e..5c5f8a0b89 100644
--- a/examples/corelib/tools/contiguouscache/CMakeLists.txt
+++ b/examples/corelib/tools/contiguouscache/CMakeLists.txt
@@ -1,32 +1,26 @@
-# Generated from contiguouscache.pro.
-
cmake_minimum_required(VERSION 3.16)
project(contiguouscache LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/corelib/tools/contiguouscache")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
qt_add_executable(contiguouscache
main.cpp
randomlistmodel.cpp randomlistmodel.h
)
+
set_target_properties(contiguouscache PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(contiguouscache PUBLIC
Qt::Core
Qt::Gui
diff --git a/examples/corelib/tools/customtype/CMakeLists.txt b/examples/corelib/tools/customtype/CMakeLists.txt
index 66f07dd6fa..2d8a0c0f4c 100644
--- a/examples/corelib/tools/customtype/CMakeLists.txt
+++ b/examples/corelib/tools/customtype/CMakeLists.txt
@@ -1,32 +1,26 @@
-# Generated from customtype.pro.
-
cmake_minimum_required(VERSION 3.16)
project(customtype LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/corelib/tools/customtype")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
qt_add_executable(customtype
main.cpp
message.cpp message.h
)
+
set_target_properties(customtype PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(customtype PUBLIC
Qt::Core
Qt::Gui
diff --git a/examples/corelib/tools/customtypesending/CMakeLists.txt b/examples/corelib/tools/customtypesending/CMakeLists.txt
index e10f3d6002..22e4dd0518 100644
--- a/examples/corelib/tools/customtypesending/CMakeLists.txt
+++ b/examples/corelib/tools/customtypesending/CMakeLists.txt
@@ -1,33 +1,27 @@
-# Generated from customtypesending.pro.
-
cmake_minimum_required(VERSION 3.16)
project(customtypesending LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/corelib/tools/customtypesending")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
qt_add_executable(customtypesending
main.cpp
message.cpp message.h
window.cpp window.h
)
+
set_target_properties(customtypesending PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(customtypesending PUBLIC
Qt::Core
Qt::Gui
diff --git a/examples/dbus/CMakeLists.txt b/examples/dbus/CMakeLists.txt
index ac941a3218..d61f1db460 100644
--- a/examples/dbus/CMakeLists.txt
+++ b/examples/dbus/CMakeLists.txt
@@ -1,5 +1,3 @@
-# Generated from dbus.pro.
-
if(NOT TARGET Qt::DBus)
return()
endif()
diff --git a/examples/dbus/chat/.prev_CMakeLists.txt b/examples/dbus/chat/.prev_CMakeLists.txt
deleted file mode 100644
index 9396cce3ac..0000000000
--- a/examples/dbus/chat/.prev_CMakeLists.txt
+++ /dev/null
@@ -1,43 +0,0 @@
-# Generated from chat.pro.
-
-cmake_minimum_required(VERSION 3.14)
-project(chat LANGUAGES CXX)
-
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
-set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
-
-if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
-endif()
-
-set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/dbus/chat")
-
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS DBus)
-find_package(Qt6 COMPONENTS Widgets)
-
-qt_add_executable(chat
- chat.cpp chat.h
- chatmainwindow.ui
- chatsetnickname.ui
-)
-set_target_properties(chat PROPERTIES
- WIN32_EXECUTABLE TRUE
- MACOSX_BUNDLE TRUE
-)
-target_link_libraries(chat PUBLIC
- Qt::Core
- Qt::DBus
- Qt::Gui
- Qt::Widgets
-)
-
-install(TARGETS chat
- RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
-)
diff --git a/examples/dbus/chat/CMakeLists.txt b/examples/dbus/chat/CMakeLists.txt
index 72bc4a7ff1..de58094758 100644
--- a/examples/dbus/chat/CMakeLists.txt
+++ b/examples/dbus/chat/CMakeLists.txt
@@ -1,48 +1,44 @@
-# Generated from chat.pro.
-
cmake_minimum_required(VERSION 3.16)
project(chat LANGUAGES CXX)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/dbus/chat")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS DBus)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core DBus Gui Widgets)
-# special case begin
set(chat_SRCS)
-qt6_add_dbus_interface(chat_SRCS
+qt_add_dbus_interface(chat_SRCS
org.example.chat.xml
chat_interface
)
-qt6_add_dbus_adaptor(chat_SRCS
+
+qt_add_dbus_adaptor(chat_SRCS
org.example.chat.xml
qobject.h
QObject
chat_adaptor
)
-# special case end
+
qt_add_executable(chat
chat.cpp chat.h
chatmainwindow.ui
chatsetnickname.ui
- ${chat_SRCS} # special case
+ ${chat_SRCS}
)
+
set_target_properties(chat PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(chat PUBLIC
Qt::Core
Qt::DBus
diff --git a/examples/dbus/complexpingpong/CMakeLists.txt b/examples/dbus/complexpingpong/CMakeLists.txt
index da3e39a9bb..88a7764a51 100644
--- a/examples/dbus/complexpingpong/CMakeLists.txt
+++ b/examples/dbus/complexpingpong/CMakeLists.txt
@@ -1,70 +1,36 @@
-# Generated from complexpingpong.pro.
-
cmake_minimum_required(VERSION 3.16)
-project(complexping LANGUAGES CXX)
-
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
+project(complexpingpong LANGUAGES CXX)
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/dbus/complexpingpong")
-find_package(Qt6 COMPONENTS DBus)
+find_package(Qt6 REQUIRED COMPONENTS Core DBus)
qt_add_executable(complexping
complexping.cpp complexping.h
ping-common.h
)
-set_target_properties(complexping PROPERTIES
- WIN32_EXECUTABLE TRUE
- MACOSX_BUNDLE TRUE
-)
-target_link_libraries(complexping PUBLIC
- # Remove: gui
- Qt::DBus
-)
-install(TARGETS complexping
- RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
+target_link_libraries(complexping PRIVATE
+ Qt6::Core
+ Qt6::DBus
)
-cmake_minimum_required(VERSION 3.16)
-project(complexpong LANGUAGES CXX)
-
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
-set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
-
-if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
-endif()
-
-set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/dbus/complexpingpong")
-
-find_package(Qt6 COMPONENTS DBus)
qt_add_executable(complexpong
complexpong.cpp complexpong.h
)
-set_target_properties(complexpong PROPERTIES
- WIN32_EXECUTABLE TRUE
- MACOSX_BUNDLE TRUE
-)
-target_link_libraries(complexpong PUBLIC
- # Remove: gui
- Qt::DBus
+
+target_link_libraries(complexpong PRIVATE
+ Qt6::Core
+ Qt6::DBus
)
-install(TARGETS complexpong
+install(TARGETS complexping complexpong
RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
diff --git a/examples/dbus/listnames/CMakeLists.txt b/examples/dbus/listnames/CMakeLists.txt
index ff21eea796..f646762fd1 100644
--- a/examples/dbus/listnames/CMakeLists.txt
+++ b/examples/dbus/listnames/CMakeLists.txt
@@ -1,41 +1,25 @@
-# Generated from listnames.pro.
-
cmake_minimum_required(VERSION 3.16)
project(listnames LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/dbus/listnames")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS DBus)
+find_package(Qt6 REQUIRED COMPONENTS Core DBus)
qt_add_executable(listnames
listnames.cpp
)
-set_target_properties(listnames PROPERTIES
- WIN32_EXECUTABLE TRUE
- MACOSX_BUNDLE TRUE
-)
+
target_link_libraries(listnames PUBLIC
Qt::Core
Qt::DBus
)
-if(WIN32)
- set_target_properties(listnames PROPERTIES
- WIN32_EXECUTABLE FALSE
- )
-endif()
-
install(TARGETS listnames
RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
diff --git a/examples/dbus/pingpong/CMakeLists.txt b/examples/dbus/pingpong/CMakeLists.txt
index 24cfe887ff..3003a53db1 100644
--- a/examples/dbus/pingpong/CMakeLists.txt
+++ b/examples/dbus/pingpong/CMakeLists.txt
@@ -1,71 +1,37 @@
-# Generated from pingpong.pro.
-
cmake_minimum_required(VERSION 3.16)
-project(ping LANGUAGES CXX)
-
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
+project(pingpong LANGUAGES CXX)
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/dbus/pingpong")
-find_package(Qt6 COMPONENTS DBus)
+find_package(Qt6 REQUIRED COMPONENTS Core DBus)
qt_add_executable(ping
ping.cpp
ping-common.h
)
-set_target_properties(ping PROPERTIES
- WIN32_EXECUTABLE TRUE
- MACOSX_BUNDLE TRUE
-)
-target_link_libraries(ping PUBLIC
- # Remove: gui
- Qt::DBus
-)
-install(TARGETS ping
- RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
+target_link_libraries(ping PUBLIC
+ Qt6::Core
+ Qt6::DBus
)
-cmake_minimum_required(VERSION 3.16)
-project(pong LANGUAGES CXX)
-
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
-set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
-
-if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
-endif()
-
-set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/dbus/pingpong")
-
-find_package(Qt6 COMPONENTS DBus)
qt_add_executable(pong
ping-common.h
pong.cpp pong.h
)
-set_target_properties(pong PROPERTIES
- WIN32_EXECUTABLE TRUE
- MACOSX_BUNDLE TRUE
-)
+
target_link_libraries(pong PUBLIC
- # Remove: gui
- Qt::DBus
+ Qt6::Core
+ Qt6::DBus
)
-install(TARGETS pong
+install(TARGETS ping pong
RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
diff --git a/examples/dbus/remotecontrolledcar/CMakeLists.txt b/examples/dbus/remotecontrolledcar/CMakeLists.txt
index 86f9f03ccc..259d3a0470 100644
--- a/examples/dbus/remotecontrolledcar/CMakeLists.txt
+++ b/examples/dbus/remotecontrolledcar/CMakeLists.txt
@@ -1,4 +1,2 @@
-# Generated from remotecontrolledcar.pro.
-
qt_internal_add_example(car)
qt_internal_add_example(controller)
diff --git a/examples/dbus/remotecontrolledcar/car/.prev_CMakeLists.txt b/examples/dbus/remotecontrolledcar/car/.prev_CMakeLists.txt
deleted file mode 100644
index 86b3fb8e52..0000000000
--- a/examples/dbus/remotecontrolledcar/car/.prev_CMakeLists.txt
+++ /dev/null
@@ -1,42 +0,0 @@
-# Generated from car.pro.
-
-cmake_minimum_required(VERSION 3.14)
-project(car LANGUAGES CXX)
-
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
-set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
-
-if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
-endif()
-
-set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/dbus/remotecontrolledcar/car")
-
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS DBus)
-find_package(Qt6 COMPONENTS Widgets)
-
-qt_add_executable(car
- car.cpp car.h
- main.cpp
-)
-set_target_properties(car PROPERTIES
- WIN32_EXECUTABLE TRUE
- MACOSX_BUNDLE TRUE
-)
-target_link_libraries(car PUBLIC
- Qt::Core
- Qt::DBus
- Qt::Gui
- Qt::Widgets
-)
-
-install(TARGETS car
- RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
-)
diff --git a/examples/dbus/remotecontrolledcar/car/CMakeLists.txt b/examples/dbus/remotecontrolledcar/car/CMakeLists.txt
index 7269cfd1c7..6d2ba75abd 100644
--- a/examples/dbus/remotecontrolledcar/car/CMakeLists.txt
+++ b/examples/dbus/remotecontrolledcar/car/CMakeLists.txt
@@ -1,43 +1,37 @@
-# Generated from car.pro.
-
cmake_minimum_required(VERSION 3.16)
project(car LANGUAGES CXX)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/dbus/remotecontrolledcar/car")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS DBus)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core DBus Gui Widgets)
-# special case begin
set(car_SRCS)
-qt6_add_dbus_adaptor(car_SRCS
+qt_add_dbus_adaptor(car_SRCS
car.xml
qobject.h
"" # empty parent_class value on purpose to not pass -l flag
car_adaptor
)
-# special case end
+
qt_add_executable(car
car.cpp car.h
main.cpp
- ${car_SRCS} # special case
+ ${car_SRCS}
)
+
set_target_properties(car PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(car PUBLIC
Qt::Core
Qt::DBus
diff --git a/examples/dbus/remotecontrolledcar/controller/.prev_CMakeLists.txt b/examples/dbus/remotecontrolledcar/controller/.prev_CMakeLists.txt
deleted file mode 100644
index f1916c93f2..0000000000
--- a/examples/dbus/remotecontrolledcar/controller/.prev_CMakeLists.txt
+++ /dev/null
@@ -1,42 +0,0 @@
-# Generated from controller.pro.
-
-cmake_minimum_required(VERSION 3.14)
-project(controller LANGUAGES CXX)
-
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
-set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
-
-if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
-endif()
-
-set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/dbus/remotecontrolledcar/controller")
-
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS DBus)
-find_package(Qt6 COMPONENTS Widgets)
-
-qt_add_executable(controller
- controller.cpp controller.h controller.ui
- main.cpp
-)
-set_target_properties(controller PROPERTIES
- WIN32_EXECUTABLE TRUE
- MACOSX_BUNDLE TRUE
-)
-target_link_libraries(controller PUBLIC
- Qt::Core
- Qt::DBus
- Qt::Gui
- Qt::Widgets
-)
-
-install(TARGETS controller
- RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
-)
diff --git a/examples/dbus/remotecontrolledcar/controller/CMakeLists.txt b/examples/dbus/remotecontrolledcar/controller/CMakeLists.txt
index 33df2b5ebd..d150f4a599 100644
--- a/examples/dbus/remotecontrolledcar/controller/CMakeLists.txt
+++ b/examples/dbus/remotecontrolledcar/controller/CMakeLists.txt
@@ -1,41 +1,36 @@
-# Generated from controller.pro.
-
cmake_minimum_required(VERSION 3.16)
project(controller LANGUAGES CXX)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/dbus/remotecontrolledcar/controller")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS DBus)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core DBus Gui Widgets)
-# special case begin
set(controller_SRCS)
-qt6_add_dbus_interface(controller_SRCS
+qt_add_dbus_interface(controller_SRCS
car.xml
car_interface
)
-# special case end
+
qt_add_executable(controller
controller.cpp controller.h controller.ui
main.cpp
- ${controller_SRCS} # special case
+ ${controller_SRCS}
)
+
set_target_properties(controller PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(controller PUBLIC
Qt::Core
Qt::DBus
diff --git a/examples/embedded/CMakeLists.txt b/examples/embedded/CMakeLists.txt
index 5f4bcc5628..143f40cbcb 100644
--- a/examples/embedded/CMakeLists.txt
+++ b/examples/embedded/CMakeLists.txt
@@ -1,5 +1,3 @@
-# Generated from embedded.pro.
-
if(NOT TARGET Qt::Gui OR (NOT embedded AND NOT x11))
return()
endif()
diff --git a/examples/embedded/digiflip/CMakeLists.txt b/examples/embedded/digiflip/CMakeLists.txt
index 9edd58dc2e..c24e42e124 100644
--- a/examples/embedded/digiflip/CMakeLists.txt
+++ b/examples/embedded/digiflip/CMakeLists.txt
@@ -1,31 +1,25 @@
-# Generated from digiflip.pro.
-
cmake_minimum_required(VERSION 3.16)
project(digiflip LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/embedded/digiflip")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
qt_add_executable(digiflip
digiflip.cpp
)
+
set_target_properties(digiflip PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(digiflip PUBLIC
Qt::Core
Qt::Gui
diff --git a/examples/embedded/flickable/CMakeLists.txt b/examples/embedded/flickable/CMakeLists.txt
index 875b48f25a..0dc5051eec 100644
--- a/examples/embedded/flickable/CMakeLists.txt
+++ b/examples/embedded/flickable/CMakeLists.txt
@@ -1,32 +1,26 @@
-# Generated from flickable.pro.
-
cmake_minimum_required(VERSION 3.16)
project(flickable LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/embedded/flickable")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
qt_add_executable(flickable
flickable.cpp flickable.h
main.cpp
)
+
set_target_properties(flickable PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(flickable PUBLIC
Qt::Core
Qt::Gui
diff --git a/examples/embedded/flightinfo/.prev_CMakeLists.txt b/examples/embedded/flightinfo/.prev_CMakeLists.txt
deleted file mode 100644
index f7898e8ed8..0000000000
--- a/examples/embedded/flightinfo/.prev_CMakeLists.txt
+++ /dev/null
@@ -1,47 +0,0 @@
-# Generated from flightinfo.pro.
-
-cmake_minimum_required(VERSION 3.14)
-project(flightinfo LANGUAGES CXX)
-
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
-set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
-
-set(INSTALL_EXAMPLEDIR "examples/embedded/flightinfo")
-
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Network)
-find_package(Qt6 COMPONENTS Widgets)
-
-add_qt_gui_executable(flightinfo
- flightinfo.cpp
- form.ui
-)
-target_link_libraries(flightinfo PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Network
- Qt::Widgets
-)
-
-
-# Resources:
-set(flightinfo_resource_files
- "aircraft.png"
-)
-
-qt6_add_resources(flightinfo "flightinfo"
- PREFIX
- "/"
- FILES
- ${flightinfo_resource_files}
-)
-
-install(TARGETS flightinfo
- RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
-)
diff --git a/examples/embedded/flightinfo/CMakeLists.txt b/examples/embedded/flightinfo/CMakeLists.txt
index 6918b4defa..25309199b3 100644
--- a/examples/embedded/flightinfo/CMakeLists.txt
+++ b/examples/embedded/flightinfo/CMakeLists.txt
@@ -1,33 +1,27 @@
-# Generated from flightinfo.pro.
-
cmake_minimum_required(VERSION 3.16)
project(flightinfo LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/embedded/flightinfo")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Network)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Network Widgets)
qt_add_executable(flightinfo
flightinfo.cpp
form.ui
)
+
set_target_properties(flightinfo PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(flightinfo PUBLIC
Qt::Core
Qt::Gui
@@ -35,13 +29,12 @@ target_link_libraries(flightinfo PUBLIC
Qt::Widgets
)
-
# Resources:
set(flightinfo_resource_files
"aircraft.png"
)
-qt6_add_resources(flightinfo "flightinfo"
+qt_add_resources(flightinfo "flightinfo"
PREFIX
"/"
FILES
diff --git a/examples/embedded/lightmaps/CMakeLists.txt b/examples/embedded/lightmaps/CMakeLists.txt
index 6d05d70a67..e7feccab7d 100644
--- a/examples/embedded/lightmaps/CMakeLists.txt
+++ b/examples/embedded/lightmaps/CMakeLists.txt
@@ -1,24 +1,15 @@
-# Generated from lightmaps.pro.
-
cmake_minimum_required(VERSION 3.16)
project(lightmaps LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/embedded/lightmaps")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Network)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Network Widgets)
qt_add_executable(lightmaps
lightmaps.cpp lightmaps.h
@@ -26,10 +17,12 @@ qt_add_executable(lightmaps
mapzoom.cpp mapzoom.h
slippymap.cpp slippymap.h
)
+
set_target_properties(lightmaps PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(lightmaps PUBLIC
Qt::Core
Qt::Gui
diff --git a/examples/embedded/raycasting/CMakeLists.txt b/examples/embedded/raycasting/CMakeLists.txt
index c58f8cf6fa..b2e66c2442 100644
--- a/examples/embedded/raycasting/CMakeLists.txt
+++ b/examples/embedded/raycasting/CMakeLists.txt
@@ -1,44 +1,37 @@
-# Generated from raycasting.pro.
-
cmake_minimum_required(VERSION 3.16)
project(raycasting LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/embedded/raycasting")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
qt_add_executable(raycasting
raycasting.cpp
)
+
set_target_properties(raycasting PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(raycasting PUBLIC
Qt::Core
Qt::Gui
Qt::Widgets
)
-
# Resources:
set(raycasting_resource_files
"textures.png"
)
-qt6_add_resources(raycasting "raycasting"
+qt_add_resources(raycasting "raycasting"
PREFIX
"/"
FILES
diff --git a/examples/embedded/styleexample/.prev_CMakeLists.txt b/examples/embedded/styleexample/.prev_CMakeLists.txt
deleted file mode 100644
index ac03e58346..0000000000
--- a/examples/embedded/styleexample/.prev_CMakeLists.txt
+++ /dev/null
@@ -1,52 +0,0 @@
-# Generated from styleexample.pro.
-
-cmake_minimum_required(VERSION 3.14)
-project(styleexample LANGUAGES CXX)
-
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
-set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
-
-set(INSTALL_EXAMPLEDIR "examples/embedded/styleexample")
-
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
-
-add_qt_gui_executable(styleexample
- main.cpp
- stylewidget.cpp stylewidget.h stylewidget.ui
-)
-target_link_libraries(styleexample PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
-)
-
-
-# Resources:
-set(styleexample_resource_files
- "files/add.png"
- "files/application.qss"
- "files/blue.qss"
- "files/khaki.qss"
- "files/nature_1.jpg"
- "files/nostyle.qss"
- "files/remove.png"
- "files/transparent.qss"
-)
-
-qt6_add_resources(styleexample "styleexample"
- PREFIX
- "/"
- FILES
- ${styleexample_resource_files}
-)
-
-install(TARGETS styleexample
- RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
-)
diff --git a/examples/embedded/styleexample/CMakeLists.txt b/examples/embedded/styleexample/CMakeLists.txt
index 36f9da25f6..2d1547ab9c 100644
--- a/examples/embedded/styleexample/CMakeLists.txt
+++ b/examples/embedded/styleexample/CMakeLists.txt
@@ -1,39 +1,33 @@
-# Generated from styleexample.pro.
-
cmake_minimum_required(VERSION 3.16)
project(styleexample LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/embedded/styleexample")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
qt_add_executable(styleexample
main.cpp
stylewidget.cpp stylewidget.h stylewidget.ui
)
+
set_target_properties(styleexample PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(styleexample PUBLIC
Qt::Core
Qt::Gui
Qt::Widgets
)
-
# Resources:
set(styleexample_resource_files
"files/add.png"
@@ -46,7 +40,7 @@ set(styleexample_resource_files
"files/transparent.qss"
)
-qt6_add_resources(styleexample "styleexample"
+qt_add_resources(styleexample "styleexample"
PREFIX
"/"
FILES
diff --git a/examples/gui/CMakeLists.txt b/examples/gui/CMakeLists.txt
index d952899f55..0abfb9ba86 100644
--- a/examples/gui/CMakeLists.txt
+++ b/examples/gui/CMakeLists.txt
@@ -1,5 +1,3 @@
-# Generated from gui.pro.
-
if(NOT TARGET Qt::Gui)
return()
endif()
diff --git a/examples/gui/analogclock/.prev_CMakeLists.txt b/examples/gui/analogclock/.prev_CMakeLists.txt
deleted file mode 100644
index 90c6091d68..0000000000
--- a/examples/gui/analogclock/.prev_CMakeLists.txt
+++ /dev/null
@@ -1,42 +0,0 @@
-# Generated from analogclock.pro.
-
-cmake_minimum_required(VERSION 3.14)
-project(analogclock LANGUAGES CXX)
-
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
-set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
-
-if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
-endif()
-
-set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/gui/analogclock")
-
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-
-qt_add_executable(analogclock
- ../rasterwindow/rasterwindow.cpp ../rasterwindow/rasterwindow.h
- main.cpp
-)
-set_target_properties(analogclock PROPERTIES
- WIN32_EXECUTABLE TRUE
- MACOSX_BUNDLE TRUE
-)
-target_include_directories(analogclock PUBLIC
- ../rasterwindow
-)
-
-target_link_libraries(analogclock PUBLIC
- Qt::Core
- Qt::Gui
-)
-
-install(TARGETS analogclock
- RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
-)
diff --git a/examples/gui/analogclock/CMakeLists.txt b/examples/gui/analogclock/CMakeLists.txt
index 20bedf5a37..a5f6eac377 100644
--- a/examples/gui/analogclock/CMakeLists.txt
+++ b/examples/gui/analogclock/CMakeLists.txt
@@ -1,48 +1,36 @@
-# Generated from analogclock.pro.
-
cmake_minimum_required(VERSION 3.16)
project(analogclock LANGUAGES CXX)
-
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
-set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/gui/gui_analogclock") # special case
+set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/gui/gui_analogclock")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets) # special case: add
+find_package(Qt6 REQUIRED COMPONENTS Core Gui)
-qt_add_executable(gui_analogclock # special case: renamed target
+qt_add_executable(gui_analogclock
../rasterwindow/rasterwindow.cpp ../rasterwindow/rasterwindow.h
main.cpp
)
-set_target_properties(gui_analogclock PROPERTIES # special case
+
+set_target_properties(gui_analogclock PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
-target_include_directories(gui_analogclock PUBLIC # special case
+
+target_include_directories(gui_analogclock PUBLIC
../rasterwindow
)
-# special case begin
-target_link_libraries(gui_analogclock PUBLIC # special case
- Qt::Gui
-)
-# special case end
-target_link_libraries(gui_analogclock PUBLIC # special case
+target_link_libraries(gui_analogclock PUBLIC
Qt::Core
Qt::Gui
)
-install(TARGETS gui_analogclock # special case
+install(TARGETS gui_analogclock
RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
diff --git a/examples/gui/rasterwindow/.prev_CMakeLists.txt b/examples/gui/rasterwindow/.prev_CMakeLists.txt
deleted file mode 100644
index dddb5586db..0000000000
--- a/examples/gui/rasterwindow/.prev_CMakeLists.txt
+++ /dev/null
@@ -1,42 +0,0 @@
-# Generated from rasterwindow.pro.
-
-cmake_minimum_required(VERSION 3.14)
-project(rasterwindow LANGUAGES CXX)
-
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
-set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
-
-if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
-endif()
-
-set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/gui/rasterwindow")
-
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-
-qt_add_executable(rasterwindow
- main.cpp
- rasterwindow.cpp rasterwindow.h
-)
-set_target_properties(rasterwindow PROPERTIES
- WIN32_EXECUTABLE TRUE
- MACOSX_BUNDLE TRUE
-)
-target_include_directories(rasterwindow PUBLIC
- ${CMAKE_CURRENT_SOURCE_DIR}
-)
-
-target_link_libraries(rasterwindow PUBLIC
- Qt::Core
- Qt::Gui
-)
-
-install(TARGETS rasterwindow
- RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
-)
diff --git a/examples/gui/rasterwindow/CMakeLists.txt b/examples/gui/rasterwindow/CMakeLists.txt
index 56ee7c8245..dec3e25eb6 100644
--- a/examples/gui/rasterwindow/CMakeLists.txt
+++ b/examples/gui/rasterwindow/CMakeLists.txt
@@ -1,36 +1,26 @@
-# Generated from rasterwindow.pro.
-
cmake_minimum_required(VERSION 3.16)
project(rasterwindow LANGUAGES CXX)
-find_package(Qt6 COMPONENTS Widgets) # special case: add
-
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/gui/rasterwindow")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui)
qt_add_executable(rasterwindow
main.cpp
rasterwindow.cpp rasterwindow.h
)
+
set_target_properties(rasterwindow PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
-target_include_directories(rasterwindow PUBLIC
- ${CMAKE_CURRENT_SOURCE_DIR}
-)
+
target_link_libraries(rasterwindow PUBLIC
Qt::Core
Qt::Gui
diff --git a/examples/gui/rasterwindow/rasterwindow.h b/examples/gui/rasterwindow/rasterwindow.h
index 58c3ab89b2..279952cf61 100644
--- a/examples/gui/rasterwindow/rasterwindow.h
+++ b/examples/gui/rasterwindow/rasterwindow.h
@@ -53,6 +53,7 @@
//! [1]
#include <QtGui>
+#include <QScopedPointer>
class RasterWindow : public QWindow
{
@@ -73,7 +74,7 @@ protected:
void exposeEvent(QExposeEvent *event) override;
private:
- QBackingStore *m_backingStore;
+ QScopedPointer<QBackingStore> m_backingStore;
};
//! [1]
#endif // RASTERWINDOW_H
diff --git a/examples/network/.prev_CMakeLists.txt b/examples/network/.prev_CMakeLists.txt
deleted file mode 100644
index c28c951b69..0000000000
--- a/examples/network/.prev_CMakeLists.txt
+++ /dev/null
@@ -1,38 +0,0 @@
-# Generated from network.pro.
-
-if(NOT TARGET Qt::Network)
- return()
-endif()
-add_subdirectory(download)
-add_subdirectory(downloadmanager)
-if(NOT INTEGRITY)
- add_subdirectory(dnslookup)
-endif()
-if(TARGET Qt::Widgets)
- add_subdirectory(blockingfortuneclient)
- add_subdirectory(broadcastreceiver)
- add_subdirectory(broadcastsender)
- add_subdirectory(http)
- add_subdirectory(loopback)
- add_subdirectory(threadedfortuneserver)
- add_subdirectory(googlesuggest)
- add_subdirectory(torrent)
- add_subdirectory(multicastreceiver)
- add_subdirectory(multicastsender)
- add_subdirectory(fortuneclient)
- add_subdirectory(fortuneserver)
-endif()
-if(QT_FEATURE_processenvironment AND TARGET Qt::Widgets)
- add_subdirectory(network-chat)
-endif()
-if(QT_FEATURE_ssl AND TARGET Qt::Widgets)
- add_subdirectory(securesocketclient)
-endif()
-if(QT_FEATURE_dtls AND TARGET Qt::Widgets)
- add_subdirectory(secureudpserver)
- add_subdirectory(secureudpclient)
-endif()
-if(QT_FEATURE_sctp AND TARGET Qt::Widgets)
- add_subdirectory(multistreamserver)
- add_subdirectory(multistreamclient)
-endif()
diff --git a/examples/network/CMakeLists.txt b/examples/network/CMakeLists.txt
index fd61e75aef..df65fad19c 100644
--- a/examples/network/CMakeLists.txt
+++ b/examples/network/CMakeLists.txt
@@ -1,5 +1,3 @@
-# Generated from network.pro.
-
if(NOT TARGET Qt::Network)
return()
endif()
diff --git a/examples/network/blockingfortuneclient/CMakeLists.txt b/examples/network/blockingfortuneclient/CMakeLists.txt
index d7e9c2b36f..346a014abe 100644
--- a/examples/network/blockingfortuneclient/CMakeLists.txt
+++ b/examples/network/blockingfortuneclient/CMakeLists.txt
@@ -1,34 +1,27 @@
-# Generated from blockingfortuneclient.pro.
-
cmake_minimum_required(VERSION 3.16)
project(blockingfortuneclient LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/network/blockingfortuneclient")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Network)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Network Widgets)
qt_add_executable(blockingfortuneclient
blockingclient.cpp blockingclient.h
fortunethread.cpp fortunethread.h
main.cpp
)
+
set_target_properties(blockingfortuneclient PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(blockingfortuneclient PUBLIC
Qt::Core
Qt::Gui
diff --git a/examples/network/broadcastreceiver/CMakeLists.txt b/examples/network/broadcastreceiver/CMakeLists.txt
index f57ad8cf7f..d1f3563a3c 100644
--- a/examples/network/broadcastreceiver/CMakeLists.txt
+++ b/examples/network/broadcastreceiver/CMakeLists.txt
@@ -1,33 +1,26 @@
-# Generated from broadcastreceiver.pro.
-
cmake_minimum_required(VERSION 3.16)
project(broadcastreceiver LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/network/broadcastreceiver")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Network)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Network Widgets)
qt_add_executable(broadcastreceiver
main.cpp
receiver.cpp receiver.h
)
+
set_target_properties(broadcastreceiver PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(broadcastreceiver PUBLIC
Qt::Core
Qt::Gui
diff --git a/examples/network/broadcastsender/CMakeLists.txt b/examples/network/broadcastsender/CMakeLists.txt
index 4730ad632f..0fb7b8d8e6 100644
--- a/examples/network/broadcastsender/CMakeLists.txt
+++ b/examples/network/broadcastsender/CMakeLists.txt
@@ -1,33 +1,26 @@
-# Generated from broadcastsender.pro.
-
cmake_minimum_required(VERSION 3.16)
project(broadcastsender LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/network/broadcastsender")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Network)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Network Widgets)
qt_add_executable(broadcastsender
main.cpp
sender.cpp sender.h
)
+
set_target_properties(broadcastsender PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(broadcastsender PUBLIC
Qt::Core
Qt::Gui
diff --git a/examples/network/dnslookup/CMakeLists.txt b/examples/network/dnslookup/CMakeLists.txt
index 4623f9847c..a6c3681731 100644
--- a/examples/network/dnslookup/CMakeLists.txt
+++ b/examples/network/dnslookup/CMakeLists.txt
@@ -1,30 +1,20 @@
-# Generated from dnslookup.pro.
-
cmake_minimum_required(VERSION 3.16)
project(dnslookup LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/network/dnslookup")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Network)
+find_package(Qt6 REQUIRED COMPONENTS Core Network)
qt_add_executable(dnslookup
dnslookup.cpp dnslookup.h
)
-set_target_properties(dnslookup PROPERTIES
- WIN32_EXECUTABLE FALSE
- MACOSX_BUNDLE FALSE
-)
+
target_link_libraries(dnslookup PUBLIC
Qt::Core
Qt::Network
diff --git a/examples/network/download/CMakeLists.txt b/examples/network/download/CMakeLists.txt
index abc74a1ff1..a258341ce1 100644
--- a/examples/network/download/CMakeLists.txt
+++ b/examples/network/download/CMakeLists.txt
@@ -1,30 +1,20 @@
-# Generated from download.pro.
-
cmake_minimum_required(VERSION 3.16)
project(download LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/network/download")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Network)
+find_package(Qt6 REQUIRED COMPONENTS Core Network)
qt_add_executable(download
main.cpp
)
-set_target_properties(download PROPERTIES
- WIN32_EXECUTABLE FALSE
- MACOSX_BUNDLE FALSE
-)
+
target_link_libraries(download PUBLIC
Qt::Core
Qt::Network
diff --git a/examples/network/downloadmanager/CMakeLists.txt b/examples/network/downloadmanager/CMakeLists.txt
index fc900806b8..a65ff74cdc 100644
--- a/examples/network/downloadmanager/CMakeLists.txt
+++ b/examples/network/downloadmanager/CMakeLists.txt
@@ -1,32 +1,22 @@
-# Generated from downloadmanager.pro.
-
cmake_minimum_required(VERSION 3.16)
project(downloadmanager LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/network/downloadmanager")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Network)
+find_package(Qt6 REQUIRED COMPONENTS Core Network)
qt_add_executable(downloadmanager
downloadmanager.cpp downloadmanager.h
main.cpp
textprogressbar.cpp textprogressbar.h
)
-set_target_properties(downloadmanager PROPERTIES
- WIN32_EXECUTABLE FALSE
- MACOSX_BUNDLE FALSE
-)
+
target_link_libraries(downloadmanager PUBLIC
Qt::Core
Qt::Network
diff --git a/examples/network/fortuneclient/CMakeLists.txt b/examples/network/fortuneclient/CMakeLists.txt
index cb032d429c..05ab8c6fd7 100644
--- a/examples/network/fortuneclient/CMakeLists.txt
+++ b/examples/network/fortuneclient/CMakeLists.txt
@@ -1,33 +1,26 @@
-# Generated from fortuneclient.pro.
-
cmake_minimum_required(VERSION 3.16)
project(fortuneclient LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/network/fortuneclient")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Network)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Network Widgets)
qt_add_executable(fortuneclient
client.cpp client.h
main.cpp
)
+
set_target_properties(fortuneclient PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(fortuneclient PUBLIC
Qt::Core
Qt::Gui
diff --git a/examples/network/fortuneserver/CMakeLists.txt b/examples/network/fortuneserver/CMakeLists.txt
index 3816310170..16be51f61c 100644
--- a/examples/network/fortuneserver/CMakeLists.txt
+++ b/examples/network/fortuneserver/CMakeLists.txt
@@ -1,33 +1,26 @@
-# Generated from fortuneserver.pro.
-
cmake_minimum_required(VERSION 3.16)
project(fortuneserver LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/network/fortuneserver")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Network)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Network Widgets)
qt_add_executable(fortuneserver
main.cpp
server.cpp server.h
)
+
set_target_properties(fortuneserver PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(fortuneserver PUBLIC
Qt::Core
Qt::Gui
diff --git a/examples/network/googlesuggest/CMakeLists.txt b/examples/network/googlesuggest/CMakeLists.txt
index 1735fed900..27bc585eae 100644
--- a/examples/network/googlesuggest/CMakeLists.txt
+++ b/examples/network/googlesuggest/CMakeLists.txt
@@ -1,34 +1,27 @@
-# Generated from googlesuggest.pro.
-
cmake_minimum_required(VERSION 3.16)
project(googlesuggest LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/network/googlesuggest")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Network)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Network Widgets)
qt_add_executable(googlesuggest
googlesuggest.cpp googlesuggest.h
main.cpp
searchbox.cpp searchbox.h
)
+
set_target_properties(googlesuggest PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(googlesuggest PUBLIC
Qt::Core
Qt::Gui
diff --git a/examples/network/http/CMakeLists.txt b/examples/network/http/CMakeLists.txt
index c17c77e463..8be2d25bec 100644
--- a/examples/network/http/CMakeLists.txt
+++ b/examples/network/http/CMakeLists.txt
@@ -1,34 +1,28 @@
-# Generated from http.pro.
-
cmake_minimum_required(VERSION 3.16)
project(http LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/network/http")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Network)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Network Widgets)
qt_add_executable(http
authenticationdialog.ui
httpwindow.cpp httpwindow.h
main.cpp
)
+
set_target_properties(http PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(http PUBLIC
Qt::Core
Qt::Gui
diff --git a/examples/network/loopback/CMakeLists.txt b/examples/network/loopback/CMakeLists.txt
index da0e80a033..1c62a2cf18 100644
--- a/examples/network/loopback/CMakeLists.txt
+++ b/examples/network/loopback/CMakeLists.txt
@@ -1,33 +1,26 @@
-# Generated from loopback.pro.
-
cmake_minimum_required(VERSION 3.16)
project(loopback LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/network/loopback")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Network)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Network Widgets)
qt_add_executable(loopback
dialog.cpp dialog.h
main.cpp
)
+
set_target_properties(loopback PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(loopback PUBLIC
Qt::Core
Qt::Gui
diff --git a/examples/network/multicastreceiver/CMakeLists.txt b/examples/network/multicastreceiver/CMakeLists.txt
index 8ec26259cf..44c15906e3 100644
--- a/examples/network/multicastreceiver/CMakeLists.txt
+++ b/examples/network/multicastreceiver/CMakeLists.txt
@@ -1,33 +1,26 @@
-# Generated from multicastreceiver.pro.
-
cmake_minimum_required(VERSION 3.16)
project(multicastreceiver LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/network/multicastreceiver")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Network)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Network Widgets)
qt_add_executable(multicastreceiver
main.cpp
receiver.cpp receiver.h
)
+
set_target_properties(multicastreceiver PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(multicastreceiver PUBLIC
Qt::Core
Qt::Gui
diff --git a/examples/network/multicastsender/CMakeLists.txt b/examples/network/multicastsender/CMakeLists.txt
index 964530e6d5..d775cd9541 100644
--- a/examples/network/multicastsender/CMakeLists.txt
+++ b/examples/network/multicastsender/CMakeLists.txt
@@ -1,33 +1,26 @@
-# Generated from multicastsender.pro.
-
cmake_minimum_required(VERSION 3.16)
project(multicastsender LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/network/multicastsender")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Network)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Network Widgets)
qt_add_executable(multicastsender
main.cpp
sender.cpp sender.h
)
+
set_target_properties(multicastsender PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(multicastsender PUBLIC
Qt::Core
Qt::Gui
diff --git a/examples/network/multistreamclient/CMakeLists.txt b/examples/network/multistreamclient/CMakeLists.txt
index 9ce8827823..55b2cdf1f6 100644
--- a/examples/network/multistreamclient/CMakeLists.txt
+++ b/examples/network/multistreamclient/CMakeLists.txt
@@ -1,24 +1,15 @@
-# Generated from multistreamclient.pro.
-
cmake_minimum_required(VERSION 3.16)
project(multistreamclient LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/network/multistreamclient")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Network)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Network Widgets)
qt_add_executable(multistreamclient
chatconsumer.cpp chatconsumer.h
@@ -28,10 +19,12 @@ qt_add_executable(multistreamclient
movieconsumer.cpp movieconsumer.h
timeconsumer.cpp timeconsumer.h
)
+
set_target_properties(multistreamclient PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(multistreamclient PUBLIC
Qt::Core
Qt::Gui
diff --git a/examples/network/multistreamclient/timeconsumer.cpp b/examples/network/multistreamclient/timeconsumer.cpp
index 6543e53cfc..3790bbbc3f 100644
--- a/examples/network/multistreamclient/timeconsumer.cpp
+++ b/examples/network/multistreamclient/timeconsumer.cpp
@@ -82,7 +82,7 @@ void TimeConsumer::readDatagram(const QByteArray &ba)
void TimeConsumer::timerTick()
{
QByteArray buf;
- QDataStream ds(&buf, QIODevice::WriteOnly);
+ QDataStream ds(&buf, QIODeviceBase::WriteOnly);
ds << lastTime;
emit writeDatagram(buf);
diff --git a/examples/network/multistreamserver/CMakeLists.txt b/examples/network/multistreamserver/CMakeLists.txt
index af8c8f2024..5351420cee 100644
--- a/examples/network/multistreamserver/CMakeLists.txt
+++ b/examples/network/multistreamserver/CMakeLists.txt
@@ -1,24 +1,15 @@
-# Generated from multistreamserver.pro.
-
cmake_minimum_required(VERSION 3.16)
project(multistreamserver LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/network/multistreamserver")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Network)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Network Widgets)
qt_add_executable(multistreamserver
chatprovider.cpp chatprovider.h
@@ -28,10 +19,12 @@ qt_add_executable(multistreamserver
server.cpp server.h
timeprovider.cpp timeprovider.h
)
+
set_target_properties(multistreamserver PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(multistreamserver PUBLIC
Qt::Core
Qt::Gui
diff --git a/examples/network/multistreamserver/timeprovider.cpp b/examples/network/multistreamserver/timeprovider.cpp
index fb50baac26..dc8bca9769 100644
--- a/examples/network/multistreamserver/timeprovider.cpp
+++ b/examples/network/multistreamserver/timeprovider.cpp
@@ -71,7 +71,7 @@ void TimeProvider::readDatagram(QSctpSocket &from, const QByteArray &ba)
|| curTime.minute() != clientTime.minute()
|| curTime.hour() != clientTime.hour()) {
QByteArray buf;
- QDataStream out_ds(&buf, QIODevice::WriteOnly);
+ QDataStream out_ds(&buf, QIODeviceBase::WriteOnly);
out_ds << curTime;
emit writeDatagram(&from, buf);
diff --git a/examples/network/network-chat/CMakeLists.txt b/examples/network/network-chat/CMakeLists.txt
index dfec91d249..eaa712ab14 100644
--- a/examples/network/network-chat/CMakeLists.txt
+++ b/examples/network/network-chat/CMakeLists.txt
@@ -1,24 +1,16 @@
-# Generated from network-chat.pro.
-
cmake_minimum_required(VERSION 3.16)
project(network-chat LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/network/network-chat")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Network)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Network Widgets)
qt_add_executable(network-chat
chatdialog.cpp chatdialog.h chatdialog.ui
@@ -28,10 +20,12 @@ qt_add_executable(network-chat
peermanager.cpp peermanager.h
server.cpp server.h
)
+
set_target_properties(network-chat PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(network-chat PUBLIC
Qt::Core
Qt::Gui
diff --git a/examples/network/securesocketclient/CMakeLists.txt b/examples/network/securesocketclient/CMakeLists.txt
index 7f2ae7ff3c..eeeae941f8 100644
--- a/examples/network/securesocketclient/CMakeLists.txt
+++ b/examples/network/securesocketclient/CMakeLists.txt
@@ -1,24 +1,16 @@
-# Generated from securesocketclient.pro.
-
cmake_minimum_required(VERSION 3.16)
project(securesocketclient LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/network/securesocketclient")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Network)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Network Widgets)
qt_add_executable(securesocketclient
certificateinfo.cpp certificateinfo.h certificateinfo.ui
@@ -26,10 +18,12 @@ qt_add_executable(securesocketclient
sslclient.cpp sslclient.h sslclient.ui
sslerrors.ui
)
+
set_target_properties(securesocketclient PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(securesocketclient PUBLIC
Qt::Core
Qt::Gui
@@ -37,13 +31,12 @@ target_link_libraries(securesocketclient PUBLIC
Qt::Widgets
)
-
# Resources:
set(securesocketclient_resource_files
"encrypted.png"
)
-qt6_add_resources(securesocketclient "securesocketclient"
+qt_add_resources(securesocketclient "securesocketclient"
PREFIX
"/"
FILES
diff --git a/examples/network/secureudpclient/CMakeLists.txt b/examples/network/secureudpclient/CMakeLists.txt
index e604803fc2..3f71a62b7b 100644
--- a/examples/network/secureudpclient/CMakeLists.txt
+++ b/examples/network/secureudpclient/CMakeLists.txt
@@ -1,24 +1,16 @@
-# Generated from secureudpclient.pro.
-
cmake_minimum_required(VERSION 3.16)
project(secureudpclient LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/network/secureudpclient")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
-find_package(Qt6 COMPONENTS Network)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Network Widgets)
qt_add_executable(secureudpclient
addressdialog.cpp addressdialog.h addressdialog.ui
@@ -26,10 +18,12 @@ qt_add_executable(secureudpclient
main.cpp
mainwindow.cpp mainwindow.h mainwindow.ui
)
+
set_target_properties(secureudpclient PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(secureudpclient PUBLIC
Qt::Core
Qt::Gui
diff --git a/examples/network/secureudpserver/CMakeLists.txt b/examples/network/secureudpserver/CMakeLists.txt
index 940f646ca5..aa6f4f69b8 100644
--- a/examples/network/secureudpserver/CMakeLists.txt
+++ b/examples/network/secureudpserver/CMakeLists.txt
@@ -1,24 +1,16 @@
-# Generated from secureudpserver.pro.
-
cmake_minimum_required(VERSION 3.16)
project(secureudpserver LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/network/secureudpserver")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
-find_package(Qt6 COMPONENTS Network)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Network Widgets)
qt_add_executable(secureudpserver
main.cpp
@@ -26,10 +18,12 @@ qt_add_executable(secureudpserver
nicselector.cpp nicselector.h nicselector.ui
server.cpp server.h
)
+
set_target_properties(secureudpserver PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(secureudpserver PUBLIC
Qt::Core
Qt::Gui
diff --git a/examples/network/threadedfortuneserver/CMakeLists.txt b/examples/network/threadedfortuneserver/CMakeLists.txt
index af4d06aa25..64d5e5720a 100644
--- a/examples/network/threadedfortuneserver/CMakeLists.txt
+++ b/examples/network/threadedfortuneserver/CMakeLists.txt
@@ -1,24 +1,15 @@
-# Generated from threadedfortuneserver.pro.
-
cmake_minimum_required(VERSION 3.16)
project(threadedfortuneserver LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/network/threadedfortuneserver")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Network)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Network Widgets)
qt_add_executable(threadedfortuneserver
dialog.cpp dialog.h
@@ -26,10 +17,12 @@ qt_add_executable(threadedfortuneserver
fortunethread.cpp fortunethread.h
main.cpp
)
+
set_target_properties(threadedfortuneserver PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(threadedfortuneserver PUBLIC
Qt::Core
Qt::Gui
diff --git a/examples/network/torrent/CMakeLists.txt b/examples/network/torrent/CMakeLists.txt
index dd5e22e2cf..a8110d4d74 100644
--- a/examples/network/torrent/CMakeLists.txt
+++ b/examples/network/torrent/CMakeLists.txt
@@ -1,24 +1,16 @@
-# Generated from torrent.pro.
-
cmake_minimum_required(VERSION 3.16)
project(torrent LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/network/torrent")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Network)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Network Widgets)
qt_add_executable(torrent
addtorrentdialog.cpp addtorrentdialog.h
@@ -35,10 +27,12 @@ qt_add_executable(torrent
torrentserver.cpp torrentserver.h
trackerclient.cpp trackerclient.h
)
+
set_target_properties(torrent PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(torrent PUBLIC
Qt::Core
Qt::Gui
@@ -46,7 +40,6 @@ target_link_libraries(torrent PUBLIC
Qt::Widgets
)
-
# Resources:
set(icons_resource_files
"icons/1downarrow.png"
@@ -59,7 +52,7 @@ set(icons_resource_files
"icons/player_stop.png"
)
-qt6_add_resources(torrent "icons"
+qt_add_resources(torrent "icons"
PREFIX
"/"
FILES
diff --git a/examples/network/torrent/mainwindow.cpp b/examples/network/torrent/mainwindow.cpp
index 10a54e7962..39fca70dab 100644
--- a/examples/network/torrent/mainwindow.cpp
+++ b/examples/network/torrent/mainwindow.cpp
@@ -90,7 +90,7 @@ public:
// Set up a QStyleOptionProgressBar to precisely mimic the
// environment of a progress bar.
QStyleOptionProgressBar progressBarOption;
- progressBarOption.state = QStyle::State_Enabled;
+ progressBarOption.state |= QStyle::State_Enabled;
progressBarOption.direction = QApplication::layoutDirection();
progressBarOption.rect = option.rect;
progressBarOption.fontMetrics = QFontMetrics(QApplication::font());
diff --git a/examples/opengl/2dpainting/CMakeLists.txt b/examples/opengl/2dpainting/CMakeLists.txt
index d808188832..fe5698c747 100644
--- a/examples/opengl/2dpainting/CMakeLists.txt
+++ b/examples/opengl/2dpainting/CMakeLists.txt
@@ -1,25 +1,15 @@
-# Generated from 2dpainting.pro.
-
cmake_minimum_required(VERSION 3.16)
project(2dpainting LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/opengl/2dpainting")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
-find_package(Qt6 COMPONENTS OpenGL)
-find_package(Qt6 COMPONENTS OpenGLWidgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui OpenGL OpenGLWidgets Widgets)
qt_add_executable(2dpainting
glwidget.cpp glwidget.h
@@ -28,10 +18,12 @@ qt_add_executable(2dpainting
widget.cpp widget.h
window.cpp window.h
)
+
set_target_properties(2dpainting PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(2dpainting PUBLIC
Qt::Core
Qt::Gui
diff --git a/examples/opengl/CMakeLists.txt b/examples/opengl/CMakeLists.txt
index af1792edd0..17d9c6da5a 100644
--- a/examples/opengl/CMakeLists.txt
+++ b/examples/opengl/CMakeLists.txt
@@ -1,5 +1,3 @@
-# Generated from opengl.pro.
-
qt_internal_add_example(hellowindow)
qt_internal_add_example(paintedwindow)
qt_internal_add_example(openglwindow)
diff --git a/examples/opengl/computegles31/CMakeLists.txt b/examples/opengl/computegles31/CMakeLists.txt
index 4b28c54ec1..de976ca00b 100644
--- a/examples/opengl/computegles31/CMakeLists.txt
+++ b/examples/opengl/computegles31/CMakeLists.txt
@@ -1,45 +1,38 @@
-# Generated from computegles31.pro.
-
cmake_minimum_required(VERSION 3.16)
project(computegles31 LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/opengl/computegles31")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS OpenGL)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui OpenGL)
qt_add_executable(computegles31
glwindow.cpp glwindow.h
main.cpp
)
+
set_target_properties(computegles31 PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(computegles31 PUBLIC
Qt::Core
Qt::Gui
Qt::OpenGL
)
-
# Resources:
set(computegles31_resource_files
"Qt-logo-medium.png"
)
-qt6_add_resources(computegles31 "computegles31"
+qt_add_resources(computegles31 "computegles31"
PREFIX
"/"
FILES
diff --git a/examples/opengl/contextinfo/CMakeLists.txt b/examples/opengl/contextinfo/CMakeLists.txt
index 1479b6de48..0e51378082 100644
--- a/examples/opengl/contextinfo/CMakeLists.txt
+++ b/examples/opengl/contextinfo/CMakeLists.txt
@@ -1,34 +1,27 @@
-# Generated from contextinfo.pro.
-
cmake_minimum_required(VERSION 3.16)
project(contextinfo LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/opengl/contextinfo")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
-find_package(Qt6 COMPONENTS OpenGL)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui OpenGL Widgets)
qt_add_executable(contextinfo
main.cpp
renderwindow.cpp renderwindow.h
widget.cpp widget.h
)
+
set_target_properties(contextinfo PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(contextinfo PUBLIC
Qt::Core
Qt::Gui
diff --git a/examples/opengl/cube/CMakeLists.txt b/examples/opengl/cube/CMakeLists.txt
index d843c48082..62832e4675 100644
--- a/examples/opengl/cube/CMakeLists.txt
+++ b/examples/opengl/cube/CMakeLists.txt
@@ -1,35 +1,27 @@
-# Generated from cube.pro.
-
cmake_minimum_required(VERSION 3.16)
project(cube LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/opengl/cube")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
-find_package(Qt6 COMPONENTS OpenGL)
-find_package(Qt6 COMPONENTS OpenGLWidgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui OpenGL OpenGLWidgets Widgets)
qt_add_executable(cube
geometryengine.cpp geometryengine.h
main.cpp
mainwidget.cpp mainwidget.h
)
+
set_target_properties(cube PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(cube PUBLIC
Qt::Core
Qt::Gui
@@ -38,7 +30,6 @@ target_link_libraries(cube PUBLIC
Qt::Widgets
)
-
# Resources:
set(shaders_resource_files
"fshader.glsl"
@@ -51,6 +42,7 @@ qt6_add_resources(cube "shaders"
FILES
${shaders_resource_files}
)
+
set(textures_resource_files
"cube.png"
)
diff --git a/examples/opengl/hellogl2/CMakeLists.txt b/examples/opengl/hellogl2/CMakeLists.txt
index 286398a96f..f4b85a329a 100644
--- a/examples/opengl/hellogl2/CMakeLists.txt
+++ b/examples/opengl/hellogl2/CMakeLists.txt
@@ -1,25 +1,15 @@
-# Generated from hellogl2.pro.
-
cmake_minimum_required(VERSION 3.16)
project(hellogl2 LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/opengl/hellogl2")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
-find_package(Qt6 COMPONENTS OpenGL)
-find_package(Qt6 COMPONENTS OpenGLWidgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui OpenGL OpenGLWidgets Widgets)
qt_add_executable(hellogl2
glwidget.cpp glwidget.h
@@ -28,10 +18,12 @@ qt_add_executable(hellogl2
mainwindow.cpp mainwindow.h
window.cpp window.h
)
+
set_target_properties(hellogl2 PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(hellogl2 PUBLIC
Qt::Core
Qt::Gui
diff --git a/examples/opengl/hellogles3/CMakeLists.txt b/examples/opengl/hellogles3/CMakeLists.txt
index 2f831478af..2e0c3069fc 100644
--- a/examples/opengl/hellogles3/CMakeLists.txt
+++ b/examples/opengl/hellogles3/CMakeLists.txt
@@ -1,46 +1,39 @@
-# Generated from hellogles3.pro.
-
cmake_minimum_required(VERSION 3.16)
project(hellogles3 LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/opengl/hellogles3")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS OpenGL)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui OpenGL)
qt_add_executable(hellogles3
../hellogl2/logo.cpp ../hellogl2/logo.h
glwindow.cpp glwindow.h
main.cpp
)
+
set_target_properties(hellogles3 PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(hellogles3 PUBLIC
Qt::Core
Qt::Gui
Qt::OpenGL
)
-
# Resources:
set(hellogles3_resource_files
"qtlogo.png"
)
-qt6_add_resources(hellogles3 "hellogles3"
+qt_add_resources(hellogles3 "hellogles3"
PREFIX
"/"
FILES
diff --git a/examples/opengl/hellowindow/CMakeLists.txt b/examples/opengl/hellowindow/CMakeLists.txt
index 92c76a4abe..cb86df3595 100644
--- a/examples/opengl/hellowindow/CMakeLists.txt
+++ b/examples/opengl/hellowindow/CMakeLists.txt
@@ -1,32 +1,26 @@
-# Generated from hellowindow.pro.
-
cmake_minimum_required(VERSION 3.16)
project(hellowindow LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/opengl/hellowindow")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS OpenGL)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui OpenGL)
qt_add_executable(hellowindow
hellowindow.cpp hellowindow.h
main.cpp
)
+
set_target_properties(hellowindow PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(hellowindow PUBLIC
Qt::Core
Qt::CorePrivate
diff --git a/examples/opengl/openglwindow/.prev_CMakeLists.txt b/examples/opengl/openglwindow/.prev_CMakeLists.txt
deleted file mode 100644
index 9780e18c7f..0000000000
--- a/examples/opengl/openglwindow/.prev_CMakeLists.txt
+++ /dev/null
@@ -1,36 +0,0 @@
-# Generated from openglwindow.pro.
-
-cmake_minimum_required(VERSION 3.14)
-project(openglwindow LANGUAGES CXX)
-
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
-set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
-
-set(INSTALL_EXAMPLEDIR "examples/opengl/openglwindow")
-
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS OpenGL)
-
-add_qt_gui_executable(openglwindow
- main.cpp
- openglwindow.cpp openglwindow.h
-)
-target_include_directories(openglwindow PUBLIC
- ${CMAKE_CURRENT_SOURCE_DIR}
-)
-
-target_link_libraries(openglwindow PUBLIC
- Qt::Core
- Qt::Gui
- Qt::OpenGL
-)
-
-install(TARGETS openglwindow
- RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
-)
diff --git a/examples/opengl/openglwindow/CMakeLists.txt b/examples/opengl/openglwindow/CMakeLists.txt
index ab18bf3f46..3d5511efc9 100644
--- a/examples/opengl/openglwindow/CMakeLists.txt
+++ b/examples/opengl/openglwindow/CMakeLists.txt
@@ -1,35 +1,25 @@
-# Generated from openglwindow.pro.
-
cmake_minimum_required(VERSION 3.16)
project(openglwindow LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/opengl/openglwindow")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS OpenGL)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui OpenGL)
qt_add_executable(openglwindow
main.cpp
openglwindow.cpp openglwindow.h
)
+
set_target_properties(openglwindow PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
-target_include_directories(openglwindow PUBLIC
- ${CMAKE_CURRENT_SOURCE_DIR}
-)
target_link_libraries(openglwindow PUBLIC
Qt::Core
diff --git a/examples/opengl/paintedwindow/CMakeLists.txt b/examples/opengl/paintedwindow/CMakeLists.txt
index c1c7dc5ab8..f8805eb1dc 100644
--- a/examples/opengl/paintedwindow/CMakeLists.txt
+++ b/examples/opengl/paintedwindow/CMakeLists.txt
@@ -1,32 +1,26 @@
-# Generated from paintedwindow.pro.
-
cmake_minimum_required(VERSION 3.16)
project(paintedwindow LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/opengl/paintedwindow")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS OpenGL)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui OpenGL)
qt_add_executable(paintedwindow
main.cpp
paintedwindow.cpp paintedwindow.h
)
+
set_target_properties(paintedwindow PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(paintedwindow PUBLIC
Qt::Core
Qt::Gui
diff --git a/examples/opengl/qopenglwidget/CMakeLists.txt b/examples/opengl/qopenglwidget/CMakeLists.txt
index a96da77e77..d2c48981da 100644
--- a/examples/opengl/qopenglwidget/CMakeLists.txt
+++ b/examples/opengl/qopenglwidget/CMakeLists.txt
@@ -1,25 +1,15 @@
-# Generated from qopenglwidget.pro.
-
cmake_minimum_required(VERSION 3.16)
project(qopenglwidget LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/opengl/qopenglwidget")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
-find_package(Qt6 COMPONENTS OpenGL)
-find_package(Qt6 COMPONENTS OpenGLWidgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui OpenGL OpenGLWidgets Widgets)
qt_add_executable(qopenglwidget
bubble.cpp bubble.h
@@ -27,10 +17,12 @@ qt_add_executable(qopenglwidget
main.cpp
mainwindow.cpp mainwindow.h
)
+
set_target_properties(qopenglwidget PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(qopenglwidget PUBLIC
Qt::Core
Qt::Gui
@@ -39,7 +31,6 @@ target_link_libraries(qopenglwidget PUBLIC
Qt::Widgets
)
-
# Resources:
set(texture_resource_files
"qt.png"
diff --git a/examples/opengl/qopenglwindow/CMakeLists.txt b/examples/opengl/qopenglwindow/CMakeLists.txt
index e8d8e2d3a6..0562cec94c 100644
--- a/examples/opengl/qopenglwindow/CMakeLists.txt
+++ b/examples/opengl/qopenglwindow/CMakeLists.txt
@@ -1,35 +1,25 @@
-# Generated from qopenglwindow.pro.
-
cmake_minimum_required(VERSION 3.16)
project(qopenglwindow LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/opengl/qopenglwindow")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS OpenGL)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui OpenGL)
qt_add_executable(qopenglwindow
background_renderer.cpp background_renderer.h
main.cpp
)
+
set_target_properties(qopenglwindow PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
-target_include_directories(qopenglwindow PUBLIC
- .
-)
target_link_libraries(qopenglwindow PUBLIC
Qt::Core
@@ -37,13 +27,12 @@ target_link_libraries(qopenglwindow PUBLIC
Qt::OpenGL
)
-
# Resources:
set(shaders_resource_files
"background.frag"
)
-qt6_add_resources(qopenglwindow "shaders"
+qt_add_resources(qopenglwindow "shaders"
PREFIX
"/"
FILES
diff --git a/examples/opengl/textures/CMakeLists.txt b/examples/opengl/textures/CMakeLists.txt
index 882877add6..1e7d1a402f 100644
--- a/examples/opengl/textures/CMakeLists.txt
+++ b/examples/opengl/textures/CMakeLists.txt
@@ -1,35 +1,27 @@
-# Generated from textures.pro.
-
cmake_minimum_required(VERSION 3.16)
project(textures LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/opengl/textures")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
-find_package(Qt6 COMPONENTS OpenGL)
-find_package(Qt6 COMPONENTS OpenGLWidgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui OpenGL OpenGLWidgets Widgets)
qt_add_executable(textures
glwidget.cpp glwidget.h
main.cpp
window.cpp window.h
)
+
set_target_properties(textures PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(textures PUBLIC
Qt::Core
Qt::Gui
@@ -38,7 +30,6 @@ target_link_libraries(textures PUBLIC
Qt::Widgets
)
-
# Resources:
set(textures_resource_files
"images/side1.png"
diff --git a/examples/opengl/threadedqopenglwidget/CMakeLists.txt b/examples/opengl/threadedqopenglwidget/CMakeLists.txt
index 66e8e068fb..187813afa1 100644
--- a/examples/opengl/threadedqopenglwidget/CMakeLists.txt
+++ b/examples/opengl/threadedqopenglwidget/CMakeLists.txt
@@ -1,35 +1,28 @@
-# Generated from threadedqopenglwidget.pro.
-
cmake_minimum_required(VERSION 3.16)
project(threadedqopenglwidget LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/opengl/threadedqopenglwidget")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
-find_package(Qt6 COMPONENTS OpenGL)
-find_package(Qt6 COMPONENTS OpenGLWidgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui OpenGL OpenGLWidgets Widgets)
qt_add_executable(threadedqopenglwidget
+ renderer.cpp renderer.h
glwidget.cpp glwidget.h
main.cpp
mainwindow.cpp mainwindow.h
)
+
set_target_properties(threadedqopenglwidget PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(threadedqopenglwidget PUBLIC
Qt::Core
Qt::Gui
diff --git a/examples/opengl/threadedqopenglwidget/glwidget.cpp b/examples/opengl/threadedqopenglwidget/glwidget.cpp
index 2101575fd4..8ffbddd2e3 100644
--- a/examples/opengl/threadedqopenglwidget/glwidget.cpp
+++ b/examples/opengl/threadedqopenglwidget/glwidget.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2022 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
@@ -49,6 +49,8 @@
****************************************************************************/
#include "glwidget.h"
+#include "renderer.h"
+
#include <qmath.h>
#include <QGuiApplication>
@@ -114,254 +116,3 @@ void GLWidget::grabContext()
m_renderer->grabCond()->wakeAll();
m_renderer->unlockRenderer();
}
-
-Renderer::Renderer(GLWidget *w) : m_glwidget(w) {}
-
-void Renderer::paintQtLogo()
-{
- vbo.bind();
- program.setAttributeBuffer(vertexAttr, GL_FLOAT, 0, 3);
- program.setAttributeBuffer(normalAttr, GL_FLOAT, vertices.count() * 3 * sizeof(GLfloat), 3);
- vbo.release();
-
- program.enableAttributeArray(vertexAttr);
- program.enableAttributeArray(normalAttr);
-
- glDrawArrays(GL_TRIANGLES, 0, vertices.size());
-
- program.disableAttributeArray(normalAttr);
- program.disableAttributeArray(vertexAttr);
-}
-
-// Some OpenGL implementations have serious issues with compiling and linking
-// shaders on multiple threads concurrently. Avoid this.
-Q_GLOBAL_STATIC(QMutex, initMutex)
-
-void Renderer::render()
-{
- if (m_exiting)
- return;
-
- QOpenGLContext *ctx = m_glwidget->context();
- if (!ctx) // QOpenGLWidget not yet initialized
- return;
-
- // Grab the context.
- m_grabMutex.lock();
- emit contextWanted();
- m_grabCond.wait(&m_grabMutex);
- QMutexLocker lock(&m_renderMutex);
- m_grabMutex.unlock();
-
- if (m_exiting)
- return;
-
- Q_ASSERT(ctx->thread() == QThread::currentThread());
-
- // Make the context (and an offscreen surface) current for this thread. The
- // QOpenGLWidget's fbo is bound in the context.
- m_glwidget->makeCurrent();
-
- if (!m_inited) {
- m_inited = true;
- initializeOpenGLFunctions();
-
- QMutexLocker initLock(initMutex());
- QOpenGLShader *vshader = new QOpenGLShader(QOpenGLShader::Vertex, this);
- const char *vsrc =
- "attribute highp vec4 vertex;\n"
- "attribute mediump vec3 normal;\n"
- "uniform mediump mat4 matrix;\n"
- "varying mediump vec4 color;\n"
- "void main(void)\n"
- "{\n"
- " vec3 toLight = normalize(vec3(0.0, 0.3, 1.0));\n"
- " float angle = max(dot(normal, toLight), 0.0);\n"
- " vec3 col = vec3(0.40, 1.0, 0.0);\n"
- " color = vec4(col * 0.2 + col * 0.8 * angle, 1.0);\n"
- " color = clamp(color, 0.0, 1.0);\n"
- " gl_Position = matrix * vertex;\n"
- "}\n";
- vshader->compileSourceCode(vsrc);
-
- QOpenGLShader *fshader = new QOpenGLShader(QOpenGLShader::Fragment, this);
- const char *fsrc =
- "varying mediump vec4 color;\n"
- "void main(void)\n"
- "{\n"
- " gl_FragColor = color;\n"
- "}\n";
- fshader->compileSourceCode(fsrc);
-
- program.addShader(vshader);
- program.addShader(fshader);
- program.link();
-
- vertexAttr = program.attributeLocation("vertex");
- normalAttr = program.attributeLocation("normal");
- matrixUniform = program.uniformLocation("matrix");
-
- m_fAngle = 0;
- m_fScale = 1;
- createGeometry();
-
- vbo.create();
- vbo.bind();
- const int verticesSize = vertices.count() * 3 * sizeof(GLfloat);
- vbo.allocate(verticesSize * 2);
- vbo.write(0, vertices.constData(), verticesSize);
- vbo.write(verticesSize, normals.constData(), verticesSize);
-
- m_elapsed.start();
- }
-
- //qDebug("%p elapsed %lld", QThread::currentThread(), m_elapsed.restart());
-
- glClearColor(0.1f, 0.2f, 0.2f, 1.0f);
- glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
-
- glFrontFace(GL_CW);
- glCullFace(GL_FRONT);
- glEnable(GL_CULL_FACE);
- glEnable(GL_DEPTH_TEST);
-
- QMatrix4x4 modelview;
- modelview.rotate(m_fAngle, 0.0f, 1.0f, 0.0f);
- modelview.rotate(m_fAngle, 1.0f, 0.0f, 0.0f);
- modelview.rotate(m_fAngle, 0.0f, 0.0f, 1.0f);
- modelview.scale(m_fScale);
- modelview.translate(0.0f, -0.2f, 0.0f);
-
- program.bind();
- program.setUniformValue(matrixUniform, modelview);
- paintQtLogo();
- program.release();
-
- glDisable(GL_DEPTH_TEST);
- glDisable(GL_CULL_FACE);
-
- m_fAngle += 1.0f;
-
- // Make no context current on this thread and move the QOpenGLWidget's
- // context back to the gui thread.
- m_glwidget->doneCurrent();
- ctx->moveToThread(qGuiApp->thread());
-
- // Schedule composition. Note that this will use QueuedConnection, meaning
- // that update() will be invoked on the gui thread.
- QMetaObject::invokeMethod(m_glwidget, "update");
-}
-
-void Renderer::createGeometry()
-{
- vertices.clear();
- normals.clear();
-
- qreal x1 = +0.06f;
- qreal y1 = -0.14f;
- qreal x2 = +0.14f;
- qreal y2 = -0.06f;
- qreal x3 = +0.08f;
- qreal y3 = +0.00f;
- qreal x4 = +0.30f;
- qreal y4 = +0.22f;
-
- quad(x1, y1, x2, y2, y2, x2, y1, x1);
- quad(x3, y3, x4, y4, y4, x4, y3, x3);
-
- extrude(x1, y1, x2, y2);
- extrude(x2, y2, y2, x2);
- extrude(y2, x2, y1, x1);
- extrude(y1, x1, x1, y1);
- extrude(x3, y3, x4, y4);
- extrude(x4, y4, y4, x4);
- extrude(y4, x4, y3, x3);
-
- const int NumSectors = 100;
- const qreal sectorAngle = 2 * qreal(M_PI) / NumSectors;
-
- for (int i = 0; i < NumSectors; ++i) {
- qreal angle = i * sectorAngle;
- qreal x5 = 0.30 * sin(angle);
- qreal y5 = 0.30 * cos(angle);
- qreal x6 = 0.20 * sin(angle);
- qreal y6 = 0.20 * cos(angle);
-
- angle += sectorAngle;
- qreal x7 = 0.20 * sin(angle);
- qreal y7 = 0.20 * cos(angle);
- qreal x8 = 0.30 * sin(angle);
- qreal y8 = 0.30 * cos(angle);
-
- quad(x5, y5, x6, y6, x7, y7, x8, y8);
-
- extrude(x6, y6, x7, y7);
- extrude(x8, y8, x5, y5);
- }
-
- for (int i = 0;i < vertices.size();i++)
- vertices[i] *= 2.0f;
-}
-
-void Renderer::quad(qreal x1, qreal y1, qreal x2, qreal y2, qreal x3, qreal y3, qreal x4, qreal y4)
-{
- vertices << QVector3D(x1, y1, -0.05f);
- vertices << QVector3D(x2, y2, -0.05f);
- vertices << QVector3D(x4, y4, -0.05f);
-
- vertices << QVector3D(x3, y3, -0.05f);
- vertices << QVector3D(x4, y4, -0.05f);
- vertices << QVector3D(x2, y2, -0.05f);
-
- QVector3D n = QVector3D::normal
- (QVector3D(x2 - x1, y2 - y1, 0.0f), QVector3D(x4 - x1, y4 - y1, 0.0f));
-
- normals << n;
- normals << n;
- normals << n;
-
- normals << n;
- normals << n;
- normals << n;
-
- vertices << QVector3D(x4, y4, 0.05f);
- vertices << QVector3D(x2, y2, 0.05f);
- vertices << QVector3D(x1, y1, 0.05f);
-
- vertices << QVector3D(x2, y2, 0.05f);
- vertices << QVector3D(x4, y4, 0.05f);
- vertices << QVector3D(x3, y3, 0.05f);
-
- n = QVector3D::normal
- (QVector3D(x2 - x4, y2 - y4, 0.0f), QVector3D(x1 - x4, y1 - y4, 0.0f));
-
- normals << n;
- normals << n;
- normals << n;
-
- normals << n;
- normals << n;
- normals << n;
-}
-
-void Renderer::extrude(qreal x1, qreal y1, qreal x2, qreal y2)
-{
- vertices << QVector3D(x1, y1, +0.05f);
- vertices << QVector3D(x2, y2, +0.05f);
- vertices << QVector3D(x1, y1, -0.05f);
-
- vertices << QVector3D(x2, y2, -0.05f);
- vertices << QVector3D(x1, y1, -0.05f);
- vertices << QVector3D(x2, y2, +0.05f);
-
- QVector3D n = QVector3D::normal
- (QVector3D(x2 - x1, y2 - y1, 0.0f), QVector3D(0.0f, 0.0f, -0.1f));
-
- normals << n;
- normals << n;
- normals << n;
-
- normals << n;
- normals << n;
- normals << n;
-}
diff --git a/examples/opengl/threadedqopenglwidget/glwidget.h b/examples/opengl/threadedqopenglwidget/glwidget.h
index 2bff56c471..86a1da4fc2 100644
--- a/examples/opengl/threadedqopenglwidget/glwidget.h
+++ b/examples/opengl/threadedqopenglwidget/glwidget.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2022 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
@@ -52,59 +52,10 @@
#define GLWIDGET_H
#include <QOpenGLWidget>
-#include <QOpenGLFunctions>
-#include <QOpenGLShaderProgram>
-#include <QOpenGLBuffer>
-#include <QVector3D>
-#include <QMatrix4x4>
-#include <QThread>
-#include <QMutex>
-#include <QWaitCondition>
-#include <QElapsedTimer>
-class GLWidget;
+QT_FORWARD_DECLARE_CLASS(QThread)
-class Renderer : public QObject, protected QOpenGLFunctions
-{
- Q_OBJECT
-
-public:
- Renderer(GLWidget *w);
- void lockRenderer() { m_renderMutex.lock(); }
- void unlockRenderer() { m_renderMutex.unlock(); }
- QMutex *grabMutex() { return &m_grabMutex; }
- QWaitCondition *grabCond() { return &m_grabCond; }
- void prepareExit() { m_exiting = true; m_grabCond.wakeAll(); }
-
-signals:
- void contextWanted();
-
-public slots:
- void render();
-
-private:
- void paintQtLogo();
- void createGeometry();
- void quad(qreal x1, qreal y1, qreal x2, qreal y2, qreal x3, qreal y3, qreal x4, qreal y4);
- void extrude(qreal x1, qreal y1, qreal x2, qreal y2);
-
- bool m_inited = false;
- qreal m_fAngle = 0;
- qreal m_fScale = 1;
- QList<QVector3D> vertices;
- QList<QVector3D> normals;
- QOpenGLShaderProgram program;
- QOpenGLBuffer vbo;
- int vertexAttr = 0;
- int normalAttr = 0;
- int matrixUniform = 0;
- GLWidget *m_glwidget = nullptr;
- QMutex m_renderMutex;
- QElapsedTimer m_elapsed;
- QMutex m_grabMutex;
- QWaitCondition m_grabCond;
- bool m_exiting = false;
-};
+class Renderer;
class GLWidget : public QOpenGLWidget
{
@@ -133,4 +84,4 @@ private:
Renderer *m_renderer;
};
-#endif
+#endif // GLWIDGET_H
diff --git a/examples/opengl/threadedqopenglwidget/main.cpp b/examples/opengl/threadedqopenglwidget/main.cpp
index 975def030b..2553d7754b 100644
--- a/examples/opengl/threadedqopenglwidget/main.cpp
+++ b/examples/opengl/threadedqopenglwidget/main.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2022 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
@@ -51,8 +51,10 @@
#include <QApplication>
#include <QMainWindow>
#include <QScreen>
+#include <QShortcut>
#include <QSurfaceFormat>
#include <QOpenGLContext>
+#include <QOpenGLFunctions>
#include <QCommandLineParser>
#include <QCommandLineOption>
#include "mainwindow.h"
@@ -95,6 +97,8 @@ int main( int argc, char ** argv )
topLevelGlWidget.resize(200, 200);
topLevelGlWidget.move(pos);
topLevelGlWidget.show();
+ auto *closeShortcut = new QShortcut(Qt::CTRL | Qt::Key_Q, &a, QApplication::closeAllWindows);
+ closeShortcut->setContext(Qt::ApplicationShortcut);
const QString glInfo = getGlString(topLevelGlWidget.context()->functions(), GL_VENDOR)
+ QLatin1Char('/') + getGlString(topLevelGlWidget.context()->functions(), GL_RENDERER);
diff --git a/examples/opengl/threadedqopenglwidget/mainwindow.cpp b/examples/opengl/threadedqopenglwidget/mainwindow.cpp
index 60367c91d8..5cdbfd7bf0 100644
--- a/examples/opengl/threadedqopenglwidget/mainwindow.cpp
+++ b/examples/opengl/threadedqopenglwidget/mainwindow.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2022 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
diff --git a/examples/opengl/threadedqopenglwidget/mainwindow.h b/examples/opengl/threadedqopenglwidget/mainwindow.h
index 6e7b17467f..60f81f2541 100644
--- a/examples/opengl/threadedqopenglwidget/mainwindow.h
+++ b/examples/opengl/threadedqopenglwidget/mainwindow.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2022 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
diff --git a/examples/opengl/threadedqopenglwidget/renderer.cpp b/examples/opengl/threadedqopenglwidget/renderer.cpp
new file mode 100644
index 0000000000..f1b4e21e50
--- /dev/null
+++ b/examples/opengl/threadedqopenglwidget/renderer.cpp
@@ -0,0 +1,314 @@
+/****************************************************************************
+**
+** Copyright (C) 2022 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "renderer.h"
+#include <qmath.h>
+#include <QOpenGLWidget>
+#include <QGuiApplication>
+
+static const char VERTEX_SHADER[] = R"(attribute highp vec4 vertex;
+attribute mediump vec3 normal;
+uniform mediump mat4 matrix;
+varying mediump vec4 color;
+void main(void)
+{
+ vec3 toLight = normalize(vec3(0.0, 0.3, 1.0));
+ float angle = max(dot(normal, toLight), 0.0);
+ vec3 col = vec3(0.40, 1.0, 0.0);
+ color = vec4(col * 0.2 + col * 0.8 * angle, 1.0);
+ color = clamp(color, 0.0, 1.0);
+ gl_Position = matrix * vertex;
+}
+)";
+
+static const char FRAGMENT_SHADER[] = R"(varying mediump vec4 color;
+void main(void)
+{
+ gl_FragColor = color;
+}
+)";
+
+Renderer::Renderer(QOpenGLWidget *w) :
+ m_glwidget(w)
+{
+}
+
+void Renderer::paintQtLogo()
+{
+ vbo.bind();
+ program.setAttributeBuffer(vertexAttr, GL_FLOAT, 0, 3);
+ program.setAttributeBuffer(normalAttr, GL_FLOAT, vertices.count() * 3 * sizeof(GLfloat), 3);
+ vbo.release();
+
+ program.enableAttributeArray(vertexAttr);
+ program.enableAttributeArray(normalAttr);
+
+ glDrawArrays(GL_TRIANGLES, 0, vertices.size());
+
+ program.disableAttributeArray(normalAttr);
+ program.disableAttributeArray(vertexAttr);
+}
+
+// Some OpenGL implementations have serious issues with compiling and linking
+// shaders on multiple threads concurrently. Avoid this.
+Q_GLOBAL_STATIC(QMutex, initMutex)
+
+void Renderer::render()
+{
+ if (m_exiting)
+ return;
+
+ QOpenGLContext *ctx = m_glwidget->context();
+ if (!ctx) // QOpenGLWidget not yet initialized
+ return;
+
+ // Grab the context.
+ m_grabMutex.lock();
+ emit contextWanted();
+ m_grabCond.wait(&m_grabMutex);
+ QMutexLocker lock(&m_renderMutex);
+ m_grabMutex.unlock();
+
+ if (m_exiting)
+ return;
+
+ Q_ASSERT(ctx->thread() == QThread::currentThread());
+
+ // Make the context (and an offscreen surface) current for this thread. The
+ // QOpenGLWidget's fbo is bound in the context.
+ m_glwidget->makeCurrent();
+
+ if (!m_inited) {
+ m_inited = true;
+ initializeOpenGLFunctions();
+
+ QMutexLocker initLock(initMutex());
+ QOpenGLShader *vshader = new QOpenGLShader(QOpenGLShader::Vertex, this);
+ vshader->compileSourceCode(VERTEX_SHADER);
+
+ QOpenGLShader *fshader = new QOpenGLShader(QOpenGLShader::Fragment, this);
+ fshader->compileSourceCode(FRAGMENT_SHADER);
+
+ program.addShader(vshader);
+ program.addShader(fshader);
+ program.link();
+
+ vertexAttr = program.attributeLocation("vertex");
+ normalAttr = program.attributeLocation("normal");
+ matrixUniform = program.uniformLocation("matrix");
+
+ m_fAngle = 0;
+ m_fScale = 1;
+ createGeometry();
+
+ vbo.create();
+ vbo.bind();
+ const int verticesSize = vertices.count() * 3 * sizeof(GLfloat);
+ vbo.allocate(verticesSize * 2);
+ vbo.write(0, vertices.constData(), verticesSize);
+ vbo.write(verticesSize, normals.constData(), verticesSize);
+
+ m_elapsed.start();
+ }
+
+ //qDebug("%p elapsed %lld", QThread::currentThread(), m_elapsed.restart());
+
+ glClearColor(0.1f, 0.2f, 0.2f, 1.0f);
+ glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
+
+ glFrontFace(GL_CW);
+ glCullFace(GL_FRONT);
+ glEnable(GL_CULL_FACE);
+ glEnable(GL_DEPTH_TEST);
+
+ QMatrix4x4 modelview;
+ modelview.rotate(m_fAngle, 0.0f, 1.0f, 0.0f);
+ modelview.rotate(m_fAngle, 1.0f, 0.0f, 0.0f);
+ modelview.rotate(m_fAngle, 0.0f, 0.0f, 1.0f);
+ modelview.scale(m_fScale);
+ modelview.translate(0.0f, -0.2f, 0.0f);
+
+ program.bind();
+ program.setUniformValue(matrixUniform, modelview);
+ paintQtLogo();
+ program.release();
+
+ glDisable(GL_DEPTH_TEST);
+ glDisable(GL_CULL_FACE);
+
+ m_fAngle += 1.0f;
+
+ // Make no context current on this thread and move the QOpenGLWidget's
+ // context back to the gui thread.
+ m_glwidget->doneCurrent();
+ ctx->moveToThread(qGuiApp->thread());
+
+ // Schedule composition. Note that this will use QueuedConnection, meaning
+ // that update() will be invoked on the gui thread.
+ QMetaObject::invokeMethod(m_glwidget, "update");
+}
+
+void Renderer::createGeometry()
+{
+ vertices.clear();
+ normals.clear();
+
+ qreal x1 = +0.06f;
+ qreal y1 = -0.14f;
+ qreal x2 = +0.14f;
+ qreal y2 = -0.06f;
+ qreal x3 = +0.08f;
+ qreal y3 = +0.00f;
+ qreal x4 = +0.30f;
+ qreal y4 = +0.22f;
+
+ quad(x1, y1, x2, y2, y2, x2, y1, x1);
+ quad(x3, y3, x4, y4, y4, x4, y3, x3);
+
+ extrude(x1, y1, x2, y2);
+ extrude(x2, y2, y2, x2);
+ extrude(y2, x2, y1, x1);
+ extrude(y1, x1, x1, y1);
+ extrude(x3, y3, x4, y4);
+ extrude(x4, y4, y4, x4);
+ extrude(y4, x4, y3, x3);
+
+ const int NumSectors = 100;
+ const qreal sectorAngle = 2 * qreal(M_PI) / NumSectors;
+
+ for (int i = 0; i < NumSectors; ++i) {
+ qreal angle = i * sectorAngle;
+ qreal sinAngle = sin(angle);
+ qreal cosAngle = cos(angle);
+ qreal x5 = 0.30 * sinAngle;
+ qreal y5 = 0.30 * cosAngle;
+ qreal x6 = 0.20 * sinAngle;
+ qreal y6 = 0.20 * cosAngle;
+
+ angle += sectorAngle;
+ sinAngle = sin(angle);
+ cosAngle = cos(angle);
+ qreal x7 = 0.20 * sinAngle;
+ qreal y7 = 0.20 * cosAngle;
+ qreal x8 = 0.30 * sinAngle;
+ qreal y8 = 0.30 * cosAngle;
+
+ quad(x5, y5, x6, y6, x7, y7, x8, y8);
+
+ extrude(x6, y6, x7, y7);
+ extrude(x8, y8, x5, y5);
+ }
+
+ for (qsizetype i = 0; i < vertices.size(); ++i)
+ vertices[i] *= 2.0f;
+}
+
+void Renderer::quad(qreal x1, qreal y1, qreal x2, qreal y2, qreal x3, qreal y3, qreal x4, qreal y4)
+{
+ vertices << QVector3D(x1, y1, -0.05f);
+ vertices << QVector3D(x2, y2, -0.05f);
+ vertices << QVector3D(x4, y4, -0.05f);
+
+ vertices << QVector3D(x3, y3, -0.05f);
+ vertices << QVector3D(x4, y4, -0.05f);
+ vertices << QVector3D(x2, y2, -0.05f);
+
+ QVector3D n = QVector3D::normal
+ (QVector3D(x2 - x1, y2 - y1, 0.0f), QVector3D(x4 - x1, y4 - y1, 0.0f));
+
+ normals << n;
+ normals << n;
+ normals << n;
+
+ normals << n;
+ normals << n;
+ normals << n;
+
+ vertices << QVector3D(x4, y4, 0.05f);
+ vertices << QVector3D(x2, y2, 0.05f);
+ vertices << QVector3D(x1, y1, 0.05f);
+
+ vertices << QVector3D(x2, y2, 0.05f);
+ vertices << QVector3D(x4, y4, 0.05f);
+ vertices << QVector3D(x3, y3, 0.05f);
+
+ n = QVector3D::normal
+ (QVector3D(x2 - x4, y2 - y4, 0.0f), QVector3D(x1 - x4, y1 - y4, 0.0f));
+
+ normals << n;
+ normals << n;
+ normals << n;
+
+ normals << n;
+ normals << n;
+ normals << n;
+}
+
+void Renderer::extrude(qreal x1, qreal y1, qreal x2, qreal y2)
+{
+ vertices << QVector3D(x1, y1, +0.05f);
+ vertices << QVector3D(x2, y2, +0.05f);
+ vertices << QVector3D(x1, y1, -0.05f);
+
+ vertices << QVector3D(x2, y2, -0.05f);
+ vertices << QVector3D(x1, y1, -0.05f);
+ vertices << QVector3D(x2, y2, +0.05f);
+
+ QVector3D n = QVector3D::normal
+ (QVector3D(x2 - x1, y2 - y1, 0.0f), QVector3D(0.0f, 0.0f, -0.1f));
+
+ normals << n;
+ normals << n;
+ normals << n;
+
+ normals << n;
+ normals << n;
+ normals << n;
+}
diff --git a/examples/opengl/threadedqopenglwidget/renderer.h b/examples/opengl/threadedqopenglwidget/renderer.h
new file mode 100644
index 0000000000..ad972bea79
--- /dev/null
+++ b/examples/opengl/threadedqopenglwidget/renderer.h
@@ -0,0 +1,108 @@
+/****************************************************************************
+**
+** Copyright (C) 2022 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the examples of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef RENDERER_H
+#define RENDERER_H
+
+#include <QOpenGLFunctions>
+#include <QOpenGLBuffer>
+#include <QOpenGLShaderProgram>
+#include <QVector3D>
+#include <QMatrix4x4>
+#include <QThread>
+#include <QMutex>
+#include <QWaitCondition>
+#include <QElapsedTimer>
+
+QT_FORWARD_DECLARE_CLASS(QOpenGLWidget)
+
+class Renderer : public QObject, protected QOpenGLFunctions
+{
+ Q_OBJECT
+
+public:
+ explicit Renderer(QOpenGLWidget *w);
+ void lockRenderer() { m_renderMutex.lock(); }
+ void unlockRenderer() { m_renderMutex.unlock(); }
+ QMutex *grabMutex() { return &m_grabMutex; }
+ QWaitCondition *grabCond() { return &m_grabCond; }
+ void prepareExit() { m_exiting = true; m_grabCond.wakeAll(); }
+
+signals:
+ void contextWanted();
+
+public slots:
+ void render();
+
+private:
+ void paintQtLogo();
+ void createGeometry();
+ void quad(qreal x1, qreal y1, qreal x2, qreal y2, qreal x3, qreal y3, qreal x4, qreal y4);
+ void extrude(qreal x1, qreal y1, qreal x2, qreal y2);
+
+ bool m_inited = false;
+ qreal m_fAngle = 0;
+ qreal m_fScale = 1;
+ QList<QVector3D> vertices;
+ QList<QVector3D> normals;
+ QOpenGLShaderProgram program;
+ QOpenGLBuffer vbo;
+ int vertexAttr = 0;
+ int normalAttr = 0;
+ int matrixUniform = 0;
+ QOpenGLWidget *m_glwidget = nullptr;
+ QMutex m_renderMutex;
+ QElapsedTimer m_elapsed;
+ QMutex m_grabMutex;
+ QWaitCondition m_grabCond;
+ bool m_exiting = false;
+};
+
+#endif // RENDERER_H
diff --git a/examples/opengl/threadedqopenglwidget/threadedqopenglwidget.pro b/examples/opengl/threadedqopenglwidget/threadedqopenglwidget.pro
index a62fbeb9c2..46332ab7cb 100644
--- a/examples/opengl/threadedqopenglwidget/threadedqopenglwidget.pro
+++ b/examples/opengl/threadedqopenglwidget/threadedqopenglwidget.pro
@@ -2,10 +2,12 @@ QT += widgets opengl openglwidgets
SOURCES += main.cpp \
glwidget.cpp \
- mainwindow.cpp
+ mainwindow.cpp \
+ renderer.cpp
HEADERS += glwidget.h \
- mainwindow.h
+ mainwindow.h \
+ renderer.h
target.path = $$[QT_INSTALL_EXAMPLES]/opengl/threadedqopenglwidget
INSTALLS += target
diff --git a/examples/qpa/CMakeLists.txt b/examples/qpa/CMakeLists.txt
index a5043f2407..54f9e65051 100644
--- a/examples/qpa/CMakeLists.txt
+++ b/examples/qpa/CMakeLists.txt
@@ -1,5 +1,3 @@
-# Generated from qpa.pro.
-
if(NOT TARGET Qt::Gui)
return()
endif()
diff --git a/examples/qpa/qrasterwindow/.prev_CMakeLists.txt b/examples/qpa/qrasterwindow/.prev_CMakeLists.txt
deleted file mode 100644
index 8fd75f1079..0000000000
--- a/examples/qpa/qrasterwindow/.prev_CMakeLists.txt
+++ /dev/null
@@ -1,29 +0,0 @@
-# Generated from qrasterwindow.pro.
-
-cmake_minimum_required(VERSION 3.14)
-project(qrasterwindow LANGUAGES CXX)
-
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
-set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
-
-set(INSTALL_EXAMPLEDIR "examples/qpa/qrasterwindow")
-
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-
-add_qt_gui_executable(qrasterwindow
- main.cpp
-)
-target_link_libraries(qrasterwindow PUBLIC
- Qt::Core
- Qt::Gui
-)
-
-install(TARGETS qrasterwindow
- RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
-)
diff --git a/examples/qpa/qrasterwindow/CMakeLists.txt b/examples/qpa/qrasterwindow/CMakeLists.txt
index 60a4a0c13e..60daaaaafa 100644
--- a/examples/qpa/qrasterwindow/CMakeLists.txt
+++ b/examples/qpa/qrasterwindow/CMakeLists.txt
@@ -1,30 +1,25 @@
-# Generated from qrasterwindow.pro.
-
cmake_minimum_required(VERSION 3.16)
project(qrasterwindow LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/qpa/qrasterwindow")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui)
qt_add_executable(qrasterwindow
main.cpp
)
+
set_target_properties(qrasterwindow PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(qrasterwindow PUBLIC
Qt::Core
Qt::Gui
diff --git a/examples/qpa/windows/CMakeLists.txt b/examples/qpa/windows/CMakeLists.txt
index 8cb9e1b3c0..284a1f9d53 100644
--- a/examples/qpa/windows/CMakeLists.txt
+++ b/examples/qpa/windows/CMakeLists.txt
@@ -1,31 +1,26 @@
-# Generated from windows.pro.
-
cmake_minimum_required(VERSION 3.16)
project(windows LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/qpa/windows")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui)
qt_add_executable(windows
main.cpp
window.cpp window.h
)
+
set_target_properties(windows PROPERTIES
WIN32_EXECUTABLE FALSE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(windows PUBLIC
Qt::Core
Qt::CorePrivate
diff --git a/examples/qtconcurrent/CMakeLists.txt b/examples/qtconcurrent/CMakeLists.txt
index 0cf2bee39c..7360c55633 100644
--- a/examples/qtconcurrent/CMakeLists.txt
+++ b/examples/qtconcurrent/CMakeLists.txt
@@ -1,5 +1,3 @@
-# Generated from qtconcurrent.pro.
-
if(NOT TARGET Qt::Concurrent)
return()
endif()
diff --git a/examples/qtconcurrent/imagescaling/CMakeLists.txt b/examples/qtconcurrent/imagescaling/CMakeLists.txt
index bb1677983d..abe9fb529a 100644
--- a/examples/qtconcurrent/imagescaling/CMakeLists.txt
+++ b/examples/qtconcurrent/imagescaling/CMakeLists.txt
@@ -1,35 +1,28 @@
-# Generated from imagescaling.pro.
-
cmake_minimum_required(VERSION 3.16)
project(imagescaling LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/qtconcurrent/imagescaling")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Concurrent)
-find_package(Qt6 COMPONENTS Widgets)
-find_package(Qt6 COMPONENTS Network)
+find_package(Qt6 REQUIRED COMPONENTS Concurrent Core Gui Network Widgets)
qt_add_executable(imagescaling
downloaddialog.cpp downloaddialog.h downloaddialog.ui
imagescaling.cpp imagescaling.h
main.cpp
)
+
set_target_properties(imagescaling PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(imagescaling PUBLIC
Qt::Concurrent
Qt::Core
diff --git a/examples/qtconcurrent/map/.prev_CMakeLists.txt b/examples/qtconcurrent/map/.prev_CMakeLists.txt
deleted file mode 100644
index 0e3215c225..0000000000
--- a/examples/qtconcurrent/map/.prev_CMakeLists.txt
+++ /dev/null
@@ -1,39 +0,0 @@
-# Generated from map.pro.
-
-cmake_minimum_required(VERSION 3.14)
-project(mapdemo LANGUAGES CXX)
-
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
-set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
-
-if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
-endif()
-
-set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/qtconcurrent/map")
-
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Concurrent)
-
-qt_add_executable(mapdemo
- main.cpp
-)
-set_target_properties(mapdemo PROPERTIES
- WIN32_EXECUTABLE FALSE
- MACOSX_BUNDLE FALSE
-)
-target_link_libraries(mapdemo PUBLIC
- Qt::Concurrent
- Qt::Core
- Qt::Gui
-)
-
-install(TARGETS mapdemo
- RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
-)
diff --git a/examples/qtconcurrent/map/CMakeLists.txt b/examples/qtconcurrent/map/CMakeLists.txt
index 84fec3fb7d..18380c2a42 100644
--- a/examples/qtconcurrent/map/CMakeLists.txt
+++ b/examples/qtconcurrent/map/CMakeLists.txt
@@ -1,36 +1,26 @@
-# Generated from map.pro.
-
cmake_minimum_required(VERSION 3.16)
project(mapdemo LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/qtconcurrent/map")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Concurrent)
+find_package(Qt6 REQUIRED COMPONENTS Concurrent Core Gui)
qt_add_executable(mapdemo
main.cpp
)
-set_target_properties(mapdemo PROPERTIES
- WIN32_EXECUTABLE FALSE
- MACOSX_BUNDLE FALSE
-)
+
target_link_libraries(mapdemo PUBLIC
Qt::Concurrent
Qt::Core
Qt::Gui
)
+
install(TARGETS mapdemo
RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
diff --git a/examples/qtconcurrent/progressdialog/CMakeLists.txt b/examples/qtconcurrent/progressdialog/CMakeLists.txt
index 304aefcf00..068eaac135 100644
--- a/examples/qtconcurrent/progressdialog/CMakeLists.txt
+++ b/examples/qtconcurrent/progressdialog/CMakeLists.txt
@@ -1,32 +1,25 @@
-# Generated from progressdialog.pro.
-
cmake_minimum_required(VERSION 3.16)
project(progressdialog LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/qtconcurrent/progressdialog")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Concurrent)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Concurrent Core Gui Widgets)
qt_add_executable(progressdialog
main.cpp
)
+
set_target_properties(progressdialog PROPERTIES
WIN32_EXECUTABLE FALSE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(progressdialog PUBLIC
Qt::Concurrent
Qt::Core
diff --git a/examples/qtconcurrent/runfunction/CMakeLists.txt b/examples/qtconcurrent/runfunction/CMakeLists.txt
index 1723d23fdf..21c433b50a 100644
--- a/examples/qtconcurrent/runfunction/CMakeLists.txt
+++ b/examples/qtconcurrent/runfunction/CMakeLists.txt
@@ -1,32 +1,20 @@
-# Generated from runfunction.pro.
-
cmake_minimum_required(VERSION 3.16)
project(runfunction LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/qtconcurrent/runfunction")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Concurrent)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Concurrent Core Gui Widgets)
qt_add_executable(runfunction
main.cpp
)
-set_target_properties(runfunction PROPERTIES
- WIN32_EXECUTABLE FALSE
- MACOSX_BUNDLE FALSE
-)
+
target_link_libraries(runfunction PUBLIC
Qt::Concurrent
Qt::Core
diff --git a/examples/qtconcurrent/wordcount/CMakeLists.txt b/examples/qtconcurrent/wordcount/CMakeLists.txt
index e2566b0a8f..c62e5ad8e7 100644
--- a/examples/qtconcurrent/wordcount/CMakeLists.txt
+++ b/examples/qtconcurrent/wordcount/CMakeLists.txt
@@ -1,32 +1,20 @@
-# Generated from wordcount.pro.
-
cmake_minimum_required(VERSION 3.16)
project(wordcount LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/qtconcurrent/wordcount")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Concurrent)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Concurrent Core Gui Widgets)
qt_add_executable(wordcount
main.cpp
)
-set_target_properties(wordcount PROPERTIES
- WIN32_EXECUTABLE FALSE
- MACOSX_BUNDLE FALSE
-)
+
target_link_libraries(wordcount PUBLIC
Qt::Concurrent
Qt::Core
diff --git a/examples/qtestlib/CMakeLists.txt b/examples/qtestlib/CMakeLists.txt
index 84fd46acf9..e2b00670ed 100644
--- a/examples/qtestlib/CMakeLists.txt
+++ b/examples/qtestlib/CMakeLists.txt
@@ -1,5 +1,3 @@
-# Generated from qtestlib.pro.
-
if(NOT TARGET Qt::Widgets)
return()
endif()
diff --git a/examples/qtestlib/tutorial1/CMakeLists.txt b/examples/qtestlib/tutorial1/CMakeLists.txt
index 691150a895..ff47a15970 100644
--- a/examples/qtestlib/tutorial1/CMakeLists.txt
+++ b/examples/qtestlib/tutorial1/CMakeLists.txt
@@ -1,32 +1,25 @@
-# Generated from tutorial1.pro.
-
cmake_minimum_required(VERSION 3.16)
project(tutorial1 LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/qtestlib/tutorial1")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
-find_package(Qt6 COMPONENTS Test)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Test Widgets)
qt_add_executable(tutorial1
testqstring.cpp
)
+
set_target_properties(tutorial1 PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(tutorial1 PUBLIC
Qt::Core
Qt::Gui
diff --git a/examples/qtestlib/tutorial2/CMakeLists.txt b/examples/qtestlib/tutorial2/CMakeLists.txt
index c5b7a7dabc..791be7df06 100644
--- a/examples/qtestlib/tutorial2/CMakeLists.txt
+++ b/examples/qtestlib/tutorial2/CMakeLists.txt
@@ -1,32 +1,25 @@
-# Generated from tutorial2.pro.
-
cmake_minimum_required(VERSION 3.16)
project(tutorial2 LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/qtestlib/tutorial2")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
-find_package(Qt6 COMPONENTS Test)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Test Widgets)
qt_add_executable(tutorial2
testqstring.cpp
)
+
set_target_properties(tutorial2 PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(tutorial2 PUBLIC
Qt::Core
Qt::Gui
diff --git a/examples/qtestlib/tutorial3/CMakeLists.txt b/examples/qtestlib/tutorial3/CMakeLists.txt
index e574a0a39a..f915a7f0df 100644
--- a/examples/qtestlib/tutorial3/CMakeLists.txt
+++ b/examples/qtestlib/tutorial3/CMakeLists.txt
@@ -1,32 +1,25 @@
-# Generated from tutorial3.pro.
-
cmake_minimum_required(VERSION 3.16)
project(tutorial3 LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/qtestlib/tutorial3")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
-find_package(Qt6 COMPONENTS Test)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Test Widgets)
qt_add_executable(tutorial3
testgui.cpp
)
+
set_target_properties(tutorial3 PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(tutorial3 PUBLIC
Qt::Core
Qt::Gui
diff --git a/examples/qtestlib/tutorial4/CMakeLists.txt b/examples/qtestlib/tutorial4/CMakeLists.txt
index a72eb7e9d6..9686317405 100644
--- a/examples/qtestlib/tutorial4/CMakeLists.txt
+++ b/examples/qtestlib/tutorial4/CMakeLists.txt
@@ -1,32 +1,25 @@
-# Generated from tutorial4.pro.
-
cmake_minimum_required(VERSION 3.16)
project(tutorial4 LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/qtestlib/tutorial4")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
-find_package(Qt6 COMPONENTS Test)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Test Widgets)
qt_add_executable(tutorial4
testgui.cpp
)
+
set_target_properties(tutorial4 PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(tutorial4 PUBLIC
Qt::Core
Qt::Gui
diff --git a/examples/qtestlib/tutorial5/CMakeLists.txt b/examples/qtestlib/tutorial5/CMakeLists.txt
index aceece5f08..479cdc45d6 100644
--- a/examples/qtestlib/tutorial5/CMakeLists.txt
+++ b/examples/qtestlib/tutorial5/CMakeLists.txt
@@ -1,32 +1,25 @@
-# Generated from tutorial5.pro.
-
cmake_minimum_required(VERSION 3.16)
project(tutorial5 LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/qtestlib/tutorial5")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
-find_package(Qt6 COMPONENTS Test)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Test Widgets)
qt_add_executable(tutorial5
benchmarking.cpp
)
+
set_target_properties(tutorial5 PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(tutorial5 PUBLIC
Qt::Core
Qt::Gui
diff --git a/examples/sql/.prev_CMakeLists.txt b/examples/sql/.prev_CMakeLists.txt
deleted file mode 100644
index 18e9112f11..0000000000
--- a/examples/sql/.prev_CMakeLists.txt
+++ /dev/null
@@ -1,18 +0,0 @@
-# Generated from sql.pro.
-
-if(NOT TARGET Qt::Widgets)
- return()
-endif()
-add_subdirectory(books)
-add_subdirectory(drilldown)
-add_subdirectory(cachedtable)
-add_subdirectory(querymodel)
-add_subdirectory(relationaltablemodel)
-add_subdirectory(sqlwidgetmapper)
-add_subdirectory(tablemodel)
-if(TARGET Qt::Xml)
- add_subdirectory(masterdetail)
-endif()
-if(QT_BUILD_PARTS___contains___tools AND NOT CMAKE_CROSSCOMPILING)
- add_subdirectory(sqlbrowser)
-endif()
diff --git a/examples/sql/CMakeLists.txt b/examples/sql/CMakeLists.txt
index b45fd6f7cc..5179258c2f 100644
--- a/examples/sql/CMakeLists.txt
+++ b/examples/sql/CMakeLists.txt
@@ -1,5 +1,3 @@
-# Generated from sql.pro.
-
if(NOT TARGET Qt::Widgets)
return()
endif()
@@ -14,6 +12,6 @@ if(TARGET Qt::Xml)
qt_internal_add_example(masterdetail)
endif()
-if(NOT CMAKE_CROSSCOMPILING) # special case
+if(NOT CMAKE_CROSSCOMPILING)
qt_internal_add_example(sqlbrowser)
endif()
diff --git a/examples/sql/books/CMakeLists.txt b/examples/sql/books/CMakeLists.txt
index b8bab04702..d46930edb2 100644
--- a/examples/sql/books/CMakeLists.txt
+++ b/examples/sql/books/CMakeLists.txt
@@ -1,24 +1,16 @@
-# Generated from books.pro.
-
cmake_minimum_required(VERSION 3.16)
project(books LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/sql/books")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Sql)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Sql Widgets)
qt_add_executable(books
bookdelegate.cpp bookdelegate.h
@@ -26,13 +18,11 @@ qt_add_executable(books
initdb.h
main.cpp
)
+
set_target_properties(books PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
-target_include_directories(books PUBLIC
- .
-)
target_link_libraries(books PUBLIC
Qt::Core
@@ -41,13 +31,12 @@ target_link_libraries(books PUBLIC
Qt::Widgets
)
-
# Resources:
set(books_resource_files
"images/star.png"
)
-qt6_add_resources(books "books"
+qt_add_resources(books "books"
PREFIX
"/"
FILES
diff --git a/examples/sql/cachedtable/CMakeLists.txt b/examples/sql/cachedtable/CMakeLists.txt
index 106797c405..aadaa9c088 100644
--- a/examples/sql/cachedtable/CMakeLists.txt
+++ b/examples/sql/cachedtable/CMakeLists.txt
@@ -1,34 +1,27 @@
-# Generated from cachedtable.pro.
-
cmake_minimum_required(VERSION 3.16)
project(cachedtable LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/sql/cachedtable")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Sql)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Sql Widgets)
qt_add_executable(cachedtable
../connection.h
main.cpp
tableeditor.cpp tableeditor.h
)
+
set_target_properties(cachedtable PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(cachedtable PUBLIC
Qt::Core
Qt::Gui
diff --git a/examples/sql/drilldown/CMakeLists.txt b/examples/sql/drilldown/CMakeLists.txt
index 32aa912fa8..9b46be55e0 100644
--- a/examples/sql/drilldown/CMakeLists.txt
+++ b/examples/sql/drilldown/CMakeLists.txt
@@ -1,24 +1,15 @@
-# Generated from drilldown.pro.
-
cmake_minimum_required(VERSION 3.16)
project(drilldown LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/sql/drilldown")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Sql)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Sql Widgets)
qt_add_executable(drilldown
../connection.h
@@ -27,10 +18,12 @@ qt_add_executable(drilldown
main.cpp
view.cpp view.h
)
+
set_target_properties(drilldown PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(drilldown PUBLIC
Qt::Core
Qt::Gui
@@ -38,7 +31,6 @@ target_link_libraries(drilldown PUBLIC
Qt::Widgets
)
-
# Resources:
set(drilldown_resource_files
"images/qt-creator.png"
@@ -47,7 +39,7 @@ set(drilldown_resource_files
"images/qt-quick.png"
)
-qt6_add_resources(drilldown "drilldown"
+qt_add_resources(drilldown "drilldown"
PREFIX
"/"
FILES
diff --git a/examples/sql/masterdetail/CMakeLists.txt b/examples/sql/masterdetail/CMakeLists.txt
index 0e26401450..fde9d63917 100644
--- a/examples/sql/masterdetail/CMakeLists.txt
+++ b/examples/sql/masterdetail/CMakeLists.txt
@@ -1,25 +1,15 @@
-# Generated from masterdetail.pro.
-
cmake_minimum_required(VERSION 3.16)
project(masterdetail LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/sql/masterdetail")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Sql)
-find_package(Qt6 COMPONENTS Widgets)
-find_package(Qt6 COMPONENTS Xml)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Sql Widgets Xml)
qt_add_executable(masterdetail
database.h
@@ -27,10 +17,12 @@ qt_add_executable(masterdetail
main.cpp
mainwindow.cpp mainwindow.h
)
+
set_target_properties(masterdetail PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(masterdetail PUBLIC
Qt::Core
Qt::Gui
@@ -39,14 +31,13 @@ target_link_libraries(masterdetail PUBLIC
Qt::Xml
)
-
# Resources:
set(masterdetail_resource_files
"images/icon.png"
"images/image.png"
)
-qt6_add_resources(masterdetail "masterdetail"
+qt_add_resources(masterdetail "masterdetail"
PREFIX
"/"
FILES
diff --git a/examples/sql/querymodel/CMakeLists.txt b/examples/sql/querymodel/CMakeLists.txt
index a062551107..2e0ec418c2 100644
--- a/examples/sql/querymodel/CMakeLists.txt
+++ b/examples/sql/querymodel/CMakeLists.txt
@@ -1,24 +1,15 @@
-# Generated from querymodel.pro.
-
cmake_minimum_required(VERSION 3.16)
project(querymodel LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/sql/querymodel")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Sql)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Sql Widgets)
qt_add_executable(querymodel
../connection.h
@@ -26,10 +17,12 @@ qt_add_executable(querymodel
editablesqlmodel.cpp editablesqlmodel.h
main.cpp
)
+
set_target_properties(querymodel PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(querymodel PUBLIC
Qt::Core
Qt::Gui
diff --git a/examples/sql/relationaltablemodel/CMakeLists.txt b/examples/sql/relationaltablemodel/CMakeLists.txt
index 803f0b3c7b..9eb286abe9 100644
--- a/examples/sql/relationaltablemodel/CMakeLists.txt
+++ b/examples/sql/relationaltablemodel/CMakeLists.txt
@@ -1,33 +1,26 @@
-# Generated from relationaltablemodel.pro.
-
cmake_minimum_required(VERSION 3.16)
project(relationaltablemodel LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/sql/relationaltablemodel")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Sql)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Sql Widgets)
qt_add_executable(relationaltablemodel
../connection.h
relationaltablemodel.cpp
)
+
set_target_properties(relationaltablemodel PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(relationaltablemodel PUBLIC
Qt::Core
Qt::Gui
diff --git a/examples/sql/sqlbrowser/CMakeLists.txt b/examples/sql/sqlbrowser/CMakeLists.txt
index 95e669fdd8..350fe1cd90 100644
--- a/examples/sql/sqlbrowser/CMakeLists.txt
+++ b/examples/sql/sqlbrowser/CMakeLists.txt
@@ -1,24 +1,18 @@
-# Generated from sqlbrowser.pro.
-
cmake_minimum_required(VERSION 3.16)
project(sqlbrowser LANGUAGES CXX)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/sql/sqlbrowser")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Sql)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Sql Widgets)
qt_add_executable(sqlbrowser
browser.cpp browser.h
@@ -27,10 +21,12 @@ qt_add_executable(sqlbrowser
main.cpp
qsqlconnectiondialog.cpp qsqlconnectiondialog.h qsqlconnectiondialog.ui
)
+
set_target_properties(sqlbrowser PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(sqlbrowser PUBLIC
Qt::Core
Qt::Gui
diff --git a/examples/sql/sqlwidgetmapper/CMakeLists.txt b/examples/sql/sqlwidgetmapper/CMakeLists.txt
index 02fe438f8d..5eff5f475b 100644
--- a/examples/sql/sqlwidgetmapper/CMakeLists.txt
+++ b/examples/sql/sqlwidgetmapper/CMakeLists.txt
@@ -1,33 +1,26 @@
-# Generated from sqlwidgetmapper.pro.
-
cmake_minimum_required(VERSION 3.16)
project(sqlwidgetmapper LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/sql/sqlwidgetmapper")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Sql)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Sql Widgets)
qt_add_executable(sqlwidgetmapper
main.cpp
window.cpp window.h
)
+
set_target_properties(sqlwidgetmapper PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(sqlwidgetmapper PUBLIC
Qt::Core
Qt::Gui
diff --git a/examples/sql/tablemodel/CMakeLists.txt b/examples/sql/tablemodel/CMakeLists.txt
index 5bbe92ccb8..c1d63ac6e3 100644
--- a/examples/sql/tablemodel/CMakeLists.txt
+++ b/examples/sql/tablemodel/CMakeLists.txt
@@ -1,33 +1,26 @@
-# Generated from tablemodel.pro.
-
cmake_minimum_required(VERSION 3.16)
project(tablemodel LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/sql/tablemodel")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Sql)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Sql Widgets)
qt_add_executable(tablemodel
../connection.h
tablemodel.cpp
)
+
set_target_properties(tablemodel PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(tablemodel PUBLIC
Qt::Core
Qt::Gui
diff --git a/examples/vulkan/CMakeLists.txt b/examples/vulkan/CMakeLists.txt
index 2320faaeb3..c5694435b6 100644
--- a/examples/vulkan/CMakeLists.txt
+++ b/examples/vulkan/CMakeLists.txt
@@ -1,5 +1,3 @@
-# Generated from vulkan.pro.
-
qt_internal_add_example(hellovulkanwindow)
qt_internal_add_example(hellovulkantriangle)
qt_internal_add_example(hellovulkantexture)
diff --git a/examples/vulkan/hellovulkancubes/CMakeLists.txt b/examples/vulkan/hellovulkancubes/CMakeLists.txt
index 927a6e2387..61c4ec4aee 100644
--- a/examples/vulkan/hellovulkancubes/CMakeLists.txt
+++ b/examples/vulkan/hellovulkancubes/CMakeLists.txt
@@ -1,24 +1,15 @@
-# Generated from hellovulkancubes.pro.
-
cmake_minimum_required(VERSION 3.16)
project(hellovulkancubes LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/vulkan/hellovulkancubes")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
-find_package(Qt6 COMPONENTS Concurrent)
+find_package(Qt6 REQUIRED COMPONENTS Concurrent Core Gui Widgets)
qt_add_executable(hellovulkancubes
camera.cpp camera.h
@@ -29,10 +20,12 @@ qt_add_executable(hellovulkancubes
shader.cpp shader.h
vulkanwindow.cpp vulkanwindow.h
)
+
set_target_properties(hellovulkancubes PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(hellovulkancubes PUBLIC
Qt::Concurrent
Qt::Core
@@ -40,14 +33,15 @@ target_link_libraries(hellovulkancubes PUBLIC
Qt::Widgets
)
-
# Resources:
set_source_files_properties("../shared/block.buf"
PROPERTIES QT_RESOURCE_ALIAS "block.buf"
)
+
set_source_files_properties("../shared/qt_logo.buf"
PROPERTIES QT_RESOURCE_ALIAS "qt_logo.buf"
)
+
set(hellovulkancubes_resource_files
"../shared/block.buf"
"../shared/qt_logo.buf"
diff --git a/examples/vulkan/hellovulkantexture/CMakeLists.txt b/examples/vulkan/hellovulkantexture/CMakeLists.txt
index aec89ccdd3..fb9be834a3 100644
--- a/examples/vulkan/hellovulkantexture/CMakeLists.txt
+++ b/examples/vulkan/hellovulkantexture/CMakeLists.txt
@@ -1,37 +1,31 @@
-# Generated from hellovulkantexture.pro.
-
cmake_minimum_required(VERSION 3.16)
project(hellovulkantexture LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/vulkan/hellovulkantexture")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui)
qt_add_executable(hellovulkantexture
hellovulkantexture.cpp hellovulkantexture.h
main.cpp
)
+
set_target_properties(hellovulkantexture PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(hellovulkantexture PUBLIC
Qt::Core
Qt::Gui
)
-
# Resources:
set(hellovulkantexture_resource_files
"qt256.png"
@@ -39,7 +33,7 @@ set(hellovulkantexture_resource_files
"texture_vert.spv"
)
-qt6_add_resources(hellovulkantexture "hellovulkantexture"
+qt_add_resources(hellovulkantexture "hellovulkantexture"
PREFIX
"/"
FILES
diff --git a/examples/vulkan/hellovulkantriangle/CMakeLists.txt b/examples/vulkan/hellovulkantriangle/CMakeLists.txt
index a8290243cf..79979c416c 100644
--- a/examples/vulkan/hellovulkantriangle/CMakeLists.txt
+++ b/examples/vulkan/hellovulkantriangle/CMakeLists.txt
@@ -1,50 +1,46 @@
-# Generated from hellovulkantriangle.pro.
-
cmake_minimum_required(VERSION 3.16)
project(hellovulkantriangle LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/vulkan/hellovulkantriangle")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui)
qt_add_executable(hellovulkantriangle
../shared/trianglerenderer.cpp ../shared/trianglerenderer.h
main.cpp
)
+
set_target_properties(hellovulkantriangle PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(hellovulkantriangle PUBLIC
Qt::Core
Qt::Gui
)
-
# Resources:
set_source_files_properties("../shared/color_frag.spv"
PROPERTIES QT_RESOURCE_ALIAS "color_frag.spv"
)
+
set_source_files_properties("../shared/color_vert.spv"
PROPERTIES QT_RESOURCE_ALIAS "color_vert.spv"
)
+
set(hellovulkantriangle_resource_files
"../shared/color_frag.spv"
"../shared/color_vert.spv"
)
-qt6_add_resources(hellovulkantriangle "hellovulkantriangle"
+qt_add_resources(hellovulkantriangle "hellovulkantriangle"
PREFIX
"/"
FILES
diff --git a/examples/vulkan/hellovulkanwidget/CMakeLists.txt b/examples/vulkan/hellovulkanwidget/CMakeLists.txt
index 0c23f8064d..7f4f53708e 100644
--- a/examples/vulkan/hellovulkanwidget/CMakeLists.txt
+++ b/examples/vulkan/hellovulkanwidget/CMakeLists.txt
@@ -1,53 +1,48 @@
-# Generated from hellovulkanwidget.pro.
-
cmake_minimum_required(VERSION 3.16)
project(hellovulkanwidget LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/vulkan/hellovulkanwidget")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
qt_add_executable(hellovulkanwidget
../shared/trianglerenderer.cpp ../shared/trianglerenderer.h
hellovulkanwidget.cpp hellovulkanwidget.h
main.cpp
)
+
set_target_properties(hellovulkanwidget PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(hellovulkanwidget PUBLIC
Qt::Core
Qt::Gui
Qt::Widgets
)
-
# Resources:
set_source_files_properties("../shared/color_frag.spv"
PROPERTIES QT_RESOURCE_ALIAS "color_frag.spv"
)
+
set_source_files_properties("../shared/color_vert.spv"
PROPERTIES QT_RESOURCE_ALIAS "color_vert.spv"
)
+
set(hellovulkanwidget_resource_files
"../shared/color_frag.spv"
"../shared/color_vert.spv"
)
-qt6_add_resources(hellovulkanwidget "hellovulkanwidget"
+qt_add_resources(hellovulkanwidget "hellovulkanwidget"
PREFIX
"/"
FILES
diff --git a/examples/vulkan/hellovulkanwindow/CMakeLists.txt b/examples/vulkan/hellovulkanwindow/CMakeLists.txt
index df2166a0be..7323bab06c 100644
--- a/examples/vulkan/hellovulkanwindow/CMakeLists.txt
+++ b/examples/vulkan/hellovulkanwindow/CMakeLists.txt
@@ -1,31 +1,26 @@
-# Generated from hellovulkanwindow.pro.
-
cmake_minimum_required(VERSION 3.16)
project(hellovulkanwindow LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/vulkan/hellovulkanwindow")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui)
qt_add_executable(hellovulkanwindow
hellovulkanwindow.cpp hellovulkanwindow.h
main.cpp
)
+
set_target_properties(hellovulkanwindow PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(hellovulkanwindow PUBLIC
Qt::Core
Qt::Gui
diff --git a/examples/widgets/.prev_CMakeLists.txt b/examples/widgets/.prev_CMakeLists.txt
deleted file mode 100644
index cffc0a6293..0000000000
--- a/examples/widgets/.prev_CMakeLists.txt
+++ /dev/null
@@ -1,32 +0,0 @@
-# Generated from widgets.pro.
-
-if(NOT TARGET Qt::Widgets)
- return()
-endif()
-if(QT_FEATURE_animation)
- add_subdirectory(animation)
-endif()
-add_subdirectory(desktop)
-add_subdirectory(dialogs)
-add_subdirectory(effects)
-add_subdirectory(gallery)
-add_subdirectory(gestures)
-add_subdirectory(graphicsview)
-add_subdirectory(itemviews)
-add_subdirectory(layouts)
-add_subdirectory(painting)
-add_subdirectory(richtext)
-add_subdirectory(scroller)
-add_subdirectory(tools)
-add_subdirectory(touch)
-add_subdirectory(tutorials)
-add_subdirectory(widgets)
-if(QT_FEATURE_draganddrop)
- add_subdirectory(draganddrop)
-endif()
-if(QT_FEATURE_cursor)
- add_subdirectory(mainwindows)
-endif()
-if(QT_FEATURE_opengl AND TARGET Qt::Gui)
- add_subdirectory(windowcontainer)
-endif()
diff --git a/examples/widgets/CMakeLists.txt b/examples/widgets/CMakeLists.txt
index 753e3b8499..13f8066ed8 100644
--- a/examples/widgets/CMakeLists.txt
+++ b/examples/widgets/CMakeLists.txt
@@ -1,5 +1,3 @@
-# Generated from widgets.pro.
-
if(NOT TARGET Qt::Widgets)
return()
endif()
@@ -24,7 +22,7 @@ add_subdirectory(widgets)
if(QT_FEATURE_draganddrop)
add_subdirectory(draganddrop)
endif()
-if(QT_FEATURE_cursor) # special case
+if(QT_FEATURE_cursor)
add_subdirectory(mainwindows)
endif()
if(QT_FEATURE_opengl AND TARGET Qt::Gui)
diff --git a/examples/widgets/animation/CMakeLists.txt b/examples/widgets/animation/CMakeLists.txt
index 70f484a778..d9a18bb866 100644
--- a/examples/widgets/animation/CMakeLists.txt
+++ b/examples/widgets/animation/CMakeLists.txt
@@ -1,3 +1 @@
-# Generated from animation.pro.
-
qt_internal_add_example(easing)
diff --git a/examples/widgets/animation/easing/CMakeLists.txt b/examples/widgets/animation/easing/CMakeLists.txt
index 4a577c5c0c..cb3d733de4 100644
--- a/examples/widgets/animation/easing/CMakeLists.txt
+++ b/examples/widgets/animation/easing/CMakeLists.txt
@@ -1,23 +1,16 @@
-# Generated from easing.pro.
-
cmake_minimum_required(VERSION 3.16)
project(easing LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/animation/easing")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
qt_add_executable(easing
animation.h
@@ -25,23 +18,24 @@ qt_add_executable(easing
main.cpp
window.cpp window.h
)
+
set_target_properties(easing PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(easing PUBLIC
Qt::Core
Qt::Gui
Qt::Widgets
)
-
# Resources:
set(easing_resource_files
"images/qt-logo.png"
)
-qt6_add_resources(easing "easing"
+qt_add_resources(easing "easing"
PREFIX
"/"
FILES
diff --git a/examples/widgets/desktop/CMakeLists.txt b/examples/widgets/desktop/CMakeLists.txt
index b317205c43..169fa9ffac 100644
--- a/examples/widgets/desktop/CMakeLists.txt
+++ b/examples/widgets/desktop/CMakeLists.txt
@@ -1,4 +1,2 @@
-# Generated from desktop.pro.
-
qt_internal_add_example(screenshot)
qt_internal_add_example(systray)
diff --git a/examples/widgets/desktop/screenshot/CMakeLists.txt b/examples/widgets/desktop/screenshot/CMakeLists.txt
index bbc525c719..bb392e049d 100644
--- a/examples/widgets/desktop/screenshot/CMakeLists.txt
+++ b/examples/widgets/desktop/screenshot/CMakeLists.txt
@@ -1,32 +1,26 @@
-# Generated from screenshot.pro.
-
cmake_minimum_required(VERSION 3.16)
project(screenshot LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/desktop/screenshot")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
qt_add_executable(screenshot
main.cpp
screenshot.cpp screenshot.h
)
+
set_target_properties(screenshot PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(screenshot PUBLIC
Qt::Core
Qt::Gui
diff --git a/examples/widgets/desktop/systray/CMakeLists.txt b/examples/widgets/desktop/systray/CMakeLists.txt
index f52a523ad4..64841e4066 100644
--- a/examples/widgets/desktop/systray/CMakeLists.txt
+++ b/examples/widgets/desktop/systray/CMakeLists.txt
@@ -1,39 +1,32 @@
-# Generated from systray.pro.
-
cmake_minimum_required(VERSION 3.16)
project(systray LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/desktop/systray")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
qt_add_executable(systray
main.cpp
window.cpp window.h
)
+
set_target_properties(systray PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(systray PUBLIC
Qt::Core
Qt::Gui
Qt::Widgets
)
-
# Resources:
set(systray_resource_files
"images/bad.png"
@@ -41,7 +34,7 @@ set(systray_resource_files
"images/trash.png"
)
-qt6_add_resources(systray "systray"
+qt_add_resources(systray "systray"
PREFIX
"/"
FILES
diff --git a/examples/widgets/desktop/systray/doc/src/systray.qdoc b/examples/widgets/desktop/systray/doc/src/systray.qdoc
index ae7e925bd8..3a2c1bfa6b 100644
--- a/examples/widgets/desktop/systray/doc/src/systray.qdoc
+++ b/examples/widgets/desktop/systray/doc/src/systray.qdoc
@@ -173,11 +173,11 @@
We have reimplemented the QWidget::closeEvent() event handler to
receive widget close events, showing the above message to the
- users when they are closing the editor window. On \macos we need to
+ users when they are closing the editor window. We need to
avoid showing the message and accepting the close event when the
- user really intends to quit the application, that is, when the
- user has triggered "Quit" in the menu bar or pressed the Command+Q
- shortcut.
+ user really intends to quit the application: that is, when the
+ user has triggered "Quit" in the menu bar, or in the tray icon's
+ context menu, or pressed Command+Q shortcut on \macOS.
In addition to the functions and slots discussed above, we have
also implemented several convenience functions to simplify the
diff --git a/examples/widgets/desktop/systray/window.cpp b/examples/widgets/desktop/systray/window.cpp
index e62b5fc0d0..f14a4e578f 100644
--- a/examples/widgets/desktop/systray/window.cpp
+++ b/examples/widgets/desktop/systray/window.cpp
@@ -111,11 +111,8 @@ void Window::setVisible(bool visible)
//! [2]
void Window::closeEvent(QCloseEvent *event)
{
-#ifdef Q_OS_MACOS
- if (!event->spontaneous() || !isVisible()) {
+ if (!event->spontaneous() || !isVisible())
return;
- }
-#endif
if (trayIcon->isVisible()) {
QMessageBox::information(this, tr("Systray"),
tr("The program will keep running in the "
diff --git a/examples/widgets/dialogs/.prev_CMakeLists.txt b/examples/widgets/dialogs/.prev_CMakeLists.txt
deleted file mode 100644
index 354424bf1f..0000000000
--- a/examples/widgets/dialogs/.prev_CMakeLists.txt
+++ /dev/null
@@ -1,13 +0,0 @@
-# Generated from dialogs.pro.
-
-if(QT_FEATURE_wizard)
- add_subdirectory(classwizard)
- add_subdirectory(trivialwizard)
-endif()
-add_subdirectory(extension)
-add_subdirectory(findfiles)
-add_subdirectory(standarddialogs)
-add_subdirectory(tabdialog)
-if(QT_FEATURE_wizard AND TARGET Qt::PrintSupport)
- add_subdirectory(licensewizard)
-endif()
diff --git a/examples/widgets/dialogs/CMakeLists.txt b/examples/widgets/dialogs/CMakeLists.txt
index 32f8bc29a8..90361e2e28 100644
--- a/examples/widgets/dialogs/CMakeLists.txt
+++ b/examples/widgets/dialogs/CMakeLists.txt
@@ -1,5 +1,3 @@
-# Generated from dialogs.pro.
-
if(QT_FEATURE_wizard)
qt_internal_add_example(classwizard)
qt_internal_add_example(trivialwizard)
diff --git a/examples/widgets/dialogs/classwizard/CMakeLists.txt b/examples/widgets/dialogs/classwizard/CMakeLists.txt
index b45c5bbc15..5061f23d93 100644
--- a/examples/widgets/dialogs/classwizard/CMakeLists.txt
+++ b/examples/widgets/dialogs/classwizard/CMakeLists.txt
@@ -1,39 +1,32 @@
-# Generated from classwizard.pro.
-
cmake_minimum_required(VERSION 3.16)
project(classwizard LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/dialogs/classwizard")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
qt_add_executable(classwizard
classwizard.cpp classwizard.h
main.cpp
)
+
set_target_properties(classwizard PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(classwizard PUBLIC
Qt::Core
Qt::Gui
Qt::Widgets
)
-
# Resources:
set(classwizard_resource_files
"images/background.png"
@@ -45,7 +38,7 @@ set(classwizard_resource_files
"images/watermark2.png"
)
-qt6_add_resources(classwizard "classwizard"
+qt_add_resources(classwizard "classwizard"
PREFIX
"/"
FILES
diff --git a/examples/widgets/dialogs/extension/CMakeLists.txt b/examples/widgets/dialogs/extension/CMakeLists.txt
index be555e6a10..283cbd1364 100644
--- a/examples/widgets/dialogs/extension/CMakeLists.txt
+++ b/examples/widgets/dialogs/extension/CMakeLists.txt
@@ -1,32 +1,26 @@
-# Generated from extension.pro.
-
cmake_minimum_required(VERSION 3.16)
project(extension LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/dialogs/extension")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
qt_add_executable(extension
finddialog.cpp finddialog.h
main.cpp
)
+
set_target_properties(extension PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(extension PUBLIC
Qt::Core
Qt::Gui
diff --git a/examples/widgets/dialogs/findfiles/CMakeLists.txt b/examples/widgets/dialogs/findfiles/CMakeLists.txt
index cf183d29e2..cdd0a6964a 100644
--- a/examples/widgets/dialogs/findfiles/CMakeLists.txt
+++ b/examples/widgets/dialogs/findfiles/CMakeLists.txt
@@ -1,32 +1,26 @@
-# Generated from findfiles.pro.
-
cmake_minimum_required(VERSION 3.16)
project(findfiles LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/dialogs/findfiles")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
qt_add_executable(findfiles
main.cpp
window.cpp window.h
)
+
set_target_properties(findfiles PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(findfiles PUBLIC
Qt::Core
Qt::Gui
diff --git a/examples/widgets/dialogs/licensewizard/CMakeLists.txt b/examples/widgets/dialogs/licensewizard/CMakeLists.txt
index 7fc7ac65fa..497cfff064 100644
--- a/examples/widgets/dialogs/licensewizard/CMakeLists.txt
+++ b/examples/widgets/dialogs/licensewizard/CMakeLists.txt
@@ -1,33 +1,26 @@
-# Generated from licensewizard.pro.
-
cmake_minimum_required(VERSION 3.16)
project(licensewizard LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/dialogs/licensewizard")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
-find_package(Qt6 COMPONENTS PrintSupport)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui PrintSupport Widgets)
qt_add_executable(licensewizard
licensewizard.cpp licensewizard.h
main.cpp
)
+
set_target_properties(licensewizard PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(licensewizard PUBLIC
Qt::Core
Qt::Gui
@@ -35,14 +28,13 @@ target_link_libraries(licensewizard PUBLIC
Qt::Widgets
)
-
# Resources:
set(licensewizard_resource_files
"images/logo.png"
"images/watermark.png"
)
-qt6_add_resources(licensewizard "licensewizard"
+qt_add_resources(licensewizard "licensewizard"
PREFIX
"/"
FILES
diff --git a/examples/widgets/dialogs/standarddialogs/CMakeLists.txt b/examples/widgets/dialogs/standarddialogs/CMakeLists.txt
index 9cb52e22dd..b64c304262 100644
--- a/examples/widgets/dialogs/standarddialogs/CMakeLists.txt
+++ b/examples/widgets/dialogs/standarddialogs/CMakeLists.txt
@@ -1,32 +1,26 @@
-# Generated from standarddialogs.pro.
-
cmake_minimum_required(VERSION 3.16)
project(standarddialogs LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/dialogs/standarddialogs")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
qt_add_executable(standarddialogs
dialog.cpp dialog.h
main.cpp
)
+
set_target_properties(standarddialogs PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(standarddialogs PUBLIC
Qt::Core
Qt::Gui
diff --git a/examples/widgets/dialogs/tabdialog/CMakeLists.txt b/examples/widgets/dialogs/tabdialog/CMakeLists.txt
index b61a8ef89c..f03cdaacdb 100644
--- a/examples/widgets/dialogs/tabdialog/CMakeLists.txt
+++ b/examples/widgets/dialogs/tabdialog/CMakeLists.txt
@@ -1,32 +1,26 @@
-# Generated from tabdialog.pro.
-
cmake_minimum_required(VERSION 3.16)
project(tabdialog LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/dialogs/tabdialog")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
qt_add_executable(tabdialog
main.cpp
tabdialog.cpp tabdialog.h
)
+
set_target_properties(tabdialog PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(tabdialog PUBLIC
Qt::Core
Qt::Gui
diff --git a/examples/widgets/dialogs/trivialwizard/CMakeLists.txt b/examples/widgets/dialogs/trivialwizard/CMakeLists.txt
index d57cbd59c3..d3c1adf2aa 100644
--- a/examples/widgets/dialogs/trivialwizard/CMakeLists.txt
+++ b/examples/widgets/dialogs/trivialwizard/CMakeLists.txt
@@ -1,31 +1,25 @@
-# Generated from trivialwizard.pro.
-
cmake_minimum_required(VERSION 3.16)
project(trivialwizard LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/dialogs/trivialwizard")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
qt_add_executable(trivialwizard
trivialwizard.cpp
)
+
set_target_properties(trivialwizard PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(trivialwizard PUBLIC
Qt::Core
Qt::Gui
diff --git a/examples/widgets/draganddrop/CMakeLists.txt b/examples/widgets/draganddrop/CMakeLists.txt
index 87ba702aca..c7d8d068d6 100644
--- a/examples/widgets/draganddrop/CMakeLists.txt
+++ b/examples/widgets/draganddrop/CMakeLists.txt
@@ -1,5 +1,3 @@
-# Generated from draganddrop.pro.
-
qt_internal_add_example(draggableicons)
qt_internal_add_example(draggabletext)
qt_internal_add_example(dropsite)
diff --git a/examples/widgets/draganddrop/draggableicons/CMakeLists.txt b/examples/widgets/draganddrop/draggableicons/CMakeLists.txt
index 8c64fc9335..ed20dbf14b 100644
--- a/examples/widgets/draganddrop/draggableicons/CMakeLists.txt
+++ b/examples/widgets/draganddrop/draggableicons/CMakeLists.txt
@@ -1,39 +1,32 @@
-# Generated from draggableicons.pro.
-
cmake_minimum_required(VERSION 3.16)
project(draggableicons LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/draganddrop/draggableicons")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
qt_add_executable(draggableicons
dragwidget.cpp dragwidget.h
main.cpp
)
+
set_target_properties(draggableicons PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(draggableicons PUBLIC
Qt::Core
Qt::Gui
Qt::Widgets
)
-
# Resources:
set(draggableicons_resource_files
"images/boat.png"
@@ -41,7 +34,7 @@ set(draggableicons_resource_files
"images/house.png"
)
-qt6_add_resources(draggableicons "draggableicons"
+qt_add_resources(draggableicons "draggableicons"
PREFIX
"/"
FILES
diff --git a/examples/widgets/draganddrop/draggabletext/CMakeLists.txt b/examples/widgets/draganddrop/draggabletext/CMakeLists.txt
index c4fced0f89..71b7f59ab7 100644
--- a/examples/widgets/draganddrop/draggabletext/CMakeLists.txt
+++ b/examples/widgets/draganddrop/draggabletext/CMakeLists.txt
@@ -1,45 +1,38 @@
-# Generated from draggabletext.pro.
-
cmake_minimum_required(VERSION 3.16)
project(draggabletext LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/draganddrop/draggabletext")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
qt_add_executable(draggabletext
dragwidget.cpp dragwidget.h
main.cpp
)
+
set_target_properties(draggabletext PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(draggabletext PUBLIC
Qt::Core
Qt::Gui
Qt::Widgets
)
-
# Resources:
set(draggabletext_resource_files
"words.txt"
)
-qt6_add_resources(draggabletext "draggabletext"
+qt_add_resources(draggabletext "draggabletext"
PREFIX
"/dictionary"
FILES
diff --git a/examples/widgets/draganddrop/dropsite/CMakeLists.txt b/examples/widgets/draganddrop/dropsite/CMakeLists.txt
index ee29b665a5..86ce3b71af 100644
--- a/examples/widgets/draganddrop/dropsite/CMakeLists.txt
+++ b/examples/widgets/draganddrop/dropsite/CMakeLists.txt
@@ -1,33 +1,27 @@
-# Generated from dropsite.pro.
-
cmake_minimum_required(VERSION 3.16)
project(dropsite LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/draganddrop/dropsite")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
qt_add_executable(dropsite
droparea.cpp droparea.h
dropsitewindow.cpp dropsitewindow.h
main.cpp
)
+
set_target_properties(dropsite PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(dropsite PUBLIC
Qt::Core
Qt::Gui
diff --git a/examples/widgets/draganddrop/fridgemagnets/CMakeLists.txt b/examples/widgets/draganddrop/fridgemagnets/CMakeLists.txt
index 0292d661ac..4b956a7cee 100644
--- a/examples/widgets/draganddrop/fridgemagnets/CMakeLists.txt
+++ b/examples/widgets/draganddrop/fridgemagnets/CMakeLists.txt
@@ -1,46 +1,39 @@
-# Generated from fridgemagnets.pro.
-
cmake_minimum_required(VERSION 3.16)
project(fridgemagnets LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/draganddrop/fridgemagnets")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
qt_add_executable(fridgemagnets
draglabel.cpp draglabel.h
dragwidget.cpp dragwidget.h
main.cpp
)
+
set_target_properties(fridgemagnets PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(fridgemagnets PUBLIC
Qt::Core
Qt::Gui
Qt::Widgets
)
-
# Resources:
set(fridgemagnets_resource_files
"words.txt"
)
-qt6_add_resources(fridgemagnets "fridgemagnets"
+qt_add_resources(fridgemagnets "fridgemagnets"
PREFIX
"/dictionary"
FILES
diff --git a/examples/widgets/draganddrop/puzzle/.prev_CMakeLists.txt b/examples/widgets/draganddrop/puzzle/.prev_CMakeLists.txt
deleted file mode 100644
index bcc7708662..0000000000
--- a/examples/widgets/draganddrop/puzzle/.prev_CMakeLists.txt
+++ /dev/null
@@ -1,55 +0,0 @@
-# Generated from puzzle.pro.
-
-cmake_minimum_required(VERSION 3.14)
-project(puzzle LANGUAGES CXX)
-
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
-set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
-
-if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
-endif()
-
-set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/draganddrop/puzzle")
-
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
-
-qt_add_executable(puzzle
- main.cpp
- mainwindow.cpp mainwindow.h
- pieceslist.cpp pieceslist.h
- puzzlewidget.cpp puzzlewidget.h
-)
-set_target_properties(puzzle PROPERTIES
- WIN32_EXECUTABLE TRUE
- MACOSX_BUNDLE TRUE
-)
-target_link_libraries(puzzle PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
-)
-
-
-# Resources:
-set(puzzle_resource_files
- "example.jpg"
-)
-
-qt6_add_resources(puzzle "puzzle"
- PREFIX
- "/images"
- FILES
- ${puzzle_resource_files}
-)
-
-install(TARGETS puzzle
- RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
-)
diff --git a/examples/widgets/draganddrop/puzzle/CMakeLists.txt b/examples/widgets/draganddrop/puzzle/CMakeLists.txt
index 27ce443ffa..1aa33ae0c0 100644
--- a/examples/widgets/draganddrop/puzzle/CMakeLists.txt
+++ b/examples/widgets/draganddrop/puzzle/CMakeLists.txt
@@ -1,54 +1,47 @@
-# Generated from puzzle.pro.
-
cmake_minimum_required(VERSION 3.16)
project(puzzle LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
-set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/draganddrop_puzzle") # special case
+set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/draganddrop_puzzle")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
-qt_add_executable(draganddrop_puzzle # special case: renamed puzzle
+qt_add_executable(draganddrop_puzzle
main.cpp
mainwindow.cpp mainwindow.h
pieceslist.cpp pieceslist.h
puzzlewidget.cpp puzzlewidget.h
)
-set_target_properties(draganddrop_puzzle PROPERTIES # special case
+
+set_target_properties(draganddrop_puzzle PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
-target_link_libraries(draganddrop_puzzle PUBLIC # special case
+
+target_link_libraries(draganddrop_puzzle PUBLIC
Qt::Core
Qt::Gui
Qt::Widgets
)
-
# Resources:
set(puzzle_resource_files
"example.jpg"
)
-qt6_add_resources(draganddrop_puzzle "puzzle" # special case
+qt_add_resources(draganddrop_puzzle "puzzle"
PREFIX
"/images"
FILES
${puzzle_resource_files}
)
-install(TARGETS draganddrop_puzzle # special case: renamed puzzle
+install(TARGETS draganddrop_puzzle
RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
diff --git a/examples/widgets/draganddrop/puzzle/puzzlewidget.cpp b/examples/widgets/draganddrop/puzzle/puzzlewidget.cpp
index 06dda9c29f..361c7e937b 100644
--- a/examples/widgets/draganddrop/puzzle/puzzlewidget.cpp
+++ b/examples/widgets/draganddrop/puzzle/puzzlewidget.cpp
@@ -199,8 +199,8 @@ void PuzzleWidget::paintEvent(QPaintEvent *event)
const QRect PuzzleWidget::targetSquare(const QPoint &position) const
{
- return QRect(position / pieceSize() * pieceSize(),
- QSize(pieceSize(), pieceSize()));
+ QPoint topLeft = QPoint(position.x() / pieceSize(), position.y() / pieceSize()) * pieceSize();
+ return QRect(topLeft, QSize(pieceSize(), pieceSize()));
}
int PuzzleWidget::pieceSize() const
diff --git a/examples/widgets/effects/CMakeLists.txt b/examples/widgets/effects/CMakeLists.txt
index 1f62945f76..8b1471d1c2 100644
--- a/examples/widgets/effects/CMakeLists.txt
+++ b/examples/widgets/effects/CMakeLists.txt
@@ -1,4 +1,2 @@
-# Generated from effects.pro.
-
qt_internal_add_example(blurpicker)
qt_internal_add_example(fademessage)
diff --git a/examples/widgets/effects/blurpicker/CMakeLists.txt b/examples/widgets/effects/blurpicker/CMakeLists.txt
index b0e3a08016..52a87c77fa 100644
--- a/examples/widgets/effects/blurpicker/CMakeLists.txt
+++ b/examples/widgets/effects/blurpicker/CMakeLists.txt
@@ -1,40 +1,33 @@
-# Generated from blurpicker.pro.
-
cmake_minimum_required(VERSION 3.16)
project(blurpicker LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/effects/blurpicker")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
qt_add_executable(blurpicker
blureffect.cpp blureffect.h
blurpicker.cpp blurpicker.h
main.cpp
)
+
set_target_properties(blurpicker PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(blurpicker PUBLIC
Qt::Core
Qt::Gui
Qt::Widgets
)
-
# Resources:
set(blurpicker_resource_files
"images/accessories-calculator.png"
@@ -48,7 +41,7 @@ set(blurpicker_resource_files
"images/system-users.png"
)
-qt6_add_resources(blurpicker "blurpicker"
+qt_add_resources(blurpicker "blurpicker"
PREFIX
"/"
FILES
diff --git a/examples/widgets/effects/fademessage/CMakeLists.txt b/examples/widgets/effects/fademessage/CMakeLists.txt
index 96e8f08df4..5623c11936 100644
--- a/examples/widgets/effects/fademessage/CMakeLists.txt
+++ b/examples/widgets/effects/fademessage/CMakeLists.txt
@@ -1,45 +1,38 @@
-# Generated from fademessage.pro.
-
cmake_minimum_required(VERSION 3.16)
project(fademessage LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/effects/fademessage")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
qt_add_executable(fademessage
fademessage.cpp fademessage.h
main.cpp
)
+
set_target_properties(fademessage PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(fademessage PUBLIC
Qt::Core
Qt::Gui
Qt::Widgets
)
-
# Resources:
set(fademessage_resource_files
"background.jpg"
)
-qt6_add_resources(fademessage "fademessage"
+qt_add_resources(fademessage "fademessage"
PREFIX
"/"
FILES
diff --git a/examples/widgets/gallery/CMakeLists.txt b/examples/widgets/gallery/CMakeLists.txt
index dacc09fcb1..2994dee4cf 100644
--- a/examples/widgets/gallery/CMakeLists.txt
+++ b/examples/widgets/gallery/CMakeLists.txt
@@ -1,32 +1,26 @@
-# Generated from gallery.pro.
-
cmake_minimum_required(VERSION 3.16)
project(gallery LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/gallery")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
qt_add_executable(gallery
main.cpp
widgetgallery.cpp widgetgallery.h
)
+
set_target_properties(gallery PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(gallery PUBLIC
Qt::Core
Qt::Gui
diff --git a/examples/widgets/gestures/CMakeLists.txt b/examples/widgets/gestures/CMakeLists.txt
index 34fb6d0202..ccd2654936 100644
--- a/examples/widgets/gestures/CMakeLists.txt
+++ b/examples/widgets/gestures/CMakeLists.txt
@@ -1,5 +1,3 @@
-# Generated from gestures.pro.
-
if(NOT TARGET Qt::Widgets)
return()
endif()
diff --git a/examples/widgets/gestures/imagegestures/CMakeLists.txt b/examples/widgets/gestures/imagegestures/CMakeLists.txt
index 17b7a61103..7fc151838e 100644
--- a/examples/widgets/gestures/imagegestures/CMakeLists.txt
+++ b/examples/widgets/gestures/imagegestures/CMakeLists.txt
@@ -1,33 +1,27 @@
-# Generated from imagegestures.pro.
-
cmake_minimum_required(VERSION 3.16)
project(imagegestures LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/gestures/imagegestures")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
qt_add_executable(imagegestures
imagewidget.cpp imagewidget.h
main.cpp
mainwidget.cpp mainwidget.h
)
+
set_target_properties(imagegestures PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(imagegestures PUBLIC
Qt::Core
Qt::Gui
diff --git a/examples/widgets/graphicsview/CMakeLists.txt b/examples/widgets/graphicsview/CMakeLists.txt
index 961807eb55..86936a8321 100644
--- a/examples/widgets/graphicsview/CMakeLists.txt
+++ b/examples/widgets/graphicsview/CMakeLists.txt
@@ -1,5 +1,3 @@
-# Generated from graphicsview.pro.
-
qt_internal_add_example(chip)
qt_internal_add_example(elasticnodes)
qt_internal_add_example(embeddeddialogs)
diff --git a/examples/widgets/graphicsview/anchorlayout/CMakeLists.txt b/examples/widgets/graphicsview/anchorlayout/CMakeLists.txt
index 9b6db3a2f0..26deabe7b3 100644
--- a/examples/widgets/graphicsview/anchorlayout/CMakeLists.txt
+++ b/examples/widgets/graphicsview/anchorlayout/CMakeLists.txt
@@ -1,31 +1,25 @@
-# Generated from anchorlayout.pro.
-
cmake_minimum_required(VERSION 3.16)
project(anchorlayout LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/graphicsview/anchorlayout")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
qt_add_executable(anchorlayout
main.cpp
)
+
set_target_properties(anchorlayout PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(anchorlayout PUBLIC
Qt::Core
Qt::Gui
diff --git a/examples/widgets/graphicsview/basicgraphicslayouts/CMakeLists.txt b/examples/widgets/graphicsview/basicgraphicslayouts/CMakeLists.txt
index f98e5c78b3..16bf5d02b2 100644
--- a/examples/widgets/graphicsview/basicgraphicslayouts/CMakeLists.txt
+++ b/examples/widgets/graphicsview/basicgraphicslayouts/CMakeLists.txt
@@ -1,46 +1,39 @@
-# Generated from basicgraphicslayouts.pro.
-
cmake_minimum_required(VERSION 3.16)
project(basicgraphicslayouts LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/graphicsview/basicgraphicslayouts")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
qt_add_executable(basicgraphicslayouts
layoutitem.cpp layoutitem.h
main.cpp
window.cpp window.h
)
+
set_target_properties(basicgraphicslayouts PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(basicgraphicslayouts PUBLIC
Qt::Core
Qt::Gui
Qt::Widgets
)
-
# Resources:
set(basicgraphicslayouts_resource_files
"images/block.png"
)
-qt6_add_resources(basicgraphicslayouts "basicgraphicslayouts"
+qt_add_resources(basicgraphicslayouts "basicgraphicslayouts"
PREFIX
"/"
FILES
diff --git a/examples/widgets/graphicsview/chip/.prev_CMakeLists.txt b/examples/widgets/graphicsview/chip/.prev_CMakeLists.txt
deleted file mode 100644
index 1140aeb969..0000000000
--- a/examples/widgets/graphicsview/chip/.prev_CMakeLists.txt
+++ /dev/null
@@ -1,66 +0,0 @@
-# Generated from chip.pro.
-
-cmake_minimum_required(VERSION 3.14)
-project(chip LANGUAGES CXX)
-
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
-set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
-
-if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
-endif()
-
-set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/graphicsview/chip")
-
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
-
-qt_add_executable(chip
- chip.cpp chip.h
- main.cpp
- mainwindow.cpp mainwindow.h
- view.cpp view.h
-)
-set_target_properties(chip PROPERTIES
- WIN32_EXECUTABLE TRUE
- MACOSX_BUNDLE TRUE
-)
-target_link_libraries(chip PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
-)
-
-
-# Resources:
-set(images_resource_files
- "fileprint.png"
- "qt4logo.png"
- "rotateleft.png"
- "rotateright.png"
- "zoomin.png"
- "zoomout.png"
-)
-
-qt6_add_resources(chip "images"
- PREFIX
- "/"
- FILES
- ${images_resource_files}
-)
-
-if(TARGET Qt::PrintSupport)
- target_link_libraries(chip PUBLIC
- Qt::PrintSupport
- )
-endif()
-
-install(TARGETS chip
- RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
-)
diff --git a/examples/widgets/graphicsview/chip/CMakeLists.txt b/examples/widgets/graphicsview/chip/CMakeLists.txt
index 6b8160e2a8..5897a8c6d0 100644
--- a/examples/widgets/graphicsview/chip/CMakeLists.txt
+++ b/examples/widgets/graphicsview/chip/CMakeLists.txt
@@ -1,25 +1,18 @@
-# Generated from chip.pro.
-
cmake_minimum_required(VERSION 3.16)
project(chip LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/graphicsview/chip")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
-find_package(Qt6 COMPONENTS OpenGL) # special case
-find_package(Qt6 COMPONENTS PrintSupport) # special case
+find_package(Qt6
+ REQUIRED COMPONENTS Core Gui OpenGL Widgets
+ OPTIONAL_COMPONENTS PrintSupport
+)
qt_add_executable(chip
chip.cpp chip.h
@@ -27,17 +20,18 @@ qt_add_executable(chip
mainwindow.cpp mainwindow.h
view.cpp view.h
)
+
set_target_properties(chip PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(chip PUBLIC
Qt::Core
Qt::Gui
Qt::Widgets
)
-
# Resources:
set(images_resource_files
"fileprint.png"
@@ -48,7 +42,7 @@ set(images_resource_files
"zoomout.png"
)
-qt6_add_resources(chip "images"
+qt_add_resources(chip "images"
PREFIX
"/"
FILES
diff --git a/examples/widgets/graphicsview/collidingmice/CMakeLists.txt b/examples/widgets/graphicsview/collidingmice/CMakeLists.txt
index 143c45a7d6..6804880bfa 100644
--- a/examples/widgets/graphicsview/collidingmice/CMakeLists.txt
+++ b/examples/widgets/graphicsview/collidingmice/CMakeLists.txt
@@ -1,45 +1,38 @@
-# Generated from collidingmice.pro.
-
cmake_minimum_required(VERSION 3.16)
project(collidingmice LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/graphicsview/collidingmice")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
qt_add_executable(collidingmice
main.cpp
mouse.cpp mouse.h
)
+
set_target_properties(collidingmice PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(collidingmice PUBLIC
Qt::Core
Qt::Gui
Qt::Widgets
)
-
# Resources:
set(mice_resource_files
"images/cheese.jpg"
)
-qt6_add_resources(collidingmice "mice"
+qt_add_resources(collidingmice "mice"
PREFIX
"/"
FILES
diff --git a/examples/widgets/graphicsview/diagramscene/CMakeLists.txt b/examples/widgets/graphicsview/diagramscene/CMakeLists.txt
index 2d2ad96576..a473b29304 100644
--- a/examples/widgets/graphicsview/diagramscene/CMakeLists.txt
+++ b/examples/widgets/graphicsview/diagramscene/CMakeLists.txt
@@ -1,23 +1,15 @@
-# Generated from diagramscene.pro.
-
cmake_minimum_required(VERSION 3.16)
project(diagramscene LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/graphicsview/diagramscene")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
qt_add_executable(diagramscene
arrow.cpp arrow.h
@@ -27,17 +19,18 @@ qt_add_executable(diagramscene
main.cpp
mainwindow.cpp mainwindow.h
)
+
set_target_properties(diagramscene PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(diagramscene PUBLIC
Qt::Core
Qt::Gui
Qt::Widgets
)
-
# Resources:
set(diagramscene_resource_files
"images/background1.png"
@@ -57,7 +50,7 @@ set(diagramscene_resource_files
"images/underline.png"
)
-qt6_add_resources(diagramscene "diagramscene"
+qt_add_resources(diagramscene "diagramscene"
PREFIX
"/"
FILES
diff --git a/examples/widgets/graphicsview/dragdroprobot/CMakeLists.txt b/examples/widgets/graphicsview/dragdroprobot/CMakeLists.txt
index 584adb2160..7f9d4a3be0 100644
--- a/examples/widgets/graphicsview/dragdroprobot/CMakeLists.txt
+++ b/examples/widgets/graphicsview/dragdroprobot/CMakeLists.txt
@@ -1,46 +1,39 @@
-# Generated from dragdroprobot.pro.
-
cmake_minimum_required(VERSION 3.16)
project(dragdroprobot LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/graphicsview/dragdroprobot")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
qt_add_executable(dragdroprobot
coloritem.cpp coloritem.h
main.cpp
robot.cpp robot.h
)
+
set_target_properties(dragdroprobot PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(dragdroprobot PUBLIC
Qt::Core
Qt::Gui
Qt::Widgets
)
-
# Resources:
set(robot_resource_files
"images/head.png"
)
-qt6_add_resources(dragdroprobot "robot"
+qt_add_resources(dragdroprobot "robot"
PREFIX
"/"
FILES
diff --git a/examples/widgets/graphicsview/elasticnodes/CMakeLists.txt b/examples/widgets/graphicsview/elasticnodes/CMakeLists.txt
index f14cf835e6..b10f11a45c 100644
--- a/examples/widgets/graphicsview/elasticnodes/CMakeLists.txt
+++ b/examples/widgets/graphicsview/elasticnodes/CMakeLists.txt
@@ -1,23 +1,15 @@
-# Generated from elasticnodes.pro.
-
cmake_minimum_required(VERSION 3.16)
project(elasticnodes LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/graphicsview/elasticnodes")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
qt_add_executable(elasticnodes
edge.cpp edge.h
@@ -25,10 +17,12 @@ qt_add_executable(elasticnodes
main.cpp
node.cpp node.h
)
+
set_target_properties(elasticnodes PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(elasticnodes PUBLIC
Qt::Core
Qt::Gui
diff --git a/examples/widgets/graphicsview/embeddeddialogs/CMakeLists.txt b/examples/widgets/graphicsview/embeddeddialogs/CMakeLists.txt
index b63e15d785..d9684236ab 100644
--- a/examples/widgets/graphicsview/embeddeddialogs/CMakeLists.txt
+++ b/examples/widgets/graphicsview/embeddeddialogs/CMakeLists.txt
@@ -1,46 +1,40 @@
-# Generated from embeddeddialogs.pro.
-
cmake_minimum_required(VERSION 3.16)
project(embeddeddialogs LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/graphicsview/embeddeddialogs")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
qt_add_executable(embeddeddialogs
customproxy.cpp customproxy.h
embeddeddialog.cpp embeddeddialog.h embeddeddialog.ui
main.cpp
)
+
set_target_properties(embeddeddialogs PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(embeddeddialogs PUBLIC
Qt::Core
Qt::Gui
Qt::Widgets
)
-
# Resources:
set(embeddeddialogs_resource_files
"No-Ones-Laughing-3.jpg"
)
-qt6_add_resources(embeddeddialogs "embeddeddialogs"
+qt_add_resources(embeddeddialogs "embeddeddialogs"
PREFIX
"/"
FILES
diff --git a/examples/widgets/graphicsview/flowlayout/.prev_CMakeLists.txt b/examples/widgets/graphicsview/flowlayout/.prev_CMakeLists.txt
deleted file mode 100644
index 4208ba303e..0000000000
--- a/examples/widgets/graphicsview/flowlayout/.prev_CMakeLists.txt
+++ /dev/null
@@ -1,41 +0,0 @@
-# Generated from flowlayout.pro.
-
-cmake_minimum_required(VERSION 3.14)
-project(flowlayout LANGUAGES CXX)
-
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
-set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
-
-if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
-endif()
-
-set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/graphicsview/flowlayout")
-
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
-
-qt_add_executable(flowlayout
- flowlayout.cpp flowlayout.h
- main.cpp
- window.cpp window.h
-)
-set_target_properties(flowlayout PROPERTIES
- WIN32_EXECUTABLE TRUE
- MACOSX_BUNDLE TRUE
-)
-target_link_libraries(flowlayout PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
-)
-
-install(TARGETS flowlayout
- RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
-)
diff --git a/examples/widgets/graphicsview/flowlayout/CMakeLists.txt b/examples/widgets/graphicsview/flowlayout/CMakeLists.txt
index 9c44ec575d..4c1edc0060 100644
--- a/examples/widgets/graphicsview/flowlayout/CMakeLists.txt
+++ b/examples/widgets/graphicsview/flowlayout/CMakeLists.txt
@@ -1,40 +1,34 @@
-# Generated from flowlayout.pro.
-
cmake_minimum_required(VERSION 3.16)
project(flowlayout LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
-set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/graphicsview_flowlayout") # special case
+set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/graphicsview_flowlayout")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
-qt_add_executable(graphicsview_flowlayout # special case: renamed flowlayout
+qt_add_executable(graphicsview_flowlayout
flowlayout.cpp flowlayout.h
main.cpp
window.cpp window.h
)
-set_target_properties(graphicsview_flowlayout PROPERTIES # special case
+
+set_target_properties(graphicsview_flowlayout PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
-target_link_libraries(graphicsview_flowlayout PUBLIC # special case
+
+target_link_libraries(graphicsview_flowlayout PUBLIC
Qt::Core
Qt::Gui
Qt::Widgets
)
-install(TARGETS graphicsview_flowlayout # special case: renamed flowlayout
+install(TARGETS graphicsview_flowlayout
RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
diff --git a/examples/widgets/graphicsview/simpleanchorlayout/CMakeLists.txt b/examples/widgets/graphicsview/simpleanchorlayout/CMakeLists.txt
index e4118c0d87..12005229c8 100644
--- a/examples/widgets/graphicsview/simpleanchorlayout/CMakeLists.txt
+++ b/examples/widgets/graphicsview/simpleanchorlayout/CMakeLists.txt
@@ -1,31 +1,25 @@
-# Generated from simpleanchorlayout.pro.
-
cmake_minimum_required(VERSION 3.16)
project(simpleanchorlayout LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/graphicsview/simpleanchorlayout")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
qt_add_executable(simpleanchorlayout
main.cpp
)
+
set_target_properties(simpleanchorlayout PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(simpleanchorlayout PUBLIC
Qt::Core
Qt::Gui
diff --git a/examples/widgets/graphicsview/weatheranchorlayout/CMakeLists.txt b/examples/widgets/graphicsview/weatheranchorlayout/CMakeLists.txt
index 2aa69e59a0..629e551281 100644
--- a/examples/widgets/graphicsview/weatheranchorlayout/CMakeLists.txt
+++ b/examples/widgets/graphicsview/weatheranchorlayout/CMakeLists.txt
@@ -1,38 +1,31 @@
-# Generated from weatheranchorlayout.pro.
-
cmake_minimum_required(VERSION 3.16)
project(weatheranchorlayout LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/graphicsview/weatheranchorlayout")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
qt_add_executable(weatheranchorlayout
main.cpp
)
+
set_target_properties(weatheranchorlayout PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(weatheranchorlayout PUBLIC
Qt::Core
Qt::Gui
Qt::Widgets
)
-
# Resources:
set(weatheranchorlayout_resource_files
"images/5days.jpg"
@@ -43,7 +36,7 @@ set(weatheranchorlayout_resource_files
"images/weather-few-clouds.png"
)
-qt6_add_resources(weatheranchorlayout "weatheranchorlayout"
+qt_add_resources(weatheranchorlayout "weatheranchorlayout"
PREFIX
"/"
FILES
diff --git a/examples/widgets/itemviews/.prev_CMakeLists.txt b/examples/widgets/itemviews/.prev_CMakeLists.txt
deleted file mode 100644
index 96f03a2e61..0000000000
--- a/examples/widgets/itemviews/.prev_CMakeLists.txt
+++ /dev/null
@@ -1,27 +0,0 @@
-# Generated from itemviews.pro.
-
-add_subdirectory(addressbook)
-add_subdirectory(basicsortfiltermodel)
-add_subdirectory(chart)
-add_subdirectory(coloreditorfactory)
-add_subdirectory(combowidgetmapper)
-add_subdirectory(customsortfiltermodel)
-add_subdirectory(dirview)
-add_subdirectory(editabletreemodel)
-add_subdirectory(fetchmore)
-add_subdirectory(flattreeview)
-add_subdirectory(frozencolumn)
-add_subdirectory(interview)
-add_subdirectory(pixelator)
-add_subdirectory(simpletreemodel)
-add_subdirectory(simplewidgetmapper)
-add_subdirectory(spinboxdelegate)
-add_subdirectory(spreadsheet)
-add_subdirectory(stardelegate)
-add_subdirectory(storageview)
-if(QT_FEATURE_draganddrop)
- add_subdirectory(puzzle)
-endif()
-if(TARGET Qt::Xml)
- add_subdirectory(simpledommodel)
-endif()
diff --git a/examples/widgets/itemviews/CMakeLists.txt b/examples/widgets/itemviews/CMakeLists.txt
index 10d77c43c8..df7e8cefec 100644
--- a/examples/widgets/itemviews/CMakeLists.txt
+++ b/examples/widgets/itemviews/CMakeLists.txt
@@ -1,5 +1,3 @@
-# Generated from itemviews.pro.
-
qt_internal_add_example(addressbook)
qt_internal_add_example(basicsortfiltermodel)
qt_internal_add_example(chart)
diff --git a/examples/widgets/itemviews/addressbook/CMakeLists.txt b/examples/widgets/itemviews/addressbook/CMakeLists.txt
index 6127008fdc..1c440451e7 100644
--- a/examples/widgets/itemviews/addressbook/CMakeLists.txt
+++ b/examples/widgets/itemviews/addressbook/CMakeLists.txt
@@ -1,23 +1,15 @@
-# Generated from addressbook.pro.
-
cmake_minimum_required(VERSION 3.16)
project(addressbook LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/itemviews/addressbook")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
qt_add_executable(addressbook
adddialog.cpp adddialog.h
@@ -27,10 +19,12 @@ qt_add_executable(addressbook
newaddresstab.cpp newaddresstab.h
tablemodel.cpp tablemodel.h
)
+
set_target_properties(addressbook PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(addressbook PUBLIC
Qt::Core
Qt::Gui
diff --git a/examples/widgets/itemviews/basicsortfiltermodel/CMakeLists.txt b/examples/widgets/itemviews/basicsortfiltermodel/CMakeLists.txt
index 3bc56f1c5b..555d16f0f1 100644
--- a/examples/widgets/itemviews/basicsortfiltermodel/CMakeLists.txt
+++ b/examples/widgets/itemviews/basicsortfiltermodel/CMakeLists.txt
@@ -1,32 +1,26 @@
-# Generated from basicsortfiltermodel.pro.
-
cmake_minimum_required(VERSION 3.16)
project(basicsortfiltermodel LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/itemviews/basicsortfiltermodel")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
qt_add_executable(basicsortfiltermodel
main.cpp
window.cpp window.h
)
+
set_target_properties(basicsortfiltermodel PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(basicsortfiltermodel PUBLIC
Qt::Core
Qt::Gui
diff --git a/examples/widgets/itemviews/chart/CMakeLists.txt b/examples/widgets/itemviews/chart/CMakeLists.txt
index 82771605d2..43111a414a 100644
--- a/examples/widgets/itemviews/chart/CMakeLists.txt
+++ b/examples/widgets/itemviews/chart/CMakeLists.txt
@@ -1,46 +1,39 @@
-# Generated from chart.pro.
-
cmake_minimum_required(VERSION 3.16)
project(chart LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/itemviews/chart")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
qt_add_executable(chart
main.cpp
mainwindow.cpp mainwindow.h
pieview.cpp pieview.h
)
+
set_target_properties(chart PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(chart PUBLIC
Qt::Core
Qt::Gui
Qt::Widgets
)
-
# Resources:
set(chart_resource_files
"qtdata.cht"
)
-qt6_add_resources(chart "chart"
+qt_add_resources(chart "chart"
PREFIX
"/Charts"
FILES
diff --git a/examples/widgets/itemviews/coloreditorfactory/CMakeLists.txt b/examples/widgets/itemviews/coloreditorfactory/CMakeLists.txt
index 3887a4b162..74055bcdf2 100644
--- a/examples/widgets/itemviews/coloreditorfactory/CMakeLists.txt
+++ b/examples/widgets/itemviews/coloreditorfactory/CMakeLists.txt
@@ -1,33 +1,27 @@
-# Generated from coloreditorfactory.pro.
-
cmake_minimum_required(VERSION 3.16)
project(coloreditorfactory LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/itemviews/coloreditorfactory")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
qt_add_executable(coloreditorfactory
colorlisteditor.cpp colorlisteditor.h
main.cpp
window.cpp window.h
)
+
set_target_properties(coloreditorfactory PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(coloreditorfactory PUBLIC
Qt::Core
Qt::Gui
diff --git a/examples/widgets/itemviews/combowidgetmapper/CMakeLists.txt b/examples/widgets/itemviews/combowidgetmapper/CMakeLists.txt
index 07df054d50..b31c2b62ea 100644
--- a/examples/widgets/itemviews/combowidgetmapper/CMakeLists.txt
+++ b/examples/widgets/itemviews/combowidgetmapper/CMakeLists.txt
@@ -1,32 +1,26 @@
-# Generated from combowidgetmapper.pro.
-
cmake_minimum_required(VERSION 3.16)
project(combowidgetmapper LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/itemviews/combowidgetmapper")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
qt_add_executable(combowidgetmapper
main.cpp
window.cpp window.h
)
+
set_target_properties(combowidgetmapper PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(combowidgetmapper PUBLIC
Qt::Core
Qt::Gui
diff --git a/examples/widgets/itemviews/customsortfiltermodel/CMakeLists.txt b/examples/widgets/itemviews/customsortfiltermodel/CMakeLists.txt
index 3da9b7d327..973c1a41bf 100644
--- a/examples/widgets/itemviews/customsortfiltermodel/CMakeLists.txt
+++ b/examples/widgets/itemviews/customsortfiltermodel/CMakeLists.txt
@@ -1,23 +1,15 @@
-# Generated from customsortfiltermodel.pro.
-
cmake_minimum_required(VERSION 3.16)
project(customsortfiltermodel LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/itemviews/customsortfiltermodel")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
qt_add_executable(customsortfiltermodel
filterwidget.cpp filterwidget.h
@@ -25,23 +17,24 @@ qt_add_executable(customsortfiltermodel
mysortfilterproxymodel.cpp mysortfilterproxymodel.h
window.cpp window.h
)
+
set_target_properties(customsortfiltermodel PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(customsortfiltermodel PUBLIC
Qt::Core
Qt::Gui
Qt::Widgets
)
-
# Resources:
set(customsortfiltermodel_resource_files
"images/find.png"
)
-qt6_add_resources(customsortfiltermodel "customsortfiltermodel"
+qt_add_resources(customsortfiltermodel "customsortfiltermodel"
PREFIX
"/"
FILES
diff --git a/examples/widgets/itemviews/dirview/CMakeLists.txt b/examples/widgets/itemviews/dirview/CMakeLists.txt
index 86d87c2ae1..701922a813 100644
--- a/examples/widgets/itemviews/dirview/CMakeLists.txt
+++ b/examples/widgets/itemviews/dirview/CMakeLists.txt
@@ -1,31 +1,25 @@
-# Generated from dirview.pro.
-
cmake_minimum_required(VERSION 3.16)
project(dirview LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/itemviews/dirview")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
qt_add_executable(dirview
main.cpp
)
+
set_target_properties(dirview PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(dirview PUBLIC
Qt::Core
Qt::Gui
diff --git a/examples/widgets/itemviews/editabletreemodel/CMakeLists.txt b/examples/widgets/itemviews/editabletreemodel/CMakeLists.txt
index 4302519b55..e796bf8bca 100644
--- a/examples/widgets/itemviews/editabletreemodel/CMakeLists.txt
+++ b/examples/widgets/itemviews/editabletreemodel/CMakeLists.txt
@@ -1,23 +1,16 @@
-# Generated from editabletreemodel.pro.
-
cmake_minimum_required(VERSION 3.16)
project(editabletreemodel LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/itemviews/editabletreemodel")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
qt_add_executable(editabletreemodel
main.cpp
@@ -25,23 +18,24 @@ qt_add_executable(editabletreemodel
treeitem.cpp treeitem.h
treemodel.cpp treemodel.h
)
+
set_target_properties(editabletreemodel PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(editabletreemodel PUBLIC
Qt::Core
Qt::Gui
Qt::Widgets
)
-
# Resources:
set(editabletreemodel_resource_files
"default.txt"
)
-qt6_add_resources(editabletreemodel "editabletreemodel"
+qt_add_resources(editabletreemodel "editabletreemodel"
PREFIX
"/"
FILES
diff --git a/examples/widgets/itemviews/fetchmore/CMakeLists.txt b/examples/widgets/itemviews/fetchmore/CMakeLists.txt
index ffc45b8339..9d1b3b99c9 100644
--- a/examples/widgets/itemviews/fetchmore/CMakeLists.txt
+++ b/examples/widgets/itemviews/fetchmore/CMakeLists.txt
@@ -1,33 +1,27 @@
-# Generated from fetchmore.pro.
-
cmake_minimum_required(VERSION 3.16)
project(fetchmore LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/itemviews/fetchmore")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
qt_add_executable(fetchmore
filelistmodel.cpp filelistmodel.h
main.cpp
window.cpp window.h
)
+
set_target_properties(fetchmore PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(fetchmore PUBLIC
Qt::Core
Qt::Gui
diff --git a/examples/widgets/itemviews/flattreeview/CMakeLists.txt b/examples/widgets/itemviews/flattreeview/CMakeLists.txt
index 3464f82c24..c379646a8f 100644
--- a/examples/widgets/itemviews/flattreeview/CMakeLists.txt
+++ b/examples/widgets/itemviews/flattreeview/CMakeLists.txt
@@ -1,31 +1,25 @@
-# Generated from flattreeview.pro.
-
cmake_minimum_required(VERSION 3.16)
project(flattreeview LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/itemviews/flattreeview")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
qt_add_executable(flattreeview
main.cpp
)
+
set_target_properties(flattreeview PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(flattreeview PUBLIC
Qt::Core
Qt::Gui
diff --git a/examples/widgets/itemviews/frozencolumn/CMakeLists.txt b/examples/widgets/itemviews/frozencolumn/CMakeLists.txt
index 1bd4df20a5..c45fb725cf 100644
--- a/examples/widgets/itemviews/frozencolumn/CMakeLists.txt
+++ b/examples/widgets/itemviews/frozencolumn/CMakeLists.txt
@@ -1,45 +1,38 @@
-# Generated from frozencolumn.pro.
-
cmake_minimum_required(VERSION 3.16)
project(frozencolumn LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/itemviews/frozencolumn")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
qt_add_executable(frozencolumn
freezetablewidget.cpp freezetablewidget.h
main.cpp
)
+
set_target_properties(frozencolumn PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(frozencolumn PUBLIC
Qt::Core
Qt::Gui
Qt::Widgets
)
-
# Resources:
set(grades_resource_files
"grades.txt"
)
-qt6_add_resources(frozencolumn "grades"
+qt_add_resources(frozencolumn "grades"
PREFIX
"/"
FILES
diff --git a/examples/widgets/itemviews/interview/CMakeLists.txt b/examples/widgets/itemviews/interview/CMakeLists.txt
index cf5c9abe7d..610db3972d 100644
--- a/examples/widgets/itemviews/interview/CMakeLists.txt
+++ b/examples/widgets/itemviews/interview/CMakeLists.txt
@@ -1,39 +1,32 @@
-# Generated from interview.pro.
-
cmake_minimum_required(VERSION 3.16)
project(interview LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/itemviews/interview")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
qt_add_executable(interview
main.cpp
model.cpp model.h
)
+
set_target_properties(interview PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(interview PUBLIC
Qt::Core
Qt::Gui
Qt::Widgets
)
-
# Resources:
set(interview_resource_files
"images/folder.png"
@@ -41,7 +34,7 @@ set(interview_resource_files
"images/services.png"
)
-qt6_add_resources(interview "interview"
+qt_add_resources(interview "interview"
PREFIX
"/"
FILES
diff --git a/examples/widgets/itemviews/pixelator/.prev_CMakeLists.txt b/examples/widgets/itemviews/pixelator/.prev_CMakeLists.txt
deleted file mode 100644
index 2beeba0939..0000000000
--- a/examples/widgets/itemviews/pixelator/.prev_CMakeLists.txt
+++ /dev/null
@@ -1,61 +0,0 @@
-# Generated from pixelator.pro.
-
-cmake_minimum_required(VERSION 3.14)
-project(pixelator LANGUAGES CXX)
-
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
-set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
-
-if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
-endif()
-
-set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/itemviews/pixelator")
-
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
-
-qt_add_executable(pixelator
- imagemodel.cpp imagemodel.h
- main.cpp
- mainwindow.cpp mainwindow.h
- pixeldelegate.cpp pixeldelegate.h
-)
-set_target_properties(pixelator PROPERTIES
- WIN32_EXECUTABLE TRUE
- MACOSX_BUNDLE TRUE
-)
-target_link_libraries(pixelator PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
-)
-
-
-# Resources:
-set(images_resource_files
- "images/qt.png"
-)
-
-qt6_add_resources(pixelator "images"
- PREFIX
- "/"
- FILES
- ${images_resource_files}
-)
-
-if(TARGET Qt::PrintSupport)
- target_link_libraries(pixelator PUBLIC
- Qt::PrintSupport
- )
-endif()
-
-install(TARGETS pixelator
- RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
-)
diff --git a/examples/widgets/itemviews/pixelator/CMakeLists.txt b/examples/widgets/itemviews/pixelator/CMakeLists.txt
index 1960b7089e..463d859595 100644
--- a/examples/widgets/itemviews/pixelator/CMakeLists.txt
+++ b/examples/widgets/itemviews/pixelator/CMakeLists.txt
@@ -1,24 +1,18 @@
-# Generated from pixelator.pro.
-
cmake_minimum_required(VERSION 3.16)
project(pixelator LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/itemviews/pixelator")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
-find_package(Qt6 COMPONENTS PrintSupport) # special case
+find_package(Qt6
+ REQUIRED COMPONENTS Core Gui Widgets
+ OPTIONAL_COMPONENTS PrintSupport
+)
qt_add_executable(pixelator
imagemodel.cpp imagemodel.h
@@ -26,23 +20,24 @@ qt_add_executable(pixelator
mainwindow.cpp mainwindow.h
pixeldelegate.cpp pixeldelegate.h
)
+
set_target_properties(pixelator PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(pixelator PUBLIC
Qt::Core
Qt::Gui
Qt::Widgets
)
-
# Resources:
set(images_resource_files
"images/qt.png"
)
-qt6_add_resources(pixelator "images"
+qt_add_resources(pixelator "images"
PREFIX
"/"
FILES
diff --git a/examples/widgets/itemviews/puzzle/.prev_CMakeLists.txt b/examples/widgets/itemviews/puzzle/.prev_CMakeLists.txt
deleted file mode 100644
index b80cb9c29b..0000000000
--- a/examples/widgets/itemviews/puzzle/.prev_CMakeLists.txt
+++ /dev/null
@@ -1,55 +0,0 @@
-# Generated from puzzle.pro.
-
-cmake_minimum_required(VERSION 3.14)
-project(puzzle LANGUAGES CXX)
-
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
-set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
-
-if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
-endif()
-
-set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/itemviews/puzzle")
-
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
-
-qt_add_executable(puzzle
- main.cpp
- mainwindow.cpp mainwindow.h
- piecesmodel.cpp piecesmodel.h
- puzzlewidget.cpp puzzlewidget.h
-)
-set_target_properties(puzzle PROPERTIES
- WIN32_EXECUTABLE TRUE
- MACOSX_BUNDLE TRUE
-)
-target_link_libraries(puzzle PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
-)
-
-
-# Resources:
-set(puzzle_resource_files
- "example.jpg"
-)
-
-qt6_add_resources(puzzle "puzzle"
- PREFIX
- "/images"
- FILES
- ${puzzle_resource_files}
-)
-
-install(TARGETS puzzle
- RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
-)
diff --git a/examples/widgets/itemviews/puzzle/CMakeLists.txt b/examples/widgets/itemviews/puzzle/CMakeLists.txt
index 70a3dbab47..77624cc623 100644
--- a/examples/widgets/itemviews/puzzle/CMakeLists.txt
+++ b/examples/widgets/itemviews/puzzle/CMakeLists.txt
@@ -1,54 +1,47 @@
-# Generated from puzzle.pro.
-
cmake_minimum_required(VERSION 3.16)
project(puzzle LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/itemviews/puzzle")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
-qt_add_executable(itemviews_puzzle # special case: renamed puzzle
+qt_add_executable(itemviews_puzzle
main.cpp
mainwindow.cpp mainwindow.h
piecesmodel.cpp piecesmodel.h
puzzlewidget.cpp puzzlewidget.h
)
-set_target_properties(itemviews_puzzle PROPERTIES # special case
+
+set_target_properties(itemviews_puzzle PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
-target_link_libraries(itemviews_puzzle PUBLIC # special case
+
+target_link_libraries(itemviews_puzzle PUBLIC
Qt::Core
Qt::Gui
Qt::Widgets
)
-
# Resources:
set(puzzle_resource_files
"example.jpg"
)
-qt6_add_resources(itemviews_puzzle "puzzle"
+qt_add_resources(itemviews_puzzle "puzzle"
PREFIX
"/images"
FILES
${puzzle_resource_files}
)
-install(TARGETS itemviews_puzzle # special case: renamed puzzle
+install(TARGETS itemviews_puzzle
RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
diff --git a/examples/widgets/itemviews/puzzle/puzzlewidget.cpp b/examples/widgets/itemviews/puzzle/puzzlewidget.cpp
index 2c60d28946..e5e0192c96 100644
--- a/examples/widgets/itemviews/puzzle/puzzlewidget.cpp
+++ b/examples/widgets/itemviews/puzzle/puzzlewidget.cpp
@@ -195,8 +195,8 @@ void PuzzleWidget::paintEvent(QPaintEvent *event)
const QRect PuzzleWidget::targetSquare(const QPoint &position) const
{
- return QRect(position / pieceSize() * pieceSize(),
- QSize(pieceSize(), pieceSize()));
+ QPoint topLeft = QPoint(position.x() / pieceSize(), position.y() / pieceSize()) * pieceSize();
+ return QRect(topLeft, QSize(pieceSize(), pieceSize()));
}
int PuzzleWidget::pieceSize() const
diff --git a/examples/widgets/itemviews/simpledommodel/CMakeLists.txt b/examples/widgets/itemviews/simpledommodel/CMakeLists.txt
index 70c6fe2e4b..d6ad561216 100644
--- a/examples/widgets/itemviews/simpledommodel/CMakeLists.txt
+++ b/examples/widgets/itemviews/simpledommodel/CMakeLists.txt
@@ -1,24 +1,15 @@
-# Generated from simpledommodel.pro.
-
cmake_minimum_required(VERSION 3.16)
project(simpledommodel LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/itemviews/simpledommodel")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Xml)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets Xml)
qt_add_executable(simpledommodel
domitem.cpp domitem.h
@@ -26,10 +17,12 @@ qt_add_executable(simpledommodel
main.cpp
mainwindow.cpp mainwindow.h
)
+
set_target_properties(simpledommodel PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(simpledommodel PUBLIC
Qt::Core
Qt::Gui
diff --git a/examples/widgets/itemviews/simpletreemodel/CMakeLists.txt b/examples/widgets/itemviews/simpletreemodel/CMakeLists.txt
index 6c7bc4d097..462d843ee4 100644
--- a/examples/widgets/itemviews/simpletreemodel/CMakeLists.txt
+++ b/examples/widgets/itemviews/simpletreemodel/CMakeLists.txt
@@ -1,46 +1,39 @@
-# Generated from simpletreemodel.pro.
-
cmake_minimum_required(VERSION 3.16)
project(simpletreemodel LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/itemviews/simpletreemodel")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
qt_add_executable(simpletreemodel
main.cpp
treeitem.cpp treeitem.h
treemodel.cpp treemodel.h
)
+
set_target_properties(simpletreemodel PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(simpletreemodel PUBLIC
Qt::Core
Qt::Gui
Qt::Widgets
)
-
# Resources:
set(simpletreemodel_resource_files
"default.txt"
)
-qt6_add_resources(simpletreemodel "simpletreemodel"
+qt_add_resources(simpletreemodel "simpletreemodel"
PREFIX
"/"
FILES
diff --git a/examples/widgets/itemviews/simplewidgetmapper/CMakeLists.txt b/examples/widgets/itemviews/simplewidgetmapper/CMakeLists.txt
index 627ec07633..18d9a7ac29 100644
--- a/examples/widgets/itemviews/simplewidgetmapper/CMakeLists.txt
+++ b/examples/widgets/itemviews/simplewidgetmapper/CMakeLists.txt
@@ -1,32 +1,26 @@
-# Generated from simplewidgetmapper.pro.
-
cmake_minimum_required(VERSION 3.16)
project(simplewidgetmapper LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/itemviews/simplewidgetmapper")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
qt_add_executable(simplewidgetmapper
main.cpp
window.cpp window.h
)
+
set_target_properties(simplewidgetmapper PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(simplewidgetmapper PUBLIC
Qt::Core
Qt::Gui
diff --git a/examples/widgets/itemviews/spinboxdelegate/CMakeLists.txt b/examples/widgets/itemviews/spinboxdelegate/CMakeLists.txt
index 413bfa0945..67c58674c2 100644
--- a/examples/widgets/itemviews/spinboxdelegate/CMakeLists.txt
+++ b/examples/widgets/itemviews/spinboxdelegate/CMakeLists.txt
@@ -1,32 +1,26 @@
-# Generated from spinboxdelegate.pro.
-
cmake_minimum_required(VERSION 3.16)
project(spinboxdelegate LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/itemviews/spinboxdelegate")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
qt_add_executable(spinboxdelegate
delegate.cpp delegate.h
main.cpp
)
+
set_target_properties(spinboxdelegate PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(spinboxdelegate PUBLIC
Qt::Core
Qt::Gui
diff --git a/examples/widgets/itemviews/spreadsheet/.prev_CMakeLists.txt b/examples/widgets/itemviews/spreadsheet/.prev_CMakeLists.txt
deleted file mode 100644
index e14931e62f..0000000000
--- a/examples/widgets/itemviews/spreadsheet/.prev_CMakeLists.txt
+++ /dev/null
@@ -1,62 +0,0 @@
-# Generated from spreadsheet.pro.
-
-cmake_minimum_required(VERSION 3.14)
-project(spreadsheet LANGUAGES CXX)
-
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
-set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
-
-if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
-endif()
-
-set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/itemviews/spreadsheet")
-
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
-
-qt_add_executable(spreadsheet
- main.cpp
- printview.cpp printview.h
- spreadsheet.cpp spreadsheet.h
- spreadsheetdelegate.cpp spreadsheetdelegate.h
- spreadsheetitem.cpp spreadsheetitem.h
-)
-set_target_properties(spreadsheet PROPERTIES
- WIN32_EXECUTABLE TRUE
- MACOSX_BUNDLE TRUE
-)
-target_link_libraries(spreadsheet PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
-)
-
-
-# Resources:
-set(spreadsheet_resource_files
- "images/interview.png"
-)
-
-qt6_add_resources(spreadsheet "spreadsheet"
- PREFIX
- "/"
- FILES
- ${spreadsheet_resource_files}
-)
-
-if(TARGET Qt::PrintSupport)
- target_link_libraries(spreadsheet PUBLIC
- Qt::PrintSupport
- )
-endif()
-
-install(TARGETS spreadsheet
- RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
-)
diff --git a/examples/widgets/itemviews/spreadsheet/CMakeLists.txt b/examples/widgets/itemviews/spreadsheet/CMakeLists.txt
index 2f0aa028ea..031489185e 100644
--- a/examples/widgets/itemviews/spreadsheet/CMakeLists.txt
+++ b/examples/widgets/itemviews/spreadsheet/CMakeLists.txt
@@ -1,24 +1,18 @@
-# Generated from spreadsheet.pro.
-
cmake_minimum_required(VERSION 3.16)
project(spreadsheet LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/itemviews/spreadsheet")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
-find_package(Qt6 COMPONENTS PrintSupport) # special case
+find_package(Qt6
+ REQUIRED COMPONENTS Core Gui Widgets
+ OPTIONAL_COMPONENTS PrintSupport
+)
qt_add_executable(spreadsheet
main.cpp
@@ -27,28 +21,28 @@ qt_add_executable(spreadsheet
spreadsheetdelegate.cpp spreadsheetdelegate.h
spreadsheetitem.cpp spreadsheetitem.h
)
+
set_target_properties(spreadsheet PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(spreadsheet PUBLIC
Qt::Core
Qt::Gui
Qt::Widgets
)
-# special case begin
+
if (TARGET Qt::PrintSupport)
target_link_libraries(spreadsheet PUBLIC Qt::PrintSupport)
endif()
-# special case end
-
# Resources:
set(spreadsheet_resource_files
"images/interview.png"
)
-qt6_add_resources(spreadsheet "spreadsheet"
+qt_add_resources(spreadsheet "spreadsheet"
PREFIX
"/"
FILES
diff --git a/examples/widgets/itemviews/stardelegate/CMakeLists.txt b/examples/widgets/itemviews/stardelegate/CMakeLists.txt
index 7f89abe524..a9b7c58c4e 100644
--- a/examples/widgets/itemviews/stardelegate/CMakeLists.txt
+++ b/examples/widgets/itemviews/stardelegate/CMakeLists.txt
@@ -1,23 +1,15 @@
-# Generated from stardelegate.pro.
-
cmake_minimum_required(VERSION 3.16)
project(stardelegate LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/itemviews/stardelegate")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
qt_add_executable(stardelegate
main.cpp
@@ -25,10 +17,12 @@ qt_add_executable(stardelegate
stareditor.cpp stareditor.h
starrating.cpp starrating.h
)
+
set_target_properties(stardelegate PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(stardelegate PUBLIC
Qt::Core
Qt::Gui
diff --git a/examples/widgets/itemviews/storageview/CMakeLists.txt b/examples/widgets/itemviews/storageview/CMakeLists.txt
index 22f1724ed1..9f0e5eed3f 100644
--- a/examples/widgets/itemviews/storageview/CMakeLists.txt
+++ b/examples/widgets/itemviews/storageview/CMakeLists.txt
@@ -1,32 +1,26 @@
-# Generated from storageview.pro.
-
cmake_minimum_required(VERSION 3.16)
project(storageview LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/itemviews/storageview")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
qt_add_executable(storageview
main.cpp
storagemodel.cpp storagemodel.h
)
+
set_target_properties(storageview PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(storageview PUBLIC
Qt::Core
Qt::Gui
diff --git a/examples/widgets/layouts/CMakeLists.txt b/examples/widgets/layouts/CMakeLists.txt
index 656b602650..1950c7f641 100644
--- a/examples/widgets/layouts/CMakeLists.txt
+++ b/examples/widgets/layouts/CMakeLists.txt
@@ -1,5 +1,3 @@
-# Generated from layouts.pro.
-
qt_internal_add_example(basiclayouts)
qt_internal_add_example(borderlayout)
qt_internal_add_example(dynamiclayouts)
diff --git a/examples/widgets/layouts/basiclayouts/CMakeLists.txt b/examples/widgets/layouts/basiclayouts/CMakeLists.txt
index a3c99e2d4a..f755975a6e 100644
--- a/examples/widgets/layouts/basiclayouts/CMakeLists.txt
+++ b/examples/widgets/layouts/basiclayouts/CMakeLists.txt
@@ -1,32 +1,26 @@
-# Generated from basiclayouts.pro.
-
cmake_minimum_required(VERSION 3.16)
project(basiclayouts LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/layouts/basiclayouts")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
qt_add_executable(basiclayouts
dialog.cpp dialog.h
main.cpp
)
+
set_target_properties(basiclayouts PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(basiclayouts PUBLIC
Qt::Core
Qt::Gui
diff --git a/examples/widgets/layouts/borderlayout/CMakeLists.txt b/examples/widgets/layouts/borderlayout/CMakeLists.txt
index 92030252ba..ab7090a33c 100644
--- a/examples/widgets/layouts/borderlayout/CMakeLists.txt
+++ b/examples/widgets/layouts/borderlayout/CMakeLists.txt
@@ -1,33 +1,27 @@
-# Generated from borderlayout.pro.
-
cmake_minimum_required(VERSION 3.16)
project(borderlayout LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/layouts/borderlayout")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
qt_add_executable(borderlayout
borderlayout.cpp borderlayout.h
main.cpp
window.cpp window.h
)
+
set_target_properties(borderlayout PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(borderlayout PUBLIC
Qt::Core
Qt::Gui
diff --git a/examples/widgets/layouts/dynamiclayouts/CMakeLists.txt b/examples/widgets/layouts/dynamiclayouts/CMakeLists.txt
index e969f21cb0..946a82f6fa 100644
--- a/examples/widgets/layouts/dynamiclayouts/CMakeLists.txt
+++ b/examples/widgets/layouts/dynamiclayouts/CMakeLists.txt
@@ -1,32 +1,26 @@
-# Generated from dynamiclayouts.pro.
-
cmake_minimum_required(VERSION 3.16)
project(dynamiclayouts LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/layouts/dynamiclayouts")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
qt_add_executable(dynamiclayouts
dialog.cpp dialog.h
main.cpp
)
+
set_target_properties(dynamiclayouts PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(dynamiclayouts PUBLIC
Qt::Core
Qt::Gui
diff --git a/examples/widgets/layouts/flowlayout/CMakeLists.txt b/examples/widgets/layouts/flowlayout/CMakeLists.txt
index ef6d970ad9..fdaaec19ea 100644
--- a/examples/widgets/layouts/flowlayout/CMakeLists.txt
+++ b/examples/widgets/layouts/flowlayout/CMakeLists.txt
@@ -1,33 +1,27 @@
-# Generated from flowlayout.pro.
-
cmake_minimum_required(VERSION 3.16)
project(flowlayout LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/layouts/flowlayout")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
qt_add_executable(flowlayout
flowlayout.cpp flowlayout.h
main.cpp
window.cpp window.h
)
+
set_target_properties(flowlayout PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(flowlayout PUBLIC
Qt::Core
Qt::Gui
diff --git a/examples/widgets/mainwindows/CMakeLists.txt b/examples/widgets/mainwindows/CMakeLists.txt
index ba87029ef8..60dbc59310 100644
--- a/examples/widgets/mainwindows/CMakeLists.txt
+++ b/examples/widgets/mainwindows/CMakeLists.txt
@@ -1,5 +1,3 @@
-# Generated from mainwindows.pro.
-
qt_internal_add_example(application)
qt_internal_add_example(dockwidgets)
qt_internal_add_example(mainwindow)
diff --git a/examples/widgets/mainwindows/application/CMakeLists.txt b/examples/widgets/mainwindows/application/CMakeLists.txt
index 483edcda4a..6daecf9882 100644
--- a/examples/widgets/mainwindows/application/CMakeLists.txt
+++ b/examples/widgets/mainwindows/application/CMakeLists.txt
@@ -1,39 +1,32 @@
-# Generated from application.pro.
-
cmake_minimum_required(VERSION 3.16)
project(application LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/mainwindows/application")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
qt_add_executable(application
main.cpp
mainwindow.cpp mainwindow.h
)
+
set_target_properties(application PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(application PUBLIC
Qt::Core
Qt::Gui
Qt::Widgets
)
-
# Resources:
set(application_resource_files
"images/copy.png"
@@ -44,7 +37,7 @@ set(application_resource_files
"images/save.png"
)
-qt6_add_resources(application "application"
+qt_add_resources(application "application"
PREFIX
"/"
FILES
diff --git a/examples/widgets/mainwindows/dockwidgets/.prev_CMakeLists.txt b/examples/widgets/mainwindows/dockwidgets/.prev_CMakeLists.txt
deleted file mode 100644
index 2affbef3b9..0000000000
--- a/examples/widgets/mainwindows/dockwidgets/.prev_CMakeLists.txt
+++ /dev/null
@@ -1,62 +0,0 @@
-# Generated from dockwidgets.pro.
-
-cmake_minimum_required(VERSION 3.14)
-project(dockwidgets LANGUAGES CXX)
-
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
-set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
-
-if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
-endif()
-
-set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/mainwindows/dockwidgets")
-
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
-
-qt_add_executable(dockwidgets
- main.cpp
- mainwindow.cpp mainwindow.h
-)
-set_target_properties(dockwidgets PROPERTIES
- WIN32_EXECUTABLE TRUE
- MACOSX_BUNDLE TRUE
-)
-target_link_libraries(dockwidgets PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
-)
-
-
-# Resources:
-set(dockwidgets_resource_files
- "images/new.png"
- "images/print.png"
- "images/save.png"
- "images/undo.png"
-)
-
-qt6_add_resources(dockwidgets "dockwidgets"
- PREFIX
- "/"
- FILES
- ${dockwidgets_resource_files}
-)
-
-if(TARGET Qt::PrintSupport)
- target_link_libraries(dockwidgets PUBLIC
- Qt::PrintSupport
- )
-endif()
-
-install(TARGETS dockwidgets
- RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
-)
diff --git a/examples/widgets/mainwindows/dockwidgets/CMakeLists.txt b/examples/widgets/mainwindows/dockwidgets/CMakeLists.txt
index faf964f2d3..cf1d71ae52 100644
--- a/examples/widgets/mainwindows/dockwidgets/CMakeLists.txt
+++ b/examples/widgets/mainwindows/dockwidgets/CMakeLists.txt
@@ -1,44 +1,38 @@
-# Generated from dockwidgets.pro.
-
cmake_minimum_required(VERSION 3.16)
project(dockwidgets LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/mainwindows/dockwidgets")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
-find_package(Qt6 COMPONENTS PrintSupport) # special case
+find_package(Qt6
+ REQUIRED COMPONENTS Core Gui Widgets
+ OPTIONAL_COMPONENTS PrintSupport
+)
qt_add_executable(dockwidgets
main.cpp
mainwindow.cpp mainwindow.h
)
+
set_target_properties(dockwidgets PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(dockwidgets PUBLIC
Qt::Core
Qt::Gui
Qt::Widgets
)
-# special case begin
+
if (TARGET Qt::PrintSupport)
target_link_libraries(dockwidgets PUBLIC Qt::PrintSupport)
endif()
-# special case end
-
# Resources:
set(dockwidgets_resource_files
@@ -48,7 +42,7 @@ set(dockwidgets_resource_files
"images/undo.png"
)
-qt6_add_resources(dockwidgets "dockwidgets"
+qt_add_resources(dockwidgets "dockwidgets"
PREFIX
"/"
FILES
diff --git a/examples/widgets/mainwindows/mainwindow/CMakeLists.txt b/examples/widgets/mainwindows/mainwindow/CMakeLists.txt
index 3d26b5d632..211456f43e 100644
--- a/examples/widgets/mainwindows/mainwindow/CMakeLists.txt
+++ b/examples/widgets/mainwindows/mainwindow/CMakeLists.txt
@@ -1,23 +1,15 @@
-# Generated from mainwindow.pro.
-
cmake_minimum_required(VERSION 3.16)
project(mainwindow LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/mainwindows/mainwindow")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
qt_add_executable(mainwindow
colorswatch.cpp colorswatch.h
@@ -25,17 +17,18 @@ qt_add_executable(mainwindow
mainwindow.cpp mainwindow.h
toolbar.cpp toolbar.h
)
+
set_target_properties(mainwindow PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(mainwindow PUBLIC
Qt::Core
Qt::Gui
Qt::Widgets
)
-
# Resources:
set(mainwindow_resource_files
"qt.png"
@@ -44,7 +37,7 @@ set(mainwindow_resource_files
"titlebarRight.png"
)
-qt6_add_resources(mainwindow "mainwindow"
+qt_add_resources(mainwindow "mainwindow"
PREFIX
"/res"
FILES
diff --git a/examples/widgets/mainwindows/mdi/CMakeLists.txt b/examples/widgets/mainwindows/mdi/CMakeLists.txt
index c34d0e9ad7..7a4908f37d 100644
--- a/examples/widgets/mainwindows/mdi/CMakeLists.txt
+++ b/examples/widgets/mainwindows/mdi/CMakeLists.txt
@@ -1,40 +1,33 @@
-# Generated from mdi.pro.
-
cmake_minimum_required(VERSION 3.16)
project(mdi LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/mainwindows/mdi")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
qt_add_executable(mdi
main.cpp
mainwindow.cpp mainwindow.h
mdichild.cpp mdichild.h
)
+
set_target_properties(mdi PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(mdi PUBLIC
Qt::Core
Qt::Gui
Qt::Widgets
)
-
# Resources:
set(mdi_resource_files
"images/copy.png"
@@ -45,7 +38,7 @@ set(mdi_resource_files
"images/save.png"
)
-qt6_add_resources(mdi "mdi"
+qt_add_resources(mdi "mdi"
PREFIX
"/"
FILES
diff --git a/examples/widgets/mainwindows/menus/CMakeLists.txt b/examples/widgets/mainwindows/menus/CMakeLists.txt
index c2c97b9f64..39802f8927 100644
--- a/examples/widgets/mainwindows/menus/CMakeLists.txt
+++ b/examples/widgets/mainwindows/menus/CMakeLists.txt
@@ -1,32 +1,26 @@
-# Generated from menus.pro.
-
cmake_minimum_required(VERSION 3.16)
project(menus LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/mainwindows/menus")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
qt_add_executable(menus
main.cpp
mainwindow.cpp mainwindow.h
)
+
set_target_properties(menus PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(menus PUBLIC
Qt::Core
Qt::Gui
diff --git a/examples/widgets/mainwindows/sdi/CMakeLists.txt b/examples/widgets/mainwindows/sdi/CMakeLists.txt
index 4a255be50b..195c27210c 100644
--- a/examples/widgets/mainwindows/sdi/CMakeLists.txt
+++ b/examples/widgets/mainwindows/sdi/CMakeLists.txt
@@ -1,39 +1,32 @@
-# Generated from sdi.pro.
-
cmake_minimum_required(VERSION 3.16)
project(sdi LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/mainwindows/sdi")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
qt_add_executable(sdi
main.cpp
mainwindow.cpp mainwindow.h
)
+
set_target_properties(sdi PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(sdi PUBLIC
Qt::Core
Qt::Gui
Qt::Widgets
)
-
# Resources:
set(sdi_resource_files
"images/copy.png"
@@ -44,7 +37,7 @@ set(sdi_resource_files
"images/save.png"
)
-qt6_add_resources(sdi "sdi"
+qt_add_resources(sdi "sdi"
PREFIX
"/"
FILES
diff --git a/examples/widgets/painting/.prev_CMakeLists.txt b/examples/widgets/painting/.prev_CMakeLists.txt
deleted file mode 100644
index 2ef5da303a..0000000000
--- a/examples/widgets/painting/.prev_CMakeLists.txt
+++ /dev/null
@@ -1,13 +0,0 @@
-# Generated from painting.pro.
-
-add_subdirectory(basicdrawing)
-add_subdirectory(concentriccircles)
-add_subdirectory(affine)
-add_subdirectory(composition)
-add_subdirectory(deform)
-add_subdirectory(gradients)
-add_subdirectory(pathstroke)
-add_subdirectory(imagecomposition)
-add_subdirectory(painterpaths)
-add_subdirectory(transformations)
-add_subdirectory(fontsampler)
diff --git a/examples/widgets/painting/CMakeLists.txt b/examples/widgets/painting/CMakeLists.txt
index 40ebafdc31..35f3af71b5 100644
--- a/examples/widgets/painting/CMakeLists.txt
+++ b/examples/widgets/painting/CMakeLists.txt
@@ -1,10 +1,7 @@
-# Generated from painting.pro.
-
-#add_subdirectory(shared) # special case pulled in by other subdirs as needed
qt_internal_add_example(basicdrawing)
qt_internal_add_example(concentriccircles)
qt_internal_add_example(affine)
-# qt_internal_add_example(composition) # special case FIXME: Seems buggy wrt. usesOpenGL function
+# qt_internal_add_example(composition) # FIXME: Seems buggy wrt. usesOpenGL function
qt_internal_add_example(deform)
qt_internal_add_example(gradients)
qt_internal_add_example(pathstroke)
diff --git a/examples/widgets/painting/affine/.prev_CMakeLists.txt b/examples/widgets/painting/affine/.prev_CMakeLists.txt
deleted file mode 100644
index 4efe5f28a7..0000000000
--- a/examples/widgets/painting/affine/.prev_CMakeLists.txt
+++ /dev/null
@@ -1,118 +0,0 @@
-# Generated from affine.pro.
-
-cmake_minimum_required(VERSION 3.14)
-project(affine LANGUAGES CXX)
-
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
-set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
-
-if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
-endif()
-
-set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/painting/affine")
-
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
-
-qt_add_executable(affine
- ../shared/arthurstyle.cpp ../shared/arthurstyle.h
- ../shared/arthurwidgets.cpp ../shared/arthurwidgets.h
- ../shared/hoverpoints.cpp ../shared/hoverpoints.h
- main.cpp
- xform.cpp xform.h
-)
-set_target_properties(affine PROPERTIES
- WIN32_EXECUTABLE TRUE
- MACOSX_BUNDLE TRUE
-)
-target_include_directories(affine PUBLIC
- ../shared
-)
-
-target_link_libraries(affine PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
-)
-
-
-# Resources:
-set(shared_resource_files
- "../shared/images/button_normal_cap_left.png"
- "../shared/images/button_normal_cap_right.png"
- "../shared/images/button_normal_stretch.png"
- "../shared/images/button_pressed_cap_left.png"
- "../shared/images/button_pressed_cap_right.png"
- "../shared/images/button_pressed_stretch.png"
- "../shared/images/frame_bottom.png"
- "../shared/images/frame_bottomleft.png"
- "../shared/images/frame_bottomright.png"
- "../shared/images/frame_left.png"
- "../shared/images/frame_right.png"
- "../shared/images/frame_top.png"
- "../shared/images/frame_topleft.png"
- "../shared/images/frame_topright.png"
- "../shared/images/groupframe_bottom_left.png"
- "../shared/images/groupframe_bottom_right.png"
- "../shared/images/groupframe_bottom_stretch.png"
- "../shared/images/groupframe_left_stretch.png"
- "../shared/images/groupframe_right_stretch.png"
- "../shared/images/groupframe_top_stretch.png"
- "../shared/images/groupframe_topleft.png"
- "../shared/images/groupframe_topright.png"
- "../shared/images/line_dash_dot.png"
- "../shared/images/line_dash_dot_dot.png"
- "../shared/images/line_dashed.png"
- "../shared/images/line_dotted.png"
- "../shared/images/line_solid.png"
- "../shared/images/radiobutton-on.png"
- "../shared/images/radiobutton_off.png"
- "../shared/images/radiobutton_on.png"
- "../shared/images/slider_bar.png"
- "../shared/images/slider_thumb_on.png"
- "../shared/images/title_cap_left.png"
- "../shared/images/title_cap_right.png"
- "../shared/images/title_stretch.png"
-)
-
-qt6_add_resources(affine "shared"
- PREFIX
- "/res"
- BASE
- "../shared"
- FILES
- ${shared_resource_files}
-)
-set(affine_resource_files
- "bg1.jpg"
- "xform.cpp"
- "xform.html"
-)
-
-qt6_add_resources(affine "affine"
- PREFIX
- "/res/affine"
- FILES
- ${affine_resource_files}
-)
-
-if(QT_FEATURE_opengl)
- target_sources(affine PUBLIC
- ../shared/fbopaintdevice.cpp ../shared/fbopaintdevice.h
- )
-
- target_link_libraries(affine PUBLIC
- Qt::OpenGL
- )
-endif()
-
-install(TARGETS affine
- RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
-)
diff --git a/examples/widgets/painting/affine/CMakeLists.txt b/examples/widgets/painting/affine/CMakeLists.txt
index 8594017d30..602b1807d6 100644
--- a/examples/widgets/painting/affine/CMakeLists.txt
+++ b/examples/widgets/painting/affine/CMakeLists.txt
@@ -1,56 +1,45 @@
-# Generated from affine.pro.
-
cmake_minimum_required(VERSION 3.16)
project(affine LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/painting/affine")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
qt_add_executable(affine
- # special case begin
# remove files from ../shared
#../shared/arthurstyle.cpp ../shared/arthurstyle.h
#../shared/arthurwidgets.cpp ../shared/arthurwidgets.h
#../shared/hoverpoints.cpp ../shared/hoverpoints.h
- # special case end
main.cpp
xform.cpp xform.h
)
+
set_target_properties(affine PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_include_directories(affine PUBLIC
../shared
)
-# special case begin
if(NOT TARGET painting_shared::painting_shared)
include(../shared/use_lib.cmake)
endif()
-# special case end
target_link_libraries(affine PUBLIC
Qt::Core
Qt::Gui
Qt::Widgets
- painting_shared::painting_shared # special case
+ painting_shared::painting_shared
)
-
# Resources:
set(shared_resource_files
"../shared/images/button_normal_cap_left.png"
@@ -90,7 +79,7 @@ set(shared_resource_files
"../shared/images/title_stretch.png"
)
-qt6_add_resources(affine "shared"
+qt_add_resources(affine "shared"
PREFIX
"/res"
BASE
@@ -98,20 +87,20 @@ qt6_add_resources(affine "shared"
FILES
${shared_resource_files}
)
+
set(affine_resource_files
"bg1.jpg"
"xform.cpp"
"xform.html"
)
-qt6_add_resources(affine "affine"
+qt_add_resources(affine "affine"
PREFIX
"/res/affine"
FILES
${affine_resource_files}
)
-# special case begin
# remove files from ../shared
#if(QT_FEATURE_opengl)
#target_sources(affine PUBLIC
@@ -122,7 +111,6 @@ qt6_add_resources(affine "affine"
#Qt::OpenGL
#)
#endif()
-# special case end
install(TARGETS affine
RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
diff --git a/examples/widgets/painting/basicdrawing/CMakeLists.txt b/examples/widgets/painting/basicdrawing/CMakeLists.txt
index 74e05e2f5e..496f1abfbe 100644
--- a/examples/widgets/painting/basicdrawing/CMakeLists.txt
+++ b/examples/widgets/painting/basicdrawing/CMakeLists.txt
@@ -1,47 +1,40 @@
-# Generated from basicdrawing.pro.
-
cmake_minimum_required(VERSION 3.16)
project(basicdrawing LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/painting/basicdrawing")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
qt_add_executable(basicdrawing
main.cpp
renderarea.cpp renderarea.h
window.cpp window.h
)
+
set_target_properties(basicdrawing PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(basicdrawing PUBLIC
Qt::Core
Qt::Gui
Qt::Widgets
)
-
# Resources:
set(basicdrawing_resource_files
"images/brick.png"
"images/qt-logo.png"
)
-qt6_add_resources(basicdrawing "basicdrawing"
+qt_add_resources(basicdrawing "basicdrawing"
PREFIX
"/"
FILES
diff --git a/examples/widgets/painting/composition/.prev_CMakeLists.txt b/examples/widgets/painting/composition/.prev_CMakeLists.txt
deleted file mode 100644
index 7cf2aab45f..0000000000
--- a/examples/widgets/painting/composition/.prev_CMakeLists.txt
+++ /dev/null
@@ -1,119 +0,0 @@
-# Generated from composition.pro.
-
-cmake_minimum_required(VERSION 3.14)
-project(composition LANGUAGES CXX)
-
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
-set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
-
-if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
-endif()
-
-set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/painting/composition")
-
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
-
-qt_add_executable(composition
- ../shared/arthurstyle.cpp ../shared/arthurstyle.h
- ../shared/arthurwidgets.cpp ../shared/arthurwidgets.h
- ../shared/hoverpoints.cpp ../shared/hoverpoints.h
- composition.cpp composition.h
- main.cpp
-)
-set_target_properties(composition PROPERTIES
- WIN32_EXECUTABLE TRUE
- MACOSX_BUNDLE TRUE
-)
-target_include_directories(composition PUBLIC
- ../shared
-)
-
-target_link_libraries(composition PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
-)
-
-
-# Resources:
-set(shared_resource_files
- "../shared/images/button_normal_cap_left.png"
- "../shared/images/button_normal_cap_right.png"
- "../shared/images/button_normal_stretch.png"
- "../shared/images/button_pressed_cap_left.png"
- "../shared/images/button_pressed_cap_right.png"
- "../shared/images/button_pressed_stretch.png"
- "../shared/images/frame_bottom.png"
- "../shared/images/frame_bottomleft.png"
- "../shared/images/frame_bottomright.png"
- "../shared/images/frame_left.png"
- "../shared/images/frame_right.png"
- "../shared/images/frame_top.png"
- "../shared/images/frame_topleft.png"
- "../shared/images/frame_topright.png"
- "../shared/images/groupframe_bottom_left.png"
- "../shared/images/groupframe_bottom_right.png"
- "../shared/images/groupframe_bottom_stretch.png"
- "../shared/images/groupframe_left_stretch.png"
- "../shared/images/groupframe_right_stretch.png"
- "../shared/images/groupframe_top_stretch.png"
- "../shared/images/groupframe_topleft.png"
- "../shared/images/groupframe_topright.png"
- "../shared/images/line_dash_dot.png"
- "../shared/images/line_dash_dot_dot.png"
- "../shared/images/line_dashed.png"
- "../shared/images/line_dotted.png"
- "../shared/images/line_solid.png"
- "../shared/images/radiobutton-on.png"
- "../shared/images/radiobutton_off.png"
- "../shared/images/radiobutton_on.png"
- "../shared/images/slider_bar.png"
- "../shared/images/slider_thumb_on.png"
- "../shared/images/title_cap_left.png"
- "../shared/images/title_cap_right.png"
- "../shared/images/title_stretch.png"
-)
-
-qt6_add_resources(composition "shared"
- PREFIX
- "/res"
- BASE
- "../shared"
- FILES
- ${shared_resource_files}
-)
-set(composition_resource_files
- "composition.cpp"
- "composition.html"
- "flower.jpg"
- "flower_alpha.jpg"
-)
-
-qt6_add_resources(composition "composition"
- PREFIX
- "/res/composition"
- FILES
- ${composition_resource_files}
-)
-
-if(QT_FEATURE_opengl)
- target_sources(composition PUBLIC
- ../shared/fbopaintdevice.cpp ../shared/fbopaintdevice.h
- )
-
- target_link_libraries(composition PUBLIC
- Qt::OpenGL
- )
-endif()
-
-install(TARGETS composition
- RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
-)
diff --git a/examples/widgets/painting/composition/CMakeLists.txt b/examples/widgets/painting/composition/CMakeLists.txt
index a859340074..252b46daca 100644
--- a/examples/widgets/painting/composition/CMakeLists.txt
+++ b/examples/widgets/painting/composition/CMakeLists.txt
@@ -1,56 +1,45 @@
-# Generated from composition.pro.
-
cmake_minimum_required(VERSION 3.16)
project(composition LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/painting/composition")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
qt_add_executable(composition
- # special case begin
# remove files from ../shared
#../shared/arthurstyle.cpp ../shared/arthurstyle.h
#../shared/arthurwidgets.cpp ../shared/arthurwidgets.h
#../shared/hoverpoints.cpp ../shared/hoverpoints.h
- # special case end
composition.cpp composition.h
main.cpp
)
+
set_target_properties(composition PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_include_directories(composition PUBLIC
../shared
)
-# special case begin
if(NOT TARGET painting_shared::painting_shared)
include(../shared/use_lib.cmake)
endif()
-# special case end
target_link_libraries(composition PUBLIC
Qt::Core
Qt::Gui
Qt::Widgets
- painting_shared::painting_shared # special case
+ painting_shared::painting_shared
)
-
# Resources:
set(shared_resource_files
"../shared/images/button_normal_cap_left.png"
@@ -90,7 +79,7 @@ set(shared_resource_files
"../shared/images/title_stretch.png"
)
-qt6_add_resources(composition "shared"
+qt_add_resources(composition "shared"
PREFIX
"/res"
BASE
@@ -98,6 +87,7 @@ qt6_add_resources(composition "shared"
FILES
${shared_resource_files}
)
+
set(composition_resource_files
"composition.cpp"
"composition.html"
@@ -105,14 +95,13 @@ set(composition_resource_files
"flower_alpha.jpg"
)
-qt6_add_resources(composition "composition"
+qt_add_resources(composition "composition"
PREFIX
"/res/composition"
FILES
${composition_resource_files}
)
-# special case begin
# remove files from ../shared
#if(QT_FEATURE_opengl)
#target_sources(affine PUBLIC
@@ -123,7 +112,6 @@ qt6_add_resources(composition "composition"
#Qt::OpenGL
#)
#endif()
-# special case end
install(TARGETS composition
RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
diff --git a/examples/widgets/painting/concentriccircles/CMakeLists.txt b/examples/widgets/painting/concentriccircles/CMakeLists.txt
index 6ed7822902..b14db844b4 100644
--- a/examples/widgets/painting/concentriccircles/CMakeLists.txt
+++ b/examples/widgets/painting/concentriccircles/CMakeLists.txt
@@ -1,33 +1,27 @@
-# Generated from concentriccircles.pro.
-
cmake_minimum_required(VERSION 3.16)
project(concentriccircles LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/painting/concentriccircles")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
qt_add_executable(concentriccircles
circlewidget.cpp circlewidget.h
main.cpp
window.cpp window.h
)
+
set_target_properties(concentriccircles PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(concentriccircles PUBLIC
Qt::Core
Qt::Gui
diff --git a/examples/widgets/painting/deform/.prev_CMakeLists.txt b/examples/widgets/painting/deform/.prev_CMakeLists.txt
deleted file mode 100644
index c99df00a5a..0000000000
--- a/examples/widgets/painting/deform/.prev_CMakeLists.txt
+++ /dev/null
@@ -1,117 +0,0 @@
-# Generated from deform.pro.
-
-cmake_minimum_required(VERSION 3.14)
-project(deform LANGUAGES CXX)
-
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
-set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
-
-if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
-endif()
-
-set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/painting/deform")
-
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
-
-qt_add_executable(deform
- ../shared/arthurstyle.cpp ../shared/arthurstyle.h
- ../shared/arthurwidgets.cpp ../shared/arthurwidgets.h
- ../shared/hoverpoints.cpp ../shared/hoverpoints.h
- main.cpp
- pathdeform.cpp pathdeform.h
-)
-set_target_properties(deform PROPERTIES
- WIN32_EXECUTABLE TRUE
- MACOSX_BUNDLE TRUE
-)
-target_include_directories(deform PUBLIC
- ../shared
-)
-
-target_link_libraries(deform PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
-)
-
-
-# Resources:
-set(shared_resource_files
- "../shared/images/button_normal_cap_left.png"
- "../shared/images/button_normal_cap_right.png"
- "../shared/images/button_normal_stretch.png"
- "../shared/images/button_pressed_cap_left.png"
- "../shared/images/button_pressed_cap_right.png"
- "../shared/images/button_pressed_stretch.png"
- "../shared/images/frame_bottom.png"
- "../shared/images/frame_bottomleft.png"
- "../shared/images/frame_bottomright.png"
- "../shared/images/frame_left.png"
- "../shared/images/frame_right.png"
- "../shared/images/frame_top.png"
- "../shared/images/frame_topleft.png"
- "../shared/images/frame_topright.png"
- "../shared/images/groupframe_bottom_left.png"
- "../shared/images/groupframe_bottom_right.png"
- "../shared/images/groupframe_bottom_stretch.png"
- "../shared/images/groupframe_left_stretch.png"
- "../shared/images/groupframe_right_stretch.png"
- "../shared/images/groupframe_top_stretch.png"
- "../shared/images/groupframe_topleft.png"
- "../shared/images/groupframe_topright.png"
- "../shared/images/line_dash_dot.png"
- "../shared/images/line_dash_dot_dot.png"
- "../shared/images/line_dashed.png"
- "../shared/images/line_dotted.png"
- "../shared/images/line_solid.png"
- "../shared/images/radiobutton-on.png"
- "../shared/images/radiobutton_off.png"
- "../shared/images/radiobutton_on.png"
- "../shared/images/slider_bar.png"
- "../shared/images/slider_thumb_on.png"
- "../shared/images/title_cap_left.png"
- "../shared/images/title_cap_right.png"
- "../shared/images/title_stretch.png"
-)
-
-qt6_add_resources(deform "shared"
- PREFIX
- "/res"
- BASE
- "../shared"
- FILES
- ${shared_resource_files}
-)
-set(deform_resource_files
- "pathdeform.cpp"
- "pathdeform.html"
-)
-
-qt6_add_resources(deform "deform"
- PREFIX
- "/res/deform"
- FILES
- ${deform_resource_files}
-)
-
-if(QT_FEATURE_opengl)
- target_sources(deform PUBLIC
- ../shared/fbopaintdevice.cpp ../shared/fbopaintdevice.h
- )
-
- target_link_libraries(deform PUBLIC
- Qt::OpenGL
- )
-endif()
-
-install(TARGETS deform
- RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
-)
diff --git a/examples/widgets/painting/deform/CMakeLists.txt b/examples/widgets/painting/deform/CMakeLists.txt
index c95ae5f2f5..dc8f533711 100644
--- a/examples/widgets/painting/deform/CMakeLists.txt
+++ b/examples/widgets/painting/deform/CMakeLists.txt
@@ -1,56 +1,45 @@
-# Generated from deform.pro.
-
cmake_minimum_required(VERSION 3.16)
project(deform LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/painting/deform")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
qt_add_executable(deform
- # special case begin
# remove files from ../shared
#../shared/arthurstyle.cpp ../shared/arthurstyle.h
#../shared/arthurwidgets.cpp ../shared/arthurwidgets.h
#../shared/hoverpoints.cpp ../shared/hoverpoints.h
- # special case end
main.cpp
pathdeform.cpp pathdeform.h
)
+
set_target_properties(deform PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_include_directories(deform PUBLIC
../shared
)
-# special case begin
if(NOT TARGET painting_shared::painting_shared)
include(../shared/use_lib.cmake)
endif()
-# special case end
target_link_libraries(deform PUBLIC
Qt::Core
Qt::Gui
Qt::Widgets
- painting_shared::painting_shared # special case
+ painting_shared::painting_shared
)
-
# Resources:
set(shared_resource_files
"../shared/images/button_normal_cap_left.png"
@@ -90,7 +79,7 @@ set(shared_resource_files
"../shared/images/title_stretch.png"
)
-qt6_add_resources(deform "shared"
+qt_add_resources(deform "shared"
PREFIX
"/res"
BASE
@@ -98,19 +87,19 @@ qt6_add_resources(deform "shared"
FILES
${shared_resource_files}
)
+
set(deform_resource_files
"pathdeform.cpp"
"pathdeform.html"
)
-qt6_add_resources(deform "deform"
+qt_add_resources(deform "deform"
PREFIX
"/res/deform"
FILES
${deform_resource_files}
)
-# special case begin
# remove files from ../shared
#if(QT_FEATURE_opengl)
#target_sources(affine PUBLIC
@@ -121,7 +110,6 @@ qt6_add_resources(deform "deform"
#Qt::OpenGL
#)
#endif()
-# special case end
install(TARGETS deform
RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
diff --git a/examples/widgets/painting/fontsampler/CMakeLists.txt b/examples/widgets/painting/fontsampler/CMakeLists.txt
index 58c610cf1c..0897e9b664 100644
--- a/examples/widgets/painting/fontsampler/CMakeLists.txt
+++ b/examples/widgets/painting/fontsampler/CMakeLists.txt
@@ -1,34 +1,31 @@
-# Generated from fontsampler.pro.
-
cmake_minimum_required(VERSION 3.16)
project(fontsampler LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/painting/fontsampler")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
-find_package(Qt6 COMPONENTS PrintSupport)
+find_package(Qt6
+ REQUIRED COMPONENTS Core Gui Widgets
+ OPTIONAL_COMPONENTS PrintSupport
+)
qt_add_executable(fontsampler
main.cpp
mainwindow.cpp mainwindow.h
mainwindowbase.ui
)
+
set_target_properties(fontsampler PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(fontsampler PUBLIC
Qt::Core
Qt::Gui
diff --git a/examples/widgets/painting/gradients/.prev_CMakeLists.txt b/examples/widgets/painting/gradients/.prev_CMakeLists.txt
deleted file mode 100644
index 1260b18089..0000000000
--- a/examples/widgets/painting/gradients/.prev_CMakeLists.txt
+++ /dev/null
@@ -1,117 +0,0 @@
-# Generated from gradients.pro.
-
-cmake_minimum_required(VERSION 3.14)
-project(gradients LANGUAGES CXX)
-
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
-set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
-
-if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
-endif()
-
-set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/painting/gradients")
-
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
-
-qt_add_executable(gradients
- ../shared/arthurstyle.cpp ../shared/arthurstyle.h
- ../shared/arthurwidgets.cpp ../shared/arthurwidgets.h
- ../shared/hoverpoints.cpp ../shared/hoverpoints.h
- gradients.cpp gradients.h
- main.cpp
-)
-set_target_properties(gradients PROPERTIES
- WIN32_EXECUTABLE TRUE
- MACOSX_BUNDLE TRUE
-)
-target_include_directories(gradients PUBLIC
- ../shared
-)
-
-target_link_libraries(gradients PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
-)
-
-
-# Resources:
-set(shared_resource_files
- "../shared/images/button_normal_cap_left.png"
- "../shared/images/button_normal_cap_right.png"
- "../shared/images/button_normal_stretch.png"
- "../shared/images/button_pressed_cap_left.png"
- "../shared/images/button_pressed_cap_right.png"
- "../shared/images/button_pressed_stretch.png"
- "../shared/images/frame_bottom.png"
- "../shared/images/frame_bottomleft.png"
- "../shared/images/frame_bottomright.png"
- "../shared/images/frame_left.png"
- "../shared/images/frame_right.png"
- "../shared/images/frame_top.png"
- "../shared/images/frame_topleft.png"
- "../shared/images/frame_topright.png"
- "../shared/images/groupframe_bottom_left.png"
- "../shared/images/groupframe_bottom_right.png"
- "../shared/images/groupframe_bottom_stretch.png"
- "../shared/images/groupframe_left_stretch.png"
- "../shared/images/groupframe_right_stretch.png"
- "../shared/images/groupframe_top_stretch.png"
- "../shared/images/groupframe_topleft.png"
- "../shared/images/groupframe_topright.png"
- "../shared/images/line_dash_dot.png"
- "../shared/images/line_dash_dot_dot.png"
- "../shared/images/line_dashed.png"
- "../shared/images/line_dotted.png"
- "../shared/images/line_solid.png"
- "../shared/images/radiobutton-on.png"
- "../shared/images/radiobutton_off.png"
- "../shared/images/radiobutton_on.png"
- "../shared/images/slider_bar.png"
- "../shared/images/slider_thumb_on.png"
- "../shared/images/title_cap_left.png"
- "../shared/images/title_cap_right.png"
- "../shared/images/title_stretch.png"
-)
-
-qt6_add_resources(gradients "shared"
- PREFIX
- "/res"
- BASE
- "../shared"
- FILES
- ${shared_resource_files}
-)
-set(gradients_resource_files
- "gradients.cpp"
- "gradients.html"
-)
-
-qt6_add_resources(gradients "gradients"
- PREFIX
- "/res/gradients"
- FILES
- ${gradients_resource_files}
-)
-
-if(QT_FEATURE_opengl)
- target_sources(gradients PUBLIC
- ../shared/fbopaintdevice.cpp ../shared/fbopaintdevice.h
- )
-
- target_link_libraries(gradients PUBLIC
- Qt::OpenGL
- )
-endif()
-
-install(TARGETS gradients
- RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
-)
diff --git a/examples/widgets/painting/gradients/CMakeLists.txt b/examples/widgets/painting/gradients/CMakeLists.txt
index 199389a47a..93e24d5400 100644
--- a/examples/widgets/painting/gradients/CMakeLists.txt
+++ b/examples/widgets/painting/gradients/CMakeLists.txt
@@ -1,56 +1,45 @@
-# Generated from gradients.pro.
-
cmake_minimum_required(VERSION 3.16)
project(gradients LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/painting/gradients")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
qt_add_executable(gradients
- # special case begin
# remove files from ../shared
#../shared/arthurstyle.cpp ../shared/arthurstyle.h
#../shared/arthurwidgets.cpp ../shared/arthurwidgets.h
#../shared/hoverpoints.cpp ../shared/hoverpoints.h
- # special case end
gradients.cpp gradients.h
main.cpp
)
+
set_target_properties(gradients PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_include_directories(gradients PUBLIC
../shared
)
-# special case begin
if(NOT TARGET painting_shared::painting_shared)
include(../shared/use_lib.cmake)
endif()
-# special case end
target_link_libraries(gradients PUBLIC
Qt::Core
Qt::Gui
Qt::Widgets
- painting_shared::painting_shared # special case
+ painting_shared::painting_shared
)
-
# Resources:
set(shared_resource_files
"../shared/images/button_normal_cap_left.png"
@@ -90,7 +79,7 @@ set(shared_resource_files
"../shared/images/title_stretch.png"
)
-qt6_add_resources(gradients "shared"
+qt_add_resources(gradients "shared"
PREFIX
"/res"
BASE
@@ -98,19 +87,19 @@ qt6_add_resources(gradients "shared"
FILES
${shared_resource_files}
)
+
set(gradients_resource_files
"gradients.cpp"
"gradients.html"
)
-qt6_add_resources(gradients "gradients"
+qt_add_resources(gradients "gradients"
PREFIX
"/res/gradients"
FILES
${gradients_resource_files}
)
-# special case begin
# remove files from ../shared
#if(QT_FEATURE_opengl)
#target_sources(affine PUBLIC
@@ -121,7 +110,6 @@ qt6_add_resources(gradients "gradients"
#Qt::OpenGL
#)
#endif()
-# special case end
install(TARGETS gradients
RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
diff --git a/examples/widgets/painting/imagecomposition/CMakeLists.txt b/examples/widgets/painting/imagecomposition/CMakeLists.txt
index 902987ab64..035f9729b1 100644
--- a/examples/widgets/painting/imagecomposition/CMakeLists.txt
+++ b/examples/widgets/painting/imagecomposition/CMakeLists.txt
@@ -1,46 +1,39 @@
-# Generated from imagecomposition.pro.
-
cmake_minimum_required(VERSION 3.16)
project(imagecomposition LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/painting/imagecomposition")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
qt_add_executable(imagecomposition
imagecomposer.cpp imagecomposer.h
main.cpp
)
+
set_target_properties(imagecomposition PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(imagecomposition PUBLIC
Qt::Core
Qt::Gui
Qt::Widgets
)
-
# Resources:
set(imagecomposition_resource_files
"images/butterfly.png"
"images/checker.png"
)
-qt6_add_resources(imagecomposition "imagecomposition"
+qt_add_resources(imagecomposition "imagecomposition"
PREFIX
"/"
FILES
diff --git a/examples/widgets/painting/painterpaths/CMakeLists.txt b/examples/widgets/painting/painterpaths/CMakeLists.txt
index d26906e2f9..fde9403554 100644
--- a/examples/widgets/painting/painterpaths/CMakeLists.txt
+++ b/examples/widgets/painting/painterpaths/CMakeLists.txt
@@ -1,33 +1,27 @@
-# Generated from painterpaths.pro.
-
cmake_minimum_required(VERSION 3.16)
project(painterpaths LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/painting/painterpaths")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
qt_add_executable(painterpaths
main.cpp
renderarea.cpp renderarea.h
window.cpp window.h
)
+
set_target_properties(painterpaths PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(painterpaths PUBLIC
Qt::Core
Qt::Gui
diff --git a/examples/widgets/painting/pathstroke/.prev_CMakeLists.txt b/examples/widgets/painting/pathstroke/.prev_CMakeLists.txt
deleted file mode 100644
index e2c1d5f793..0000000000
--- a/examples/widgets/painting/pathstroke/.prev_CMakeLists.txt
+++ /dev/null
@@ -1,117 +0,0 @@
-# Generated from pathstroke.pro.
-
-cmake_minimum_required(VERSION 3.14)
-project(pathstroke LANGUAGES CXX)
-
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
-set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
-
-if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
-endif()
-
-set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/painting/pathstroke")
-
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
-
-qt_add_executable(pathstroke
- ../shared/arthurstyle.cpp ../shared/arthurstyle.h
- ../shared/arthurwidgets.cpp ../shared/arthurwidgets.h
- ../shared/hoverpoints.cpp ../shared/hoverpoints.h
- main.cpp
- pathstroke.cpp pathstroke.h
-)
-set_target_properties(pathstroke PROPERTIES
- WIN32_EXECUTABLE TRUE
- MACOSX_BUNDLE TRUE
-)
-target_include_directories(pathstroke PUBLIC
- ../shared
-)
-
-target_link_libraries(pathstroke PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
-)
-
-
-# Resources:
-set(shared_resource_files
- "../shared/images/button_normal_cap_left.png"
- "../shared/images/button_normal_cap_right.png"
- "../shared/images/button_normal_stretch.png"
- "../shared/images/button_pressed_cap_left.png"
- "../shared/images/button_pressed_cap_right.png"
- "../shared/images/button_pressed_stretch.png"
- "../shared/images/frame_bottom.png"
- "../shared/images/frame_bottomleft.png"
- "../shared/images/frame_bottomright.png"
- "../shared/images/frame_left.png"
- "../shared/images/frame_right.png"
- "../shared/images/frame_top.png"
- "../shared/images/frame_topleft.png"
- "../shared/images/frame_topright.png"
- "../shared/images/groupframe_bottom_left.png"
- "../shared/images/groupframe_bottom_right.png"
- "../shared/images/groupframe_bottom_stretch.png"
- "../shared/images/groupframe_left_stretch.png"
- "../shared/images/groupframe_right_stretch.png"
- "../shared/images/groupframe_top_stretch.png"
- "../shared/images/groupframe_topleft.png"
- "../shared/images/groupframe_topright.png"
- "../shared/images/line_dash_dot.png"
- "../shared/images/line_dash_dot_dot.png"
- "../shared/images/line_dashed.png"
- "../shared/images/line_dotted.png"
- "../shared/images/line_solid.png"
- "../shared/images/radiobutton-on.png"
- "../shared/images/radiobutton_off.png"
- "../shared/images/radiobutton_on.png"
- "../shared/images/slider_bar.png"
- "../shared/images/slider_thumb_on.png"
- "../shared/images/title_cap_left.png"
- "../shared/images/title_cap_right.png"
- "../shared/images/title_stretch.png"
-)
-
-qt6_add_resources(pathstroke "shared"
- PREFIX
- "/res"
- BASE
- "../shared"
- FILES
- ${shared_resource_files}
-)
-set(pathstroke_resource_files
- "pathstroke.cpp"
- "pathstroke.html"
-)
-
-qt6_add_resources(pathstroke "pathstroke"
- PREFIX
- "/res/pathstroke"
- FILES
- ${pathstroke_resource_files}
-)
-
-if(QT_FEATURE_opengl)
- target_sources(pathstroke PUBLIC
- ../shared/fbopaintdevice.cpp ../shared/fbopaintdevice.h
- )
-
- target_link_libraries(pathstroke PUBLIC
- Qt::OpenGL
- )
-endif()
-
-install(TARGETS pathstroke
- RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
-)
diff --git a/examples/widgets/painting/pathstroke/CMakeLists.txt b/examples/widgets/painting/pathstroke/CMakeLists.txt
index 2911a0f0e4..4c57495ff8 100644
--- a/examples/widgets/painting/pathstroke/CMakeLists.txt
+++ b/examples/widgets/painting/pathstroke/CMakeLists.txt
@@ -1,56 +1,45 @@
-# Generated from pathstroke.pro.
-
cmake_minimum_required(VERSION 3.16)
project(pathstroke LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/painting/pathstroke")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
qt_add_executable(pathstroke
- # special case begin
# remove files from ../shared
#../shared/arthurstyle.cpp ../shared/arthurstyle.h
#../shared/arthurwidgets.cpp ../shared/arthurwidgets.h
#../shared/hoverpoints.cpp ../shared/hoverpoints.h
- # special case end
main.cpp
pathstroke.cpp pathstroke.h
)
+
set_target_properties(pathstroke PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_include_directories(pathstroke PUBLIC
../shared
)
-# special case begin
if(NOT TARGET painting_shared::painting_shared)
include(../shared/use_lib.cmake)
endif()
-# special case end
target_link_libraries(pathstroke PUBLIC
Qt::Core
Qt::Gui
Qt::Widgets
- painting_shared::painting_shared # special case
+ painting_shared::painting_shared
)
-
# Resources:
set(shared_resource_files
"../shared/images/button_normal_cap_left.png"
@@ -90,7 +79,7 @@ set(shared_resource_files
"../shared/images/title_stretch.png"
)
-qt6_add_resources(pathstroke "shared"
+qt_add_resources(pathstroke "shared"
PREFIX
"/res"
BASE
@@ -98,19 +87,19 @@ qt6_add_resources(pathstroke "shared"
FILES
${shared_resource_files}
)
+
set(pathstroke_resource_files
"pathstroke.cpp"
"pathstroke.html"
)
-qt6_add_resources(pathstroke "pathstroke"
+qt_add_resources(pathstroke "pathstroke"
PREFIX
"/res/pathstroke"
FILES
${pathstroke_resource_files}
)
-# special case begin
# remove files from ../shared
#if(QT_FEATURE_opengl)
#target_sources(affine PUBLIC
@@ -121,7 +110,6 @@ qt6_add_resources(pathstroke "pathstroke"
#Qt::OpenGL
#)
#endif()
-# special case end
install(TARGETS pathstroke
RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
diff --git a/examples/widgets/painting/shared/CMakeLists.txt b/examples/widgets/painting/shared/CMakeLists.txt
index 0fc65d3d99..a81b1413c7 100644
--- a/examples/widgets/painting/shared/CMakeLists.txt
+++ b/examples/widgets/painting/shared/CMakeLists.txt
@@ -1,6 +1,3 @@
-# special case skip regeneration
-# Port of shared.pri to be included by painting examples
-
add_library(painting_shared OBJECT)
add_library(painting_shared::painting_shared ALIAS painting_shared)
qt6_wrap_cpp(moc_files arthurwidgets.h hoverpoints.h) # no automoc for OBJECT libs:-/
@@ -10,6 +7,7 @@ target_sources(painting_shared PRIVATE
hoverpoints.cpp hoverpoints.h
${moc_files}
)
+
target_link_libraries(painting_shared PUBLIC Qt::Widgets)
target_include_directories(painting_shared PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}")
diff --git a/examples/widgets/painting/transformations/CMakeLists.txt b/examples/widgets/painting/transformations/CMakeLists.txt
index c756f77d61..fcf03d1592 100644
--- a/examples/widgets/painting/transformations/CMakeLists.txt
+++ b/examples/widgets/painting/transformations/CMakeLists.txt
@@ -1,33 +1,27 @@
-# Generated from transformations.pro.
-
cmake_minimum_required(VERSION 3.16)
project(transformations LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/painting/transformations")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
qt_add_executable(transformations
main.cpp
renderarea.cpp renderarea.h
window.cpp window.h
)
+
set_target_properties(transformations PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(transformations PUBLIC
Qt::Core
Qt::Gui
diff --git a/examples/widgets/qnx/foreignwindows/collector.cpp b/examples/widgets/qnx/foreignwindows/collector.cpp
index 4b9e774945..f5406da793 100644
--- a/examples/widgets/qnx/foreignwindows/collector.cpp
+++ b/examples/widgets/qnx/foreignwindows/collector.cpp
@@ -63,7 +63,7 @@ Collector::~Collector()
QApplication::instance()->removeNativeEventFilter(this);
}
-bool Collector::nativeEventFilter(const QByteArray &eventType, void *message, long *result)
+bool Collector::nativeEventFilter(const QByteArray &eventType, void *message, qintptr *result)
{
Q_UNUSED(result);
diff --git a/examples/widgets/qnx/foreignwindows/collector.h b/examples/widgets/qnx/foreignwindows/collector.h
index 7c0b2e5cb6..1675099437 100644
--- a/examples/widgets/qnx/foreignwindows/collector.h
+++ b/examples/widgets/qnx/foreignwindows/collector.h
@@ -52,7 +52,7 @@ public:
explicit Collector(QWidget *parent = nullptr);
~Collector() override;
- bool nativeEventFilter(const QByteArray &eventType, void *message, long *result) override;
+ bool nativeEventFilter(const QByteArray &eventType, void *message, qintptr *result) override;
private:
struct Collectible
diff --git a/examples/widgets/richtext/CMakeLists.txt b/examples/widgets/richtext/CMakeLists.txt
index 86bbcccea5..cb49c61fa6 100644
--- a/examples/widgets/richtext/CMakeLists.txt
+++ b/examples/widgets/richtext/CMakeLists.txt
@@ -1,5 +1,3 @@
-# Generated from richtext.pro.
-
qt_internal_add_example(calendar)
qt_internal_add_example(orderform)
qt_internal_add_example(syntaxhighlighter)
diff --git a/examples/widgets/richtext/calendar/CMakeLists.txt b/examples/widgets/richtext/calendar/CMakeLists.txt
index 5846020183..8e75bcf83f 100644
--- a/examples/widgets/richtext/calendar/CMakeLists.txt
+++ b/examples/widgets/richtext/calendar/CMakeLists.txt
@@ -1,32 +1,26 @@
-# Generated from calendar.pro.
-
cmake_minimum_required(VERSION 3.16)
project(calendar LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/richtext/calendar")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
qt_add_executable(calendar
main.cpp
mainwindow.cpp mainwindow.h
)
+
set_target_properties(calendar PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(calendar PUBLIC
Qt::Core
Qt::Gui
diff --git a/examples/widgets/richtext/orderform/CMakeLists.txt b/examples/widgets/richtext/orderform/CMakeLists.txt
index 6903348223..28e9d92880 100644
--- a/examples/widgets/richtext/orderform/CMakeLists.txt
+++ b/examples/widgets/richtext/orderform/CMakeLists.txt
@@ -1,33 +1,27 @@
-# Generated from orderform.pro.
-
cmake_minimum_required(VERSION 3.16)
project(orderform LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/richtext/orderform")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
qt_add_executable(orderform
detailsdialog.cpp detailsdialog.h
main.cpp
mainwindow.cpp mainwindow.h
)
+
set_target_properties(orderform PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(orderform PUBLIC
Qt::Core
Qt::Gui
diff --git a/examples/widgets/richtext/syntaxhighlighter/CMakeLists.txt b/examples/widgets/richtext/syntaxhighlighter/CMakeLists.txt
index 3e288b1a25..4ec2cc8ee3 100644
--- a/examples/widgets/richtext/syntaxhighlighter/CMakeLists.txt
+++ b/examples/widgets/richtext/syntaxhighlighter/CMakeLists.txt
@@ -1,33 +1,27 @@
-# Generated from syntaxhighlighter.pro.
-
cmake_minimum_required(VERSION 3.16)
project(syntaxhighlighter LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/richtext/syntaxhighlighter")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
qt_add_executable(syntaxhighlighter
highlighter.cpp highlighter.h
main.cpp
mainwindow.cpp mainwindow.h
)
+
set_target_properties(syntaxhighlighter PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(syntaxhighlighter PUBLIC
Qt::Core
Qt::Gui
diff --git a/examples/widgets/richtext/textedit/.prev_CMakeLists.txt b/examples/widgets/richtext/textedit/.prev_CMakeLists.txt
deleted file mode 100644
index c32496a98b..0000000000
--- a/examples/widgets/richtext/textedit/.prev_CMakeLists.txt
+++ /dev/null
@@ -1,108 +0,0 @@
-# Generated from textedit.pro.
-
-cmake_minimum_required(VERSION 3.14)
-project(textedit LANGUAGES CXX)
-
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
-set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
-
-if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
-endif()
-
-set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/richtext/textedit")
-
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
-
-qt_add_executable(textedit
- main.cpp
- textedit.cpp textedit.h
-)
-set_target_properties(textedit PROPERTIES
- WIN32_EXECUTABLE TRUE
- MACOSX_BUNDLE TRUE
-)
-target_link_libraries(textedit PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
-)
-
-
-# Resources:
-set(textedit_resource_files
- "example.html"
- "images/logo32.png"
- "images/mac/checkbox-checked.png"
- "images/mac/checkbox.png"
- "images/mac/editcopy.png"
- "images/mac/editcut.png"
- "images/mac/editpaste.png"
- "images/mac/editredo.png"
- "images/mac/editundo.png"
- "images/mac/exportpdf.png"
- "images/mac/filenew.png"
- "images/mac/fileopen.png"
- "images/mac/fileprint.png"
- "images/mac/filesave.png"
- "images/mac/format-indent-less.png"
- "images/mac/format-indent-more.png"
- "images/mac/textbold.png"
- "images/mac/textcenter.png"
- "images/mac/textitalic.png"
- "images/mac/textjustify.png"
- "images/mac/textleft.png"
- "images/mac/textright.png"
- "images/mac/textunder.png"
- "images/mac/textundercolor.png"
- "images/mac/zoomin.png"
- "images/mac/zoomout.png"
- "images/win/checkbox-checked.png"
- "images/win/checkbox.png"
- "images/win/editcopy.png"
- "images/win/editcut.png"
- "images/win/editpaste.png"
- "images/win/editredo.png"
- "images/win/editundo.png"
- "images/win/exportpdf.png"
- "images/win/filenew.png"
- "images/win/fileopen.png"
- "images/win/fileprint.png"
- "images/win/filesave.png"
- "images/win/format-indent-less.png"
- "images/win/format-indent-more.png"
- "images/win/textbold.png"
- "images/win/textcenter.png"
- "images/win/textitalic.png"
- "images/win/textjustify.png"
- "images/win/textleft.png"
- "images/win/textright.png"
- "images/win/textunder.png"
- "images/win/textundercolor.png"
- "images/win/zoomin.png"
- "images/win/zoomout.png"
-)
-
-qt6_add_resources(textedit "textedit"
- PREFIX
- "/"
- FILES
- ${textedit_resource_files}
-)
-
-if(TARGET Qt::PrintSupport)
- target_link_libraries(textedit PUBLIC
- Qt::PrintSupport
- )
-endif()
-
-install(TARGETS textedit
- RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
-)
diff --git a/examples/widgets/richtext/textedit/CMakeLists.txt b/examples/widgets/richtext/textedit/CMakeLists.txt
index a94f50d988..f4d48a25eb 100644
--- a/examples/widgets/richtext/textedit/CMakeLists.txt
+++ b/examples/widgets/richtext/textedit/CMakeLists.txt
@@ -1,44 +1,38 @@
-# Generated from textedit.pro.
-
cmake_minimum_required(VERSION 3.16)
project(textedit LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/richtext/textedit")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
-find_package(Qt6 COMPONENTS PrintSupport) # special case
+find_package(Qt6
+ REQUIRED COMPONENTS Core Gui Widgets
+ OPTIONAL_COMPONENTS PrintSupport
+)
qt_add_executable(textedit
main.cpp
textedit.cpp textedit.h
)
+
set_target_properties(textedit PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(textedit PUBLIC
Qt::Core
Qt::Gui
Qt::Widgets
)
-# special case begin
+
if (TARGET Qt::PrintSupport)
target_link_libraries(textedit PUBLIC Qt::PrintSupport)
endif()
-# special case end
-
# Resources:
set(textedit_resource_files
@@ -94,7 +88,7 @@ set(textedit_resource_files
"images/win/zoomout.png"
)
-qt6_add_resources(textedit "textedit"
+qt_add_resources(textedit "textedit"
PREFIX
"/"
FILES
diff --git a/examples/widgets/scroller/CMakeLists.txt b/examples/widgets/scroller/CMakeLists.txt
index 37ee7ea08f..fb9ebc2848 100644
--- a/examples/widgets/scroller/CMakeLists.txt
+++ b/examples/widgets/scroller/CMakeLists.txt
@@ -1,3 +1 @@
-# Generated from scroller.pro.
-
qt_internal_add_example(graphicsview)
diff --git a/examples/widgets/scroller/graphicsview/CMakeLists.txt b/examples/widgets/scroller/graphicsview/CMakeLists.txt
index 5efa7f94ca..7316cfdfd6 100644
--- a/examples/widgets/scroller/graphicsview/CMakeLists.txt
+++ b/examples/widgets/scroller/graphicsview/CMakeLists.txt
@@ -1,31 +1,25 @@
-# Generated from graphicsview.pro.
-
cmake_minimum_required(VERSION 3.16)
project(graphicsview LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/scroller/graphicsview")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
qt_add_executable(graphicsview
main.cpp
)
+
set_target_properties(graphicsview PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(graphicsview PUBLIC
Qt::Core
Qt::Gui
diff --git a/examples/widgets/tools/.prev_CMakeLists.txt b/examples/widgets/tools/.prev_CMakeLists.txt
deleted file mode 100644
index 29e7f8f9e8..0000000000
--- a/examples/widgets/tools/.prev_CMakeLists.txt
+++ /dev/null
@@ -1,17 +0,0 @@
-# Generated from tools.pro.
-
-add_subdirectory(completer)
-add_subdirectory(customcompleter)
-add_subdirectory(regularexpression)
-add_subdirectory(settingseditor)
-add_subdirectory(styleplugin)
-add_subdirectory(treemodelcompleter)
-add_subdirectory(undo)
-add_subdirectory(undoframework)
-if(QT_FEATURE_library)
- add_subdirectory(echoplugin)
- add_subdirectory(plugandpaint)
-endif()
-if(QT_FEATURE_translation)
- add_subdirectory(i18n)
-endif()
diff --git a/examples/widgets/tools/CMakeLists.txt b/examples/widgets/tools/CMakeLists.txt
index 0056518f1e..79c231e9be 100644
--- a/examples/widgets/tools/CMakeLists.txt
+++ b/examples/widgets/tools/CMakeLists.txt
@@ -1,8 +1,6 @@
-# Generated from tools.pro.
-
qt_internal_add_example(completer)
qt_internal_add_example(customcompleter)
-if(QT_FEATURE_translation) # special case
+if(QT_FEATURE_translation)
qt_internal_add_example(i18n)
endif()
qt_internal_add_example(regularexpression)
@@ -12,11 +10,10 @@ qt_internal_add_example(treemodelcompleter)
qt_internal_add_example(undo)
qt_internal_add_example(undoframework)
-if(QT_FEATURE_library) # special case
- add_subdirectory(echoplugin)
- # special case begin
+if(QT_FEATURE_library)
+ qt_internal_add_example(echoplugin)
+
if(QT_FEATURE_inputdialog)
qt_internal_add_example(plugandpaint)
endif()
- # special case end
endif()
diff --git a/examples/widgets/tools/completer/CMakeLists.txt b/examples/widgets/tools/completer/CMakeLists.txt
index e03092543e..1224984b11 100644
--- a/examples/widgets/tools/completer/CMakeLists.txt
+++ b/examples/widgets/tools/completer/CMakeLists.txt
@@ -1,47 +1,40 @@
-# Generated from completer.pro.
-
cmake_minimum_required(VERSION 3.16)
project(completer LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/tools/completer")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
qt_add_executable(completer
fsmodel.cpp fsmodel.h
main.cpp
mainwindow.cpp mainwindow.h
)
+
set_target_properties(completer PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(completer PUBLIC
Qt::Core
Qt::Gui
Qt::Widgets
)
-
# Resources:
set(completer_resource_files
"resources/countries.txt"
"resources/wordlist.txt"
)
-qt6_add_resources(completer "completer"
+qt_add_resources(completer "completer"
PREFIX
"/"
FILES
diff --git a/examples/widgets/tools/customcompleter/CMakeLists.txt b/examples/widgets/tools/customcompleter/CMakeLists.txt
index c725f85336..a32870b047 100644
--- a/examples/widgets/tools/customcompleter/CMakeLists.txt
+++ b/examples/widgets/tools/customcompleter/CMakeLists.txt
@@ -1,46 +1,39 @@
-# Generated from customcompleter.pro.
-
cmake_minimum_required(VERSION 3.16)
project(customcompleter LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/tools/customcompleter")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
qt_add_executable(customcompleter
main.cpp
mainwindow.cpp mainwindow.h
textedit.cpp textedit.h
)
+
set_target_properties(customcompleter PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(customcompleter PUBLIC
Qt::Core
Qt::Gui
Qt::Widgets
)
-
# Resources:
set(customcompleter_resource_files
"resources/wordlist.txt"
)
-qt6_add_resources(customcompleter "customcompleter"
+qt_add_resources(customcompleter "customcompleter"
PREFIX
"/"
FILES
diff --git a/examples/widgets/tools/echoplugin/CMakeLists.txt b/examples/widgets/tools/echoplugin/CMakeLists.txt
index 6e32a4de09..93b49b43d7 100644
--- a/examples/widgets/tools/echoplugin/CMakeLists.txt
+++ b/examples/widgets/tools/echoplugin/CMakeLists.txt
@@ -1,7 +1,7 @@
cmake_minimum_required(VERSION 3.16)
project(plugandpaint LANGUAGES CXX)
-find_package(Qt6 COMPONENTS Core Gui Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
set(CMAKE_AUTOMOC ON)
diff --git a/examples/widgets/tools/echoplugin/echowindow/.prev_CMakeLists.txt b/examples/widgets/tools/echoplugin/echowindow/.prev_CMakeLists.txt
deleted file mode 100644
index 1262ce5452..0000000000
--- a/examples/widgets/tools/echoplugin/echowindow/.prev_CMakeLists.txt
+++ /dev/null
@@ -1,41 +0,0 @@
-# Generated from echowindow.pro.
-
-cmake_minimum_required(VERSION 3.14)
-project(echoplugin LANGUAGES CXX)
-
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
-set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
-
-if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
-endif()
-
-set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/tools/echoplugin")
-
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
-
-qt_add_executable(echoplugin
- echointerface.h
- echowindow.cpp echowindow.h
- main.cpp
-)
-set_target_properties(echoplugin PROPERTIES
- WIN32_EXECUTABLE TRUE
- MACOSX_BUNDLE TRUE
-)
-target_link_libraries(echoplugin PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
-)
-
-install(TARGETS echoplugin
- RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
-)
diff --git a/examples/widgets/tools/echoplugin/echowindow/CMakeLists.txt b/examples/widgets/tools/echoplugin/echowindow/CMakeLists.txt
index 3fcbe17172..29183a7c1f 100644
--- a/examples/widgets/tools/echoplugin/echowindow/CMakeLists.txt
+++ b/examples/widgets/tools/echoplugin/echowindow/CMakeLists.txt
@@ -3,10 +3,12 @@ qt_add_executable(echopluginwindow
echowindow.cpp echowindow.h
main.cpp
)
+
set_target_properties(echopluginwindow PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(echopluginwindow PRIVATE
Qt::Core
Qt::Gui
diff --git a/examples/widgets/tools/echoplugin/plugin/.prev_CMakeLists.txt b/examples/widgets/tools/echoplugin/plugin/.prev_CMakeLists.txt
deleted file mode 100644
index 9f3a93b3bd..0000000000
--- a/examples/widgets/tools/echoplugin/plugin/.prev_CMakeLists.txt
+++ /dev/null
@@ -1,35 +0,0 @@
-# Generated from plugin.pro.
-
-cmake_minimum_required(VERSION 3.14)
-project(echoplugin LANGUAGES CXX)
-
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
-set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
-
-set(INSTALL_EXAMPLEDIR "examples/widgets/tools/echoplugin/plugins")
-
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
-
-add_library(echoplugin MODULE
- echoplugin.cpp echoplugin.h
-)
-target_include_directories(echoplugin PUBLIC
- ../echowindow
-)
-
-target_link_libraries(echoplugin PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
-)
-
-install(TARGETS echoplugin
- RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
-)
diff --git a/examples/widgets/tools/echoplugin/plugin/CMakeLists.txt b/examples/widgets/tools/echoplugin/plugin/CMakeLists.txt
index fb727aa1d7..7d63180a87 100644
--- a/examples/widgets/tools/echoplugin/plugin/CMakeLists.txt
+++ b/examples/widgets/tools/echoplugin/plugin/CMakeLists.txt
@@ -1,12 +1,15 @@
qt_add_plugin(echoplugin
CLASS_NAME EchoPlugin
)
+
target_sources(echoplugin PRIVATE
echoplugin.cpp echoplugin.h
)
+
set_target_properties(echoplugin PROPERTIES
LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/echowindow"
)
+
target_include_directories(echoplugin PUBLIC
../echowindow
)
diff --git a/examples/widgets/tools/i18n/CMakeLists.txt b/examples/widgets/tools/i18n/CMakeLists.txt
index 4ff9402dec..ba357aa312 100644
--- a/examples/widgets/tools/i18n/CMakeLists.txt
+++ b/examples/widgets/tools/i18n/CMakeLists.txt
@@ -1,40 +1,33 @@
-# Generated from i18n.pro.
-
cmake_minimum_required(VERSION 3.16)
project(i18n LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/tools/i18n")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
+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"
@@ -53,7 +46,7 @@ set(i18n_resource_files
"translations/i18n_zh.qm"
)
-qt6_add_resources(i18n "i18n"
+qt_add_resources(i18n "i18n"
PREFIX
"/"
FILES
diff --git a/examples/widgets/tools/plugandpaint/CMakeLists.txt b/examples/widgets/tools/plugandpaint/CMakeLists.txt
index e681812dad..54cb83fd89 100644
--- a/examples/widgets/tools/plugandpaint/CMakeLists.txt
+++ b/examples/widgets/tools/plugandpaint/CMakeLists.txt
@@ -1,11 +1,9 @@
cmake_minimum_required(VERSION 3.16)
project(plugandpaint LANGUAGES CXX)
-find_package(Qt6 COMPONENTS Core Gui Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
set(INSTALL_EXAMPLESDIR "examples")
diff --git a/examples/widgets/tools/plugandpaint/app/.prev_CMakeLists.txt b/examples/widgets/tools/plugandpaint/app/.prev_CMakeLists.txt
deleted file mode 100644
index feaac7ad8f..0000000000
--- a/examples/widgets/tools/plugandpaint/app/.prev_CMakeLists.txt
+++ /dev/null
@@ -1,74 +0,0 @@
-# Generated from app.pro.
-
-cmake_minimum_required(VERSION 3.14)
-project(plugandpaint LANGUAGES CXX)
-
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
-set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
-
-if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
-endif()
-
-set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/tools/plugandpaint")
-
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
-
-qt_add_executable(plugandpaint
- interfaces.h
- main.cpp
- mainwindow.cpp mainwindow.h
- paintarea.cpp paintarea.h
- plugindialog.cpp plugindialog.h
-)
-set_target_properties(plugandpaint PROPERTIES
- WIN32_EXECUTABLE TRUE
- MACOSX_BUNDLE TRUE
-)
-target_link_libraries(plugandpaint PUBLIC
- # Remove: L../plugins
- Qt::Core
- Qt::Gui
- Qt::Widgets
-)
-
-if(macx-xcode)
- target_link_libraries(plugandpaint PUBLIC
- (
- )
- pnp_basictools$
- )
-endif()
-
-if(NOT macx-xcode)
- target_link_libraries(plugandpaint PUBLIC
- pnp_basictools
- )
-endif()
-
-if(((NOT (macx-xcode)) AND (( NOT debug_and_release OR build_pass ) AND CONFIG(debug,debug OR release))) AND (APPLE))
- target_link_libraries(plugandpaint PUBLIC
- (LIBS, 0)
- (LIBS, 1)
- _debug
- )
-endif()
-
-if(((NOT (macx-xcode)) AND (( NOT debug_and_release OR build_pass ) AND CONFIG(debug,debug OR release))) AND (WIN32))
- target_link_libraries(plugandpaint PUBLIC
- (LIBS, 0)
- (LIBS, 1)
- d
- )
-endif()
-
-install(TARGETS plugandpaint
- RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
-)
diff --git a/examples/widgets/tools/plugandpaint/app/CMakeLists.txt b/examples/widgets/tools/plugandpaint/app/CMakeLists.txt
index 3e46331f81..f2b5b4937f 100644
--- a/examples/widgets/tools/plugandpaint/app/CMakeLists.txt
+++ b/examples/widgets/tools/plugandpaint/app/CMakeLists.txt
@@ -5,10 +5,12 @@ qt_add_executable(plugandpaint
paintarea.cpp paintarea.h
plugindialog.cpp plugindialog.h
)
+
set_target_properties(plugandpaint PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(plugandpaint PRIVATE
Qt::Widgets
pnp_basictools
diff --git a/examples/widgets/tools/plugandpaint/plugins/basictools/.prev_CMakeLists.txt b/examples/widgets/tools/plugandpaint/plugins/basictools/.prev_CMakeLists.txt
deleted file mode 100644
index 76474c282b..0000000000
--- a/examples/widgets/tools/plugandpaint/plugins/basictools/.prev_CMakeLists.txt
+++ /dev/null
@@ -1,36 +0,0 @@
-# Generated from basictools.pro.
-
-cmake_minimum_required(VERSION 3.14)
-project(pnp_basictools LANGUAGES CXX)
-
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
-set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
-
-set(INSTALL_EXAMPLEDIR "examples/widgets/tools/plugandpaint/plugins")
-
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
-
-qt6_add_plugin(pnp_basictools STATIC)
-target_sources(pnp_basictools PRIVATE
- basictoolsplugin.cpp basictoolsplugin.h
-)
-target_include_directories(pnp_basictools PUBLIC
- ../../app
-)
-
-target_link_libraries(pnp_basictools PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
-)
-
-install(TARGETS pnp_basictools
- RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
-)
diff --git a/examples/widgets/tools/plugandpaint/plugins/basictools/CMakeLists.txt b/examples/widgets/tools/plugandpaint/plugins/basictools/CMakeLists.txt
index 0056205319..638bb53ef6 100644
--- a/examples/widgets/tools/plugandpaint/plugins/basictools/CMakeLists.txt
+++ b/examples/widgets/tools/plugandpaint/plugins/basictools/CMakeLists.txt
@@ -2,9 +2,11 @@ qt_add_plugin(pnp_basictools
STATIC
CLASS_NAME BasicToolsPlugin
)
+
target_sources(pnp_basictools PRIVATE
basictoolsplugin.cpp basictoolsplugin.h
)
+
target_include_directories(pnp_basictools PUBLIC
../../app
)
diff --git a/examples/widgets/tools/plugandpaint/plugins/extrafilters/.prev_CMakeLists.txt b/examples/widgets/tools/plugandpaint/plugins/extrafilters/.prev_CMakeLists.txt
deleted file mode 100644
index 57f37843b8..0000000000
--- a/examples/widgets/tools/plugandpaint/plugins/extrafilters/.prev_CMakeLists.txt
+++ /dev/null
@@ -1,36 +0,0 @@
-# Generated from extrafilters.pro.
-
-cmake_minimum_required(VERSION 3.14)
-project(pnp_extrafilters LANGUAGES CXX)
-
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
-set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
-
-set(INSTALL_EXAMPLEDIR "examples/widgets/tools/plugandpaint/plugins")
-
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
-
-qt_add_plugin(pnp_extrafilters)
-target_sources(pnp_extrafilters PRIVATE
- extrafiltersplugin.cpp extrafiltersplugin.h
-)
-target_include_directories(pnp_extrafilters PUBLIC
- ../../app
-)
-
-target_link_libraries(pnp_extrafilters PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
-)
-
-install(TARGETS pnp_extrafilters
- RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
-)
diff --git a/examples/widgets/tools/plugandpaint/plugins/extrafilters/CMakeLists.txt b/examples/widgets/tools/plugandpaint/plugins/extrafilters/CMakeLists.txt
index 2332f84399..4a3dd45de9 100644
--- a/examples/widgets/tools/plugandpaint/plugins/extrafilters/CMakeLists.txt
+++ b/examples/widgets/tools/plugandpaint/plugins/extrafilters/CMakeLists.txt
@@ -1,12 +1,15 @@
qt_add_plugin(pnp_extrafilters
CLASS_NAME ExtraFiltersPlugin
)
+
target_sources(pnp_extrafilters PRIVATE
extrafiltersplugin.cpp extrafiltersplugin.h
)
+
set_target_properties(pnp_extrafilters PROPERTIES
LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/app"
)
+
target_include_directories(pnp_extrafilters PUBLIC
../../app
)
diff --git a/examples/widgets/tools/regularexpression/CMakeLists.txt b/examples/widgets/tools/regularexpression/CMakeLists.txt
index 26865e5179..4675f251a4 100644
--- a/examples/widgets/tools/regularexpression/CMakeLists.txt
+++ b/examples/widgets/tools/regularexpression/CMakeLists.txt
@@ -1,45 +1,38 @@
-# Generated from regularexpression.pro.
-
cmake_minimum_required(VERSION 3.16)
project(regularexpression LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/tools/regularexpression")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
qt_add_executable(regularexpression
main.cpp
regularexpressiondialog.cpp regularexpressiondialog.h
)
+
set_target_properties(regularexpression PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(regularexpression PUBLIC
Qt::Core
Qt::Gui
Qt::Widgets
)
-
# Resources:
set(regularexpression_resource_files
"images/copy.png"
)
-qt6_add_resources(regularexpression "regularexpression"
+qt_add_resources(regularexpression "regularexpression"
PREFIX
"/"
FILES
diff --git a/examples/widgets/tools/settingseditor/CMakeLists.txt b/examples/widgets/tools/settingseditor/CMakeLists.txt
index fc050b5f76..f72dc7c912 100644
--- a/examples/widgets/tools/settingseditor/CMakeLists.txt
+++ b/examples/widgets/tools/settingseditor/CMakeLists.txt
@@ -1,23 +1,15 @@
-# Generated from settingseditor.pro.
-
cmake_minimum_required(VERSION 3.16)
project(settingseditor LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/tools/settingseditor")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
qt_add_executable(settingseditor
locationdialog.cpp locationdialog.h
@@ -26,10 +18,12 @@ qt_add_executable(settingseditor
settingstree.cpp settingstree.h
variantdelegate.cpp variantdelegate.h
)
+
set_target_properties(settingseditor PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(settingseditor PUBLIC
Qt::Core
Qt::Gui
diff --git a/examples/widgets/tools/styleplugin/.prev_CMakeLists.txt b/examples/widgets/tools/styleplugin/.prev_CMakeLists.txt
deleted file mode 100644
index 630c3703f8..0000000000
--- a/examples/widgets/tools/styleplugin/.prev_CMakeLists.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-# Generated from styleplugin.pro.
-
-add_subdirectory(stylewindow)
-add_subdirectory(plugin)
diff --git a/examples/widgets/tools/styleplugin/CMakeLists.txt b/examples/widgets/tools/styleplugin/CMakeLists.txt
index 33412f5306..acd918786d 100644
--- a/examples/widgets/tools/styleplugin/CMakeLists.txt
+++ b/examples/widgets/tools/styleplugin/CMakeLists.txt
@@ -1,7 +1,7 @@
cmake_minimum_required(VERSION 3.16)
project(styleplugin LANGUAGES CXX)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Widgets)
set(CMAKE_AUTOMOC ON)
diff --git a/examples/widgets/tools/styleplugin/plugin/.prev_CMakeLists.txt b/examples/widgets/tools/styleplugin/plugin/.prev_CMakeLists.txt
deleted file mode 100644
index c1be706fde..0000000000
--- a/examples/widgets/tools/styleplugin/plugin/.prev_CMakeLists.txt
+++ /dev/null
@@ -1,32 +0,0 @@
-# Generated from plugin.pro.
-
-cmake_minimum_required(VERSION 3.14)
-project(simplestyleplugin LANGUAGES CXX)
-
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
-set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
-
-set(INSTALL_EXAMPLEDIR "examples/widgets/tools/styleplugin/styles")
-
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
-
-add_library(simplestyleplugin MODULE
- simplestyle.cpp simplestyle.h
- simplestyleplugin.cpp simplestyleplugin.h
-)
-target_link_libraries(simplestyleplugin PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
-)
-
-install(TARGETS simplestyleplugin
- RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
-)
diff --git a/examples/widgets/tools/styleplugin/plugin/CMakeLists.txt b/examples/widgets/tools/styleplugin/plugin/CMakeLists.txt
index 30a06231c1..fb2b877ca6 100644
--- a/examples/widgets/tools/styleplugin/plugin/CMakeLists.txt
+++ b/examples/widgets/tools/styleplugin/plugin/CMakeLists.txt
@@ -1,13 +1,16 @@
qt_add_plugin(simplestyleplugin
CLASS_NAME SimpleStylePlugin
)
+
target_sources(simplestyleplugin PRIVATE
simplestyle.cpp simplestyle.h
simplestyleplugin.cpp simplestyleplugin.h
)
+
set_target_properties(simplestyleplugin PROPERTIES
LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/stylewindow/styles"
)
+
target_link_libraries(simplestyleplugin PRIVATE
Qt::Core
Qt::Gui
diff --git a/examples/widgets/tools/styleplugin/stylewindow/CMakeLists.txt b/examples/widgets/tools/styleplugin/stylewindow/CMakeLists.txt
index aab63afbf2..fe844aaf4b 100644
--- a/examples/widgets/tools/styleplugin/stylewindow/CMakeLists.txt
+++ b/examples/widgets/tools/styleplugin/stylewindow/CMakeLists.txt
@@ -2,15 +2,18 @@ qt_add_executable(styleplugin
main.cpp
stylewindow.cpp stylewindow.h
)
+
set_target_properties(styleplugin PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(styleplugin PRIVATE
Qt::Core
Qt::Gui
Qt::Widgets
)
+
if(NOT QT6_IS_SHARED_LIBS_BUILD)
target_link_libraries(styleplugin PRIVATE
simplestyleplugin
diff --git a/examples/widgets/tools/treemodelcompleter/CMakeLists.txt b/examples/widgets/tools/treemodelcompleter/CMakeLists.txt
index 92ec0f7944..11279629d8 100644
--- a/examples/widgets/tools/treemodelcompleter/CMakeLists.txt
+++ b/examples/widgets/tools/treemodelcompleter/CMakeLists.txt
@@ -1,46 +1,39 @@
-# Generated from treemodelcompleter.pro.
-
cmake_minimum_required(VERSION 3.16)
project(treemodelcompleter LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/tools/treemodelcompleter")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
qt_add_executable(treemodelcompleter
main.cpp
mainwindow.cpp mainwindow.h
treemodelcompleter.cpp treemodelcompleter.h
)
+
set_target_properties(treemodelcompleter PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(treemodelcompleter PUBLIC
Qt::Core
Qt::Gui
Qt::Widgets
)
-
# Resources:
set(treemodelcompleter_resource_files
"resources/treemodel.txt"
)
-qt6_add_resources(treemodelcompleter "treemodelcompleter"
+qt_add_resources(treemodelcompleter "treemodelcompleter"
PREFIX
"/"
FILES
diff --git a/examples/widgets/tools/undo/CMakeLists.txt b/examples/widgets/tools/undo/CMakeLists.txt
index 94e63a665c..6f3e2781b7 100644
--- a/examples/widgets/tools/undo/CMakeLists.txt
+++ b/examples/widgets/tools/undo/CMakeLists.txt
@@ -1,23 +1,18 @@
-# Generated from undo.pro.
-
cmake_minimum_required(VERSION 3.16)
project(undo LANGUAGES CXX)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/tools/undo")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
qt_add_executable(undo
commands.cpp commands.h
@@ -25,17 +20,18 @@ qt_add_executable(undo
main.cpp
mainwindow.cpp mainwindow.h mainwindow.ui
)
+
set_target_properties(undo PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(undo PUBLIC
Qt::Core
Qt::Gui
Qt::Widgets
)
-
# Resources:
set(undo_resource_files
"icons/background.png"
@@ -56,7 +52,7 @@ set(undo_resource_files
"icons/undo.png"
)
-qt6_add_resources(undo "undo"
+qt_add_resources(undo "undo"
PREFIX
"/"
FILES
diff --git a/examples/widgets/tools/undoframework/CMakeLists.txt b/examples/widgets/tools/undoframework/CMakeLists.txt
index a315ab46d6..ff222a1a8b 100644
--- a/examples/widgets/tools/undoframework/CMakeLists.txt
+++ b/examples/widgets/tools/undoframework/CMakeLists.txt
@@ -1,23 +1,15 @@
-# Generated from undoframework.pro.
-
cmake_minimum_required(VERSION 3.16)
project(undoframework LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/tools/undoframework")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
qt_add_executable(undoframework
commands.cpp commands.h
@@ -26,23 +18,24 @@ qt_add_executable(undoframework
main.cpp
mainwindow.cpp mainwindow.h
)
+
set_target_properties(undoframework PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(undoframework PUBLIC
Qt::Core
Qt::Gui
Qt::Widgets
)
-
# Resources:
set(undoframework_resource_files
"images/cross.png"
)
-qt6_add_resources(undoframework "undoframework"
+qt_add_resources(undoframework "undoframework"
PREFIX
"/"
FILES
diff --git a/examples/widgets/touch/CMakeLists.txt b/examples/widgets/touch/CMakeLists.txt
index ca6ef7fcb8..96d46484b6 100644
--- a/examples/widgets/touch/CMakeLists.txt
+++ b/examples/widgets/touch/CMakeLists.txt
@@ -1,5 +1,3 @@
-# Generated from touch.pro.
-
if(NOT TARGET Qt::Widgets)
return()
endif()
diff --git a/examples/widgets/touch/dials/CMakeLists.txt b/examples/widgets/touch/dials/CMakeLists.txt
index dcfb3a9194..c20ce4ac4a 100644
--- a/examples/widgets/touch/dials/CMakeLists.txt
+++ b/examples/widgets/touch/dials/CMakeLists.txt
@@ -1,32 +1,27 @@
-# Generated from dials.pro.
-
cmake_minimum_required(VERSION 3.16)
project(dials LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/touch/dials")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
qt_add_executable(dials
dials.ui
main.cpp
)
+
set_target_properties(dials PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(dials PUBLIC
Qt::Core
Qt::Gui
diff --git a/examples/widgets/touch/fingerpaint/.prev_CMakeLists.txt b/examples/widgets/touch/fingerpaint/.prev_CMakeLists.txt
deleted file mode 100644
index 3077bf5bc6..0000000000
--- a/examples/widgets/touch/fingerpaint/.prev_CMakeLists.txt
+++ /dev/null
@@ -1,47 +0,0 @@
-# Generated from fingerpaint.pro.
-
-cmake_minimum_required(VERSION 3.14)
-project(fingerpaint LANGUAGES CXX)
-
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
-set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
-
-if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
-endif()
-
-set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/touch/fingerpaint")
-
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
-
-qt_add_executable(fingerpaint
- main.cpp
- mainwindow.cpp mainwindow.h
- scribblearea.cpp scribblearea.h
-)
-set_target_properties(fingerpaint PROPERTIES
- WIN32_EXECUTABLE TRUE
- MACOSX_BUNDLE TRUE
-)
-target_link_libraries(fingerpaint PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
-)
-
-if(TARGET Qt::PrintSupport)
- target_link_libraries(fingerpaint PUBLIC
- Qt::PrintSupport
- )
-endif()
-
-install(TARGETS fingerpaint
- RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
-)
diff --git a/examples/widgets/touch/fingerpaint/CMakeLists.txt b/examples/widgets/touch/fingerpaint/CMakeLists.txt
index 12e96173cf..72697951c4 100644
--- a/examples/widgets/touch/fingerpaint/CMakeLists.txt
+++ b/examples/widgets/touch/fingerpaint/CMakeLists.txt
@@ -1,44 +1,39 @@
-# Generated from fingerpaint.pro.
-
cmake_minimum_required(VERSION 3.16)
project(fingerpaint LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/touch/fingerpaint")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
-find_package(Qt6 COMPONENTS PrintSupport) # special case
+find_package(Qt6
+ REQUIRED COMPONENTS Core Gui Widgets
+ OPTIONAL_COMPONENTS PrintSupport
+)
qt_add_executable(fingerpaint
main.cpp
mainwindow.cpp mainwindow.h
scribblearea.cpp scribblearea.h
)
+
set_target_properties(fingerpaint PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(fingerpaint PUBLIC
Qt::Core
Qt::Gui
Qt::Widgets
)
-# special case begin
+
if (TARGET Qt::PrintSupport)
target_link_libraries(fingerpaint PUBLIC Qt::PrintSupport)
endif()
-# special case end
if(TARGET Qt::PrintSupport)
target_link_libraries(fingerpaint PUBLIC
diff --git a/examples/widgets/touch/knobs/CMakeLists.txt b/examples/widgets/touch/knobs/CMakeLists.txt
index a3b118a7ef..399ffe8127 100644
--- a/examples/widgets/touch/knobs/CMakeLists.txt
+++ b/examples/widgets/touch/knobs/CMakeLists.txt
@@ -1,32 +1,26 @@
-# Generated from knobs.pro.
-
cmake_minimum_required(VERSION 3.16)
project(knobs LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/touch/knobs")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
qt_add_executable(knobs
knob.cpp knob.h
main.cpp
)
+
set_target_properties(knobs PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(knobs PUBLIC
Qt::Core
Qt::Gui
diff --git a/examples/widgets/touch/pinchzoom/CMakeLists.txt b/examples/widgets/touch/pinchzoom/CMakeLists.txt
index 6efbf831ec..ecfbb3d7f6 100644
--- a/examples/widgets/touch/pinchzoom/CMakeLists.txt
+++ b/examples/widgets/touch/pinchzoom/CMakeLists.txt
@@ -1,46 +1,39 @@
-# Generated from pinchzoom.pro.
-
cmake_minimum_required(VERSION 3.16)
project(pinchzoom LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/touch/pinchzoom")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
qt_add_executable(pinchzoom
graphicsview.cpp graphicsview.h
main.cpp
mouse.cpp mouse.h
)
+
set_target_properties(pinchzoom PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(pinchzoom PUBLIC
Qt::Core
Qt::Gui
Qt::Widgets
)
-
# Resources:
set(mice_resource_files
"images/cheese.jpg"
)
-qt6_add_resources(pinchzoom "mice"
+qt_add_resources(pinchzoom "mice"
PREFIX
"/"
FILES
diff --git a/examples/widgets/tutorials/CMakeLists.txt b/examples/widgets/tutorials/CMakeLists.txt
index 733eb42151..091bf7109b 100644
--- a/examples/widgets/tutorials/CMakeLists.txt
+++ b/examples/widgets/tutorials/CMakeLists.txt
@@ -1,5 +1,3 @@
-# Generated from tutorials.pro.
-
add_subdirectory(addressbook)
add_subdirectory(widgets)
add_subdirectory(modelview)
diff --git a/examples/widgets/tutorials/addressbook/CMakeLists.txt b/examples/widgets/tutorials/addressbook/CMakeLists.txt
index cb00cbc084..1d8a65bb0b 100644
--- a/examples/widgets/tutorials/addressbook/CMakeLists.txt
+++ b/examples/widgets/tutorials/addressbook/CMakeLists.txt
@@ -1,5 +1,3 @@
-# Generated from addressbook.pro.
-
qt_internal_add_example(part1)
qt_internal_add_example(part2)
qt_internal_add_example(part3)
diff --git a/examples/widgets/tutorials/addressbook/part1/CMakeLists.txt b/examples/widgets/tutorials/addressbook/part1/CMakeLists.txt
index 66d07422a7..ffa3a0d0ad 100644
--- a/examples/widgets/tutorials/addressbook/part1/CMakeLists.txt
+++ b/examples/widgets/tutorials/addressbook/part1/CMakeLists.txt
@@ -1,32 +1,26 @@
-# Generated from part1.pro.
-
cmake_minimum_required(VERSION 3.16)
project(part1 LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/tutorials/addressbook/part1")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
qt_add_executable(part1
addressbook.cpp addressbook.h
main.cpp
)
+
set_target_properties(part1 PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(part1 PUBLIC
Qt::Core
Qt::Gui
diff --git a/examples/widgets/tutorials/addressbook/part2/CMakeLists.txt b/examples/widgets/tutorials/addressbook/part2/CMakeLists.txt
index 0af325d2eb..907b97d147 100644
--- a/examples/widgets/tutorials/addressbook/part2/CMakeLists.txt
+++ b/examples/widgets/tutorials/addressbook/part2/CMakeLists.txt
@@ -1,32 +1,26 @@
-# Generated from part2.pro.
-
cmake_minimum_required(VERSION 3.16)
project(part2 LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/tutorials/addressbook/part2")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
qt_add_executable(part2
addressbook.cpp addressbook.h
main.cpp
)
+
set_target_properties(part2 PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(part2 PUBLIC
Qt::Core
Qt::Gui
diff --git a/examples/widgets/tutorials/addressbook/part3/CMakeLists.txt b/examples/widgets/tutorials/addressbook/part3/CMakeLists.txt
index bf250b92ed..7eda1c0f7e 100644
--- a/examples/widgets/tutorials/addressbook/part3/CMakeLists.txt
+++ b/examples/widgets/tutorials/addressbook/part3/CMakeLists.txt
@@ -1,32 +1,26 @@
-# Generated from part3.pro.
-
cmake_minimum_required(VERSION 3.16)
project(part3 LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/tutorials/addressbook/part3")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
qt_add_executable(part3
addressbook.cpp addressbook.h
main.cpp
)
+
set_target_properties(part3 PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(part3 PUBLIC
Qt::Core
Qt::Gui
diff --git a/examples/widgets/tutorials/addressbook/part4/CMakeLists.txt b/examples/widgets/tutorials/addressbook/part4/CMakeLists.txt
index 4bba55d0f4..a274ca0b24 100644
--- a/examples/widgets/tutorials/addressbook/part4/CMakeLists.txt
+++ b/examples/widgets/tutorials/addressbook/part4/CMakeLists.txt
@@ -1,32 +1,26 @@
-# Generated from part4.pro.
-
cmake_minimum_required(VERSION 3.16)
project(part4 LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/tutorials/addressbook/part4")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
qt_add_executable(part4
addressbook.cpp addressbook.h
main.cpp
)
+
set_target_properties(part4 PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(part4 PUBLIC
Qt::Core
Qt::Gui
diff --git a/examples/widgets/tutorials/addressbook/part5/CMakeLists.txt b/examples/widgets/tutorials/addressbook/part5/CMakeLists.txt
index 646a404c64..4f1756e581 100644
--- a/examples/widgets/tutorials/addressbook/part5/CMakeLists.txt
+++ b/examples/widgets/tutorials/addressbook/part5/CMakeLists.txt
@@ -1,33 +1,27 @@
-# Generated from part5.pro.
-
cmake_minimum_required(VERSION 3.16)
project(part5 LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/tutorials/addressbook/part5")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
qt_add_executable(part5
addressbook.cpp addressbook.h
finddialog.cpp finddialog.h
main.cpp
)
+
set_target_properties(part5 PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(part5 PUBLIC
Qt::Core
Qt::Gui
diff --git a/examples/widgets/tutorials/addressbook/part6/CMakeLists.txt b/examples/widgets/tutorials/addressbook/part6/CMakeLists.txt
index 2300e6fa58..9188e1738b 100644
--- a/examples/widgets/tutorials/addressbook/part6/CMakeLists.txt
+++ b/examples/widgets/tutorials/addressbook/part6/CMakeLists.txt
@@ -1,33 +1,27 @@
-# Generated from part6.pro.
-
cmake_minimum_required(VERSION 3.16)
project(part6 LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/tutorials/addressbook/part6")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
qt_add_executable(part6
addressbook.cpp addressbook.h
finddialog.cpp finddialog.h
main.cpp
)
+
set_target_properties(part6 PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(part6 PUBLIC
Qt::Core
Qt::Gui
diff --git a/examples/widgets/tutorials/addressbook/part7/CMakeLists.txt b/examples/widgets/tutorials/addressbook/part7/CMakeLists.txt
index 93c51ebed9..a186d9499c 100644
--- a/examples/widgets/tutorials/addressbook/part7/CMakeLists.txt
+++ b/examples/widgets/tutorials/addressbook/part7/CMakeLists.txt
@@ -1,33 +1,27 @@
-# Generated from part7.pro.
-
cmake_minimum_required(VERSION 3.16)
project(part7 LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/tutorials/addressbook/part7")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
qt_add_executable(part7
addressbook.cpp addressbook.h
finddialog.cpp finddialog.h
main.cpp
)
+
set_target_properties(part7 PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(part7 PUBLIC
Qt::Core
Qt::Gui
diff --git a/examples/widgets/tutorials/gettingStarted/gsQt/CMakeLists.txt b/examples/widgets/tutorials/gettingStarted/gsQt/CMakeLists.txt
index 8302fd7598..6ceae61bce 100644
--- a/examples/widgets/tutorials/gettingStarted/gsQt/CMakeLists.txt
+++ b/examples/widgets/tutorials/gettingStarted/gsQt/CMakeLists.txt
@@ -1,5 +1,3 @@
-# Generated from gsqt.pro.
-
qt_internal_add_example(part1)
qt_internal_add_example(part2)
qt_internal_add_example(part3)
diff --git a/examples/widgets/tutorials/gettingStarted/gsQt/part1/CMakeLists.txt b/examples/widgets/tutorials/gettingStarted/gsQt/part1/CMakeLists.txt
index 0e73ada7ba..a8525a53ba 100644
--- a/examples/widgets/tutorials/gettingStarted/gsQt/part1/CMakeLists.txt
+++ b/examples/widgets/tutorials/gettingStarted/gsQt/part1/CMakeLists.txt
@@ -1,31 +1,25 @@
-# Generated from part1.pro.
-
cmake_minimum_required(VERSION 3.16)
project(getting_started_part1 LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/tutorials/gettingStarted/gsQt/part1")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
qt_add_executable(getting_started_part1
main.cpp
)
+
set_target_properties(getting_started_part1 PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(getting_started_part1 PUBLIC
Qt::Core
Qt::Gui
diff --git a/examples/widgets/tutorials/gettingStarted/gsQt/part2/CMakeLists.txt b/examples/widgets/tutorials/gettingStarted/gsQt/part2/CMakeLists.txt
index 0b828abc0f..dc5e7361db 100644
--- a/examples/widgets/tutorials/gettingStarted/gsQt/part2/CMakeLists.txt
+++ b/examples/widgets/tutorials/gettingStarted/gsQt/part2/CMakeLists.txt
@@ -1,31 +1,25 @@
-# Generated from part2.pro.
-
cmake_minimum_required(VERSION 3.16)
project(getting_started_part2 LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/tutorials/gettingStarted/gsQt/part2")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
qt_add_executable(getting_started_part2
main.cpp
)
+
set_target_properties(getting_started_part2 PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(getting_started_part2 PUBLIC
Qt::Core
Qt::Gui
diff --git a/examples/widgets/tutorials/gettingStarted/gsQt/part3/CMakeLists.txt b/examples/widgets/tutorials/gettingStarted/gsQt/part3/CMakeLists.txt
index 7b8506399a..75d2a4e407 100644
--- a/examples/widgets/tutorials/gettingStarted/gsQt/part3/CMakeLists.txt
+++ b/examples/widgets/tutorials/gettingStarted/gsQt/part3/CMakeLists.txt
@@ -1,31 +1,25 @@
-# Generated from part3.pro.
-
cmake_minimum_required(VERSION 3.16)
project(getting_started_part3 LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/tutorials/gettingStarted/gsQt/part3")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
qt_add_executable(getting_started_part3
main.cpp
)
+
set_target_properties(getting_started_part3 PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(getting_started_part3 PUBLIC
Qt::Core
Qt::Gui
diff --git a/examples/widgets/tutorials/gettingStarted/gsQt/part4/CMakeLists.txt b/examples/widgets/tutorials/gettingStarted/gsQt/part4/CMakeLists.txt
index f28bc9f3fa..f96e92b184 100644
--- a/examples/widgets/tutorials/gettingStarted/gsQt/part4/CMakeLists.txt
+++ b/examples/widgets/tutorials/gettingStarted/gsQt/part4/CMakeLists.txt
@@ -1,31 +1,25 @@
-# Generated from part4.pro.
-
cmake_minimum_required(VERSION 3.16)
project(getting_started_part4 LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/tutorials/gettingStarted/gsQt/part4")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
qt_add_executable(getting_started_part4
main.cpp
)
+
set_target_properties(getting_started_part4 PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(getting_started_part4 PUBLIC
Qt::Core
Qt::Gui
diff --git a/examples/widgets/tutorials/gettingStarted/gsQt/part5/CMakeLists.txt b/examples/widgets/tutorials/gettingStarted/gsQt/part5/CMakeLists.txt
index 95e0f1db43..efaf7d8b14 100644
--- a/examples/widgets/tutorials/gettingStarted/gsQt/part5/CMakeLists.txt
+++ b/examples/widgets/tutorials/gettingStarted/gsQt/part5/CMakeLists.txt
@@ -1,31 +1,25 @@
-# Generated from part5.pro.
-
cmake_minimum_required(VERSION 3.16)
project(getting_started_part5 LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/tutorials/gettingStarted/gsQt/part5")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
qt_add_executable(getting_started_part5
main.cpp
)
+
set_target_properties(getting_started_part5 PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(getting_started_part5 PUBLIC
Qt::Core
Qt::Gui
diff --git a/examples/widgets/tutorials/modelview/1_readonly/CMakeLists.txt b/examples/widgets/tutorials/modelview/1_readonly/CMakeLists.txt
index a87df63fd9..e4b1459e55 100644
--- a/examples/widgets/tutorials/modelview/1_readonly/CMakeLists.txt
+++ b/examples/widgets/tutorials/modelview/1_readonly/CMakeLists.txt
@@ -1,32 +1,26 @@
-# Generated from 1_readonly.pro.
-
cmake_minimum_required(VERSION 3.16)
project(mv_readonly LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/tutorials/modelview/1_readonly")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
qt_add_executable(mv_readonly
main.cpp
mymodel.cpp mymodel.h
)
+
set_target_properties(mv_readonly PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(mv_readonly PUBLIC
Qt::Core
Qt::Gui
diff --git a/examples/widgets/tutorials/modelview/2_formatting/CMakeLists.txt b/examples/widgets/tutorials/modelview/2_formatting/CMakeLists.txt
index 20c3181cf5..cec088d059 100644
--- a/examples/widgets/tutorials/modelview/2_formatting/CMakeLists.txt
+++ b/examples/widgets/tutorials/modelview/2_formatting/CMakeLists.txt
@@ -1,32 +1,26 @@
-# Generated from 2_formatting.pro.
-
cmake_minimum_required(VERSION 3.16)
project(mv_formatting LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/tutorials/modelview/2_formatting")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
qt_add_executable(mv_formatting
main.cpp
mymodel.cpp mymodel.h
)
+
set_target_properties(mv_formatting PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(mv_formatting PUBLIC
Qt::Core
Qt::Gui
diff --git a/examples/widgets/tutorials/modelview/3_changingmodel/CMakeLists.txt b/examples/widgets/tutorials/modelview/3_changingmodel/CMakeLists.txt
index fa4397528b..0b99f28682 100644
--- a/examples/widgets/tutorials/modelview/3_changingmodel/CMakeLists.txt
+++ b/examples/widgets/tutorials/modelview/3_changingmodel/CMakeLists.txt
@@ -1,32 +1,26 @@
-# Generated from 3_changingmodel.pro.
-
cmake_minimum_required(VERSION 3.16)
project(mv_changingmodel LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/tutorials/modelview/3_changingmodel")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
qt_add_executable(mv_changingmodel
main.cpp
mymodel.cpp mymodel.h
)
+
set_target_properties(mv_changingmodel PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(mv_changingmodel PUBLIC
Qt::Core
Qt::Gui
diff --git a/examples/widgets/tutorials/modelview/4_headers/CMakeLists.txt b/examples/widgets/tutorials/modelview/4_headers/CMakeLists.txt
index 4bf8f5fd0b..71932d5a62 100644
--- a/examples/widgets/tutorials/modelview/4_headers/CMakeLists.txt
+++ b/examples/widgets/tutorials/modelview/4_headers/CMakeLists.txt
@@ -1,32 +1,26 @@
-# Generated from 4_headers.pro.
-
cmake_minimum_required(VERSION 3.16)
project(mv_headers LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/tutorials/modelview/4_headers")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
qt_add_executable(mv_headers
main.cpp
mymodel.cpp mymodel.h
)
+
set_target_properties(mv_headers PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(mv_headers PUBLIC
Qt::Core
Qt::Gui
diff --git a/examples/widgets/tutorials/modelview/5_edit/CMakeLists.txt b/examples/widgets/tutorials/modelview/5_edit/CMakeLists.txt
index 388491db8b..0f9a075b50 100644
--- a/examples/widgets/tutorials/modelview/5_edit/CMakeLists.txt
+++ b/examples/widgets/tutorials/modelview/5_edit/CMakeLists.txt
@@ -1,33 +1,27 @@
-# Generated from 5_edit.pro.
-
cmake_minimum_required(VERSION 3.16)
project(mv_edit LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/tutorials/modelview/5_edit")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
qt_add_executable(mv_edit
main.cpp
mainwindow.cpp mainwindow.h
mymodel.cpp mymodel.h
)
+
set_target_properties(mv_edit PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(mv_edit PUBLIC
Qt::Core
Qt::Gui
diff --git a/examples/widgets/tutorials/modelview/6_treeview/CMakeLists.txt b/examples/widgets/tutorials/modelview/6_treeview/CMakeLists.txt
index 1759eef471..856d3354fc 100644
--- a/examples/widgets/tutorials/modelview/6_treeview/CMakeLists.txt
+++ b/examples/widgets/tutorials/modelview/6_treeview/CMakeLists.txt
@@ -1,32 +1,26 @@
-# Generated from 6_treeview.pro.
-
cmake_minimum_required(VERSION 3.16)
project(mv_tree LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/tutorials/modelview/6_treeview")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
qt_add_executable(mv_tree
main.cpp
mainwindow.cpp mainwindow.h
)
+
set_target_properties(mv_tree PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(mv_tree PUBLIC
Qt::Core
Qt::Gui
diff --git a/examples/widgets/tutorials/modelview/7_selections/CMakeLists.txt b/examples/widgets/tutorials/modelview/7_selections/CMakeLists.txt
index 35c30f3efc..1c3910be40 100644
--- a/examples/widgets/tutorials/modelview/7_selections/CMakeLists.txt
+++ b/examples/widgets/tutorials/modelview/7_selections/CMakeLists.txt
@@ -1,32 +1,26 @@
-# Generated from 7_selections.pro.
-
cmake_minimum_required(VERSION 3.16)
project(mv_selections LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/tutorials/modelview/7_selections")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
qt_add_executable(mv_selections
main.cpp
mainwindow.cpp mainwindow.h
)
+
set_target_properties(mv_selections PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(mv_selections PUBLIC
Qt::Core
Qt::Gui
diff --git a/examples/widgets/tutorials/modelview/CMakeLists.txt b/examples/widgets/tutorials/modelview/CMakeLists.txt
index 49ca672e48..889b07b8da 100644
--- a/examples/widgets/tutorials/modelview/CMakeLists.txt
+++ b/examples/widgets/tutorials/modelview/CMakeLists.txt
@@ -1,5 +1,3 @@
-# Generated from modelview.pro.
-
qt_internal_add_example(1_readonly)
qt_internal_add_example(2_formatting)
qt_internal_add_example(3_changingmodel)
diff --git a/examples/widgets/tutorials/notepad/.prev_CMakeLists.txt b/examples/widgets/tutorials/notepad/.prev_CMakeLists.txt
deleted file mode 100644
index 119ca9d6cf..0000000000
--- a/examples/widgets/tutorials/notepad/.prev_CMakeLists.txt
+++ /dev/null
@@ -1,76 +0,0 @@
-# Generated from notepad.pro.
-
-cmake_minimum_required(VERSION 3.14)
-project(notepad LANGUAGES CXX)
-
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
-set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
-
-if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
-endif()
-
-set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/tutorials/notepad")
-
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
-
-qt_add_executable(notepad
- main.cpp
- notepad.cpp notepad.h notepad.ui
-)
-set_target_properties(notepad PROPERTIES
- WIN32_EXECUTABLE TRUE
- MACOSX_BUNDLE TRUE
-)
-target_link_libraries(notepad PUBLIC
- Qt::Core
- Qt::Gui
- Qt::Widgets
-)
-
-
-# Resources:
-set(notepad_resource_files
- "images/bold.png"
- "images/copy.png"
- "images/create.png"
- "images/cut.png"
- "images/edit_redo.png"
- "images/edit_undo.png"
- "images/exit.png"
- "images/font.png"
- "images/info.png"
- "images/italic.png"
- "images/new.png"
- "images/open.png"
- "images/paste.png"
- "images/pencil.png"
- "images/print.png"
- "images/save.png"
- "images/save_as.png"
- "images/underline.png"
-)
-
-qt6_add_resources(notepad "notepad"
- PREFIX
- "/"
- FILES
- ${notepad_resource_files}
-)
-
-if(TARGET Qt::PrintSupport)
- target_link_libraries(notepad PUBLIC
- Qt::PrintSupport
- )
-endif()
-
-install(TARGETS notepad
- RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}"
- BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}"
- LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}"
-)
diff --git a/examples/widgets/tutorials/notepad/CMakeLists.txt b/examples/widgets/tutorials/notepad/CMakeLists.txt
index 3c1fea3e6b..b4be0e1bb0 100644
--- a/examples/widgets/tutorials/notepad/CMakeLists.txt
+++ b/examples/widgets/tutorials/notepad/CMakeLists.txt
@@ -1,40 +1,36 @@
-# Generated from notepad.pro.
-
cmake_minimum_required(VERSION 3.16)
project(notepad LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/tutorials/notepad")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
-find_package(Qt6 COMPONENTS PrintSupport) # special case: add
+find_package(Qt6
+ REQUIRED COMPONENTS Core Gui Widgets
+ OPTIONAL_COMPONENTS PrintSupport
+)
qt_add_executable(notepad
main.cpp
notepad.cpp notepad.h notepad.ui
)
+
set_target_properties(notepad PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(notepad PUBLIC
Qt::Core
Qt::Gui
Qt::Widgets
)
-
# Resources:
set(notepad_resource_files
"images/bold.png"
@@ -57,7 +53,7 @@ set(notepad_resource_files
"images/underline.png"
)
-qt6_add_resources(notepad "notepad"
+qt_add_resources(notepad "notepad"
PREFIX
"/"
FILES
diff --git a/examples/widgets/tutorials/widgets/CMakeLists.txt b/examples/widgets/tutorials/widgets/CMakeLists.txt
index fcf0ed9ddd..2898f65da8 100644
--- a/examples/widgets/tutorials/widgets/CMakeLists.txt
+++ b/examples/widgets/tutorials/widgets/CMakeLists.txt
@@ -1,5 +1,3 @@
-# Generated from widgets.pro.
-
qt_internal_add_example(toplevel)
qt_internal_add_example(childwidget)
qt_internal_add_example(windowlayout)
diff --git a/examples/widgets/tutorials/widgets/childwidget/CMakeLists.txt b/examples/widgets/tutorials/widgets/childwidget/CMakeLists.txt
index f51514818b..95fcbb66f4 100644
--- a/examples/widgets/tutorials/widgets/childwidget/CMakeLists.txt
+++ b/examples/widgets/tutorials/widgets/childwidget/CMakeLists.txt
@@ -1,31 +1,25 @@
-# Generated from childwidget.pro.
-
cmake_minimum_required(VERSION 3.16)
project(childwidget LANGUAGES CXX)
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
set(CMAKE_AUTOMOC ON)
-set(CMAKE_AUTORCC ON)
-set(CMAKE_AUTOUIC ON)
if(NOT DEFINED INSTALL_EXAMPLESDIR)
- set(INSTALL_EXAMPLESDIR "examples")
+ set(INSTALL_EXAMPLESDIR "examples")
endif()
set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/widgets/tutorials/widgets/childwidget")
-find_package(Qt6 COMPONENTS Core)
-find_package(Qt6 COMPONENTS Gui)
-find_package(Qt6 COMPONENTS Widgets)
+find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets)
qt_add_executable(childwidget
main.cpp
)
+
set_target_properties(childwidget PROPERTIES
WIN32_EXECUTABLE TRUE
MACOSX_BUNDLE TRUE
)
+
target_link_libraries(childwidget PUBLIC
Qt::Core
Qt::Gui
diff --git a/examples/widgets/tutorials/widgets/nestedlayouts/CMakeLists.txt b/examples/widgets/tutorials/widgets/nestedlayouts/CMakeLists.txt
index 3bd5d52c51..ea2929de64 100644
--- a/examples/widgets/tutorials/widgets/nestedlayouts/CMakeLists.txt
+++ b/examples/widgets/tutorials/widgets/nestedlayouts/CMakeLists.txt
@@ -1,31 +1,25 @@
-# Generated from nestedlayouts.pro.
-
cmake_minimum_required(VERSION 3.16)
project(nestedlayouts LANGUAGES CXX)