Commit Graph

48 Commits

Author SHA1 Message Date
Christian Ehrlicher
5d3e6ef909 Examples/OpenGLWindow: do not use hardcoded indices
Don't use the hardcoded indices 0 and 1 but the ones returned from
QOpenGLShaderProgram::attributeLocation(). Also change them from GLuint
to GLint.

Fixes: QTBUG-43566
Change-Id: I582bcf899f20d90f4ec1cd61326a177aabb69992
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2019-10-02 08:36:36 +02:00
Christian Ehrlicher
b0042601ed Cleanup QtOpenGL examples
Cleanup the OpenGL examples
 - use nullptr (clang-tidy)
 - use member-initialization
 - avoid redundant checks for != nullptr when deleting a pointer

Change-Id: I3e4702690ed79e71c3e952d51ceef83b907b45b7
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2019-09-30 22:16:27 +02:00
Tor Arne Vestbø
666f3b4a78 Take device-pixel-ratio into account in openglwindow example
Also affects the windowcontainer example, which includes an OpenGL
window.

Change-Id: Ic9f0f2aa66410b657e08c0225b085dd8df44e2a7
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2018-11-20 19:51:12 +00:00
Tor Arne Vestbø
c4a21708ed Provide presets for QGradient
Similar to Qt::GlobalColor, the presets allow the user to create
brushes based on predefined gradients, quickly getting pretty pixels
on screen.

The presets are based on the linear gradients from WebGradients, a
free collection of gradients, hosted at https://webgradients.com/.
The few radial and blended gradient presets have been excluded.

Change-Id: I1ce8f2210a6045c9edb8829ab3eddcc313549127
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
2018-05-31 15:50:50 +00:00
Tor Arne Vestbø
9c17b8adb9 Update rasterwindow example to not render in resizeEvent
The resize event should not be used to draw, as there will be a follow-up
exposeEvent delivered just after, and we don't want to draw twice.

This is how QRasterWindow operates too, except it defers the backingstore
resize to beginPaint() instead of resizing in the reizeEvent.

It's also how QOpenGLWindow operates, which also has a note for the
virtual resizeGL method saying: "Scheduling updates from here is not
necessary. The windowing systems will send expose events that trigger
an update automatically."

Change-Id: I2a9740018508c2eb129149f53237ee8e378c03b1
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2018-03-20 16:00:31 +00:00
Tor Arne Vestbø
11f6c64696 rasterwindow: End painting on device before ending on backingstore
Change-Id: Ib42de1d7ad0d14e2e2d2ff75606e6cfd7e584c2a
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
2018-01-29 11:15:24 +00:00
Gatis Paeglis
ce9a806336 doc: cleanup raster window example
Documentation does not match the sample code. There is no explicit
call to QWindow::create(). It is called implicitly by QWindow::show().

Furthermore, QWindow::create() documentation states: "Note that it is
not usually necessary to call this function directly, as it will be
implicitly called by show(), setVisible(), and other functions that
require access to the platform resources.".

Change-Id: I632da86438f7f88c1fd8359b9fd6d52f329291cb
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
2017-07-03 10:20:37 +00:00
Peter Seiderer
18d49808db examples: fix compile without gui module
With disabled gui module qmake in the directory examples/gui and
examples/widgets failes with:

  Project ERROR: Could not find feature opengl.

Fix this by protecting 'qtConfig(opengl)' by 'qtHaveModule(gui)' as
already done in examples/examples.pro.

Task-number: QTBUG-60488
Change-Id: Ia842124e818e8c81d41d2b8e3b8905bf1dee58ce
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2017-05-05 06:54:15 +00:00
Tor Arne Vestbø
9cad7b6eac Update rasterwindow example to not create() in the constructor
QBackingStore should be able to handle a non-created QWindow just fine.

Change-Id: I42299aa0e985422e1fe4279c1385b9979d267a47
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2017-04-21 15:12:55 +00:00
Tor Arne Vestbø
0deb0796a4 Modernize rasterwindow/openglwindow examples to use requestUpdate()
Change-Id: Ib8d0c42db7343247d0431ea008eb17da9ee98f4d
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2016-09-22 16:45:15 +00:00
Lars Knoll
2d3c73fcfe Modularize configure.json/.pri
Move the different parts of configure.json/.pri into the libraries where
they belong.

Gui is not yet fully modularized, and contains many things related to
the different QPA plugins.

Done-with: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Change-Id: I6659bb29354ed1f36b95b8c69e7fce58f642053f
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2016-09-15 08:23:53 +00:00
Lars Knoll
60985aa42b Use qtConfig throughout in qtbase
Use the new qtConfig macro in all pro/pri files.

This required adding some feature entries, and adding
{private,public}Feature to every referenced already existing entry.

Change-Id: I164214dad1154df6ad84e86d99ed14994ef97cf4
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2016-08-19 04:28:05 +00:00
Liang Qi
22e96c4d34 Merge remote-tracking branch 'origin/5.7' into dev
Change-Id: I36e6b890b65d12bf6931757540bcc9c553b5eb8f
2016-08-09 17:59:51 +02:00
Liang Qi
69ef0481fc Merge remote-tracking branch 'origin/5.6' into 5.7
Conflicts:
	tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp

Change-Id: I6f3878b204464313aa2f9d988d3b35121d4d9867
2016-08-05 08:58:48 +02:00
Jake Petroules
47511046a4 Fix rasterwindow example
At least with the eglfs platform plugin, the QBackingStore constructor
results in a null pointer access if done before creation.

Change-Id: I2e78e70700fa48499a35c55797e1b962b6e6285a
Reviewed-by: Rebecca Worledge <rebecca.worledge@theqtcompany.com>
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2016-08-04 19:55:14 +00:00
hjk
40a54bf565 Examples: Replace 'Q_DECL_OVERRIDE' by 'override'
Examples should demonstrate best practice, and we can use the keyword
directly nowadays.

Change-Id: I1f122e5caceca17290757ffbaf3d660e7daa9ae4
Reviewed-by: Topi Reiniö <topi.reinio@theqtcompany.com>
2016-06-15 09:32:30 +00:00
Jani Heikkinen
cd46a2daf5 Unify license header usage.
Update files using old header.LGPL3 to header.LGPL
Update files using old FDL template to use new one
Update files using old BSD template to use new one

Change-Id: I36a78272516f9953d02956522f285b40adfc8915
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
2016-03-29 10:20:03 +00:00
Samuel Gaist
decc546368 Doc: remove unused code from OpenGL Window example
Change-Id: Ifb2c7206dee55102eba91b4c30543f3ac4838259
Reviewed-by: Topi Reiniö <topi.reinio@digia.com>
2015-10-07 10:56:04 +00:00
Jani Heikkinen
2b75c156b6 Updated BSD licensed file headers
Change-Id: I6441ff931dbd33b698d762e6f6784898f3f60fe7
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2015-02-15 07:41:17 +00:00
Jani Heikkinen
83a5694dc2 Update copyright headers
Qt copyrights are now in The Qt Company, so we could update the source
code headers accordingly. In the same go we should also fix the links to
point to qt.io.

Outdated header.LGPL removed (use header.LGPL21 instead)

Old header.LGPL3 renamed to header.LGPL3-COMM to match actual licensing
combination. New header.LGPL-COMM taken in the use file which were
using old header.LGPL3 (src/plugins/platforms/android/extract.cpp)

Added new header.LGPL3 containing Commercial + LGPLv3 + GPLv2 license
combination

Change-Id: I6f49b819a8a20cc4f88b794a8f6726d975e8ffbe
Reviewed-by: Matti Paaso <matti.paaso@theqtcompany.com>
2015-02-11 06:49:51 +00:00
Jerome Pasion
7567e09389 Doc: Updated thumbnail images for some examples.
-Application Example
-Analog Clock
-Analog Clock Window
-Scribble
-Digital Clock

-Thumbnail images were created with an obscure window manager and
they look out of place in the Welcome Mode in Qt Creator.
-Used Windows 7 as the platform.
-Images within the documentation not updated because they are still
relevant.

Task-number: QTBUG-33597
Change-Id: I255fc4960e9adcec273f21287ef2182656c6b007
Reviewed-by: Venugopal Shivashankar <venugopal.shivashankar@digia.com>
Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
2014-10-28 19:31:53 +01:00
Nico Vertriest
54853c5f66 Doc: Use title case in section1 titles
Using Python script title-cased.py

Task-number: QTBUG-41250
Change-Id: I00d3d7a0b30db7304a7904efd6d63abd9a7b493b
Reviewed-by: Topi Reiniö <topi.reinio@digia.com>
2014-09-30 13:52:51 +02:00
Olivier Goffart
3b0c2b7c1b Examples: Add Q_DECL_OVERRIDE to overridden functions
Q_DECL_OVERRIDE (which expands to 'override' for supported compiler)
helps to declare the intent (that it is an overridden function) and
force compilation error when there is no such virtual function in the
base class.
The examples should show the best practice of having it, as it may save
the programmer quite some time in case of change of API or typo in the
function name or arguments.

This change was done automatically with
clang-modernize -add-override -override-macros

And fixed MSVC compilation by removing inline for TorrentViewDelegate::paint

Change-Id: Ice66ae93fae571266f908703d5b8892b2c1ebb1a
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
2014-07-15 08:44:44 +02:00
Oswald Buddenhagen
a4ec90175c purge vestiges of opengl es 1 support
amends 0d5170256c.

Change-Id: Ifa178d38f602bb7c66ef13334673ff47e332af5b
Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
2014-04-04 19:32:21 +02:00
Kai Koehne
02ae29f39b Fix compiler warning in example
Fix warning

main.cpp:160:
warning: no return statement in function returning non-void
[-Wreturn-type]
 }
  ^

Change-Id: I4b74e8f56136077ef9a71b803d2756394fcd7658
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
2014-03-20 10:36:34 +01:00
Laszlo Agocs
ba77406c4d Avoid truncation warning in openglwindow example
msvc shows a warning about double -> float truncation. Avoid this.

Change-Id: I1b74cf407c81c881df5e95cc7d64a210888595e3
Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com>
2014-02-21 15:52:59 +01:00
Oswald Buddenhagen
90c65880b0 skip gui-needing examples with -no-gui
Change-Id: I2413f14f0c2d9179868877615d6131bf4ca7ea16
Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
2013-10-11 21:03:34 +02:00
Gunnar Sletta
da2f627ba2 improve openglwindow example a bit
Change-Id: I50e00c33c100beab975d0fcbfc4ccdd496cccbaf
Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
2013-03-21 07:53:05 +01:00
Samuel Rødal
c85f6d9f5a Fixed qtbase examples build when configured with -no-opengl
Change-Id: Idafdc3264f760d6400ce04bb9da36289b1f96438
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
2013-02-20 10:35:23 +01:00
Sze Howe Koh
c9b22e438b Fix unopened comment
Change-Id: I68d131bb29ed4c150ef2630654d2b8ff59ea47cf
Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
2013-01-28 14:07:34 +01:00
Sze Howe Koh
63569a68d2 Doc: Fix module name format
Follow the conventions at
http://qt-project.org/wiki/Spelling_Module_Names_in_Qt_Documentation

QtCore         -> Qt Core
QtDBus         -> Qt D-Bus
QtDesigner     -> Qt Designer
QtGui          -> Qt GUI
QtImageFormats -> Qt Image Formats
QtNetwork      -> Qt Network
QtPrintSupport -> Qt Print Support
QtScript       -> Qt Script
QtSql          -> Qt SQL
QtSvg          -> Qt SVG
QtTest         -> Qt Test
QtWebKit       -> Qt WebKit
QtWidgets      -> Qt Widgets
QtXml          -> Qt XML

QtConcurrent   -> Qt Concurrent (partial)
QtQuick        -> Qt Quick      (partial)

Also, distinguish between "module" and "library"

Change-Id: Icb8aa695ae60b0e45920b0c8fce4dc763a12b0cd
Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
2013-01-25 17:27:44 +01:00
Sergio Ahumada
48e0c4df23 Update copyright year in Digia's license headers
Change-Id: Ic804938fc352291d011800d21e549c10acac66fb
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2013-01-18 09:07:35 +01:00
Nico Vertriest
d208c8b247 Doc: corrected typo "the the"
Task-number: QTBUG-28756

Spurious repetition of the definite article
Trailing space issue corrected.

Change-Id: I3a051f5dc291e546d8d67d6775e84b388bdc0363
Reviewed-by: Topi Reiniö <topi.reinio@digia.com>
Reviewed-by: Geir Vattekar <geir.vattekar@digia.com>
2013-01-11 12:02:21 +01:00
Joerg Bornemann
1cf191ec6d fix examples/gui/analogclock for MSVC
This example is hit by the infamous QTBUG-13496 issue.

Task-number: QTBUG-28665

Change-Id: I9bcffe72d34b1eaa9f5beafc69a16913a597d17f
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
2012-12-19 23:42:49 +01:00
Christiaan Janssen
0843067838 Qt Gui Examples: Fixed QDoc files
Change-Id: I160d8d186a1078f20f2b779bfbdae90459c27641
Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
2012-12-18 19:33:09 +01:00
Nico Vertriest
5a8a1eb4af Entered hardcoded url workaround QTBUG-28500
Url for OpenGL Registry
Url for Khronos OpenGL ES API Registry

Change-Id: I682ddcedf1e06d589e5c44e364936c78fd9219a5
Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
2012-12-14 13:06:53 +01:00
Gunnar Sletta
508db17de3 Some fixes to the OpenGL docs in GUI
Change-Id: I6415ff16b1765a5814d50a4cd39db00495d43073
Reviewed-by: Paul Olav Tvete <paul.tvete@digia.com>
2012-12-12 10:47:48 +01:00
Oliver Wolff
b22eb09b48 Fixed installation of gui examples' targets
Change-Id: Ie945ffac56ed83d2dc4605a073bcab4ef6f290ac
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
2012-12-10 15:31:06 +01:00
hjk
22e3111127 Fix reference to example paths
This eliminates seven EXAMPLE PATH DOES NOT EXIST warnings.

Change-Id: Iaa6267138a1799fb775f0034805d5691bfa40d7c
Reviewed-by: Christian Stenger <christian.stenger@digia.com>
Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
2012-12-06 10:48:27 +01:00
Eike Ziller
4727bb5991 Add \brief to the examples.
That is used by qdoc to generate brief descriptions for the example
manifests.

Change-Id: I142a6d3259f90d0c9990033b3c36e139062ac343
Reviewed-by: Eike Ziller <eike.ziller@digia.com>
Reviewed-by: hjk <qthjk@ovi.com>
2012-11-29 13:51:54 +01:00
Oswald Buddenhagen
91f640b189 remove meaningless OTHER_FILES assignments
Change-Id: Id3d5690d5b174e5374332158709365ab431f660b
Reviewed-by: hjk <qthjk@ovi.com>
Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
2012-11-28 16:21:57 +01:00
Shawn Rutledge
cd34da5426 Rename all QWindow properties that have "window" in them
windowTitle, windowModality, windowIcon and so on are named that way
to be similar to the ones in QWidget.  However QQuickWindow inherits
all of the declared properties, and we would like to have shorter
property names in QML.  If you are working with a Window then it's
obvious the title property is the window title.  Unfortunately,
there must be patches in many other modules which depend on this one.
In order to avoid the need to merge them all at the same time,
there is also patch https://codereview.qt-project.org/#change,39001
which temporarily adds backwards-compatible accessors, which can be
removed after the other modules are able to build without them.

We should not rename windowState to state, because in QML, state
usually drives the state machine for animation transitions etc.
(although QWindow is not an Item, a user might get confused about it).

Related patches are
https://codereview.qt-project.org/#change,39001
https://codereview.qt-project.org/#change,37764
https://codereview.qt-project.org/#change,37765
https://codereview.qt-project.org/#change,37766
https://codereview.qt-project.org/#change,37762

Change-Id: Ie4424ec15fbdef6b29b137f90a2ae33f173edd21
Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
2012-11-07 21:26:08 +01:00
Iikka Eklund
be15856f61 Change copyrights from Nokia to Digia
Change copyrights and license headers from Nokia to Digia

Change-Id: If1cc974286d29fd01ec6c19dd4719a67f4c3f00e
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
2012-09-22 19:20:11 +02:00
Frederik Gladhorn
999ac7da4c Move gui example doc example images.
Change-Id: I01e0c3d51bcb01c66a3f6c7b2ba95f0c9999f4cb
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>
2012-09-11 12:09:47 +02:00
Samuel Rødal
65f5909df2 Moved gui example documentation to the proper location.
Gui example documentation should be in examples/gui/doc/

Change-Id: I3cd196a2bb5d76b6e275f336b29a2ad1811159dd
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@nokia.com>
2012-09-01 11:21:46 +02:00
Samuel Rødal
f3b45ffa61 Added OpenGL example and documentation.
Change-Id: I2d9d4e52caf0a39fef9648d8a9e83a0c1328f650
Reviewed-by: Paul Olav Tvete <paul.tvete@nokia.com>
2012-08-29 16:53:00 +02:00
Gunnar Sletta
dec934cd96 Avoid potential crash.
The setGeometry call triggers a resizeEvent() so make sure the backing
store is created before that.

Change-Id: I26aa3ef6c0515311e3ca21f938a92ca1a20d0030
Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
2012-08-08 12:04:49 +02:00
Gunnar Sletta
c97104f31e Analog clock and raster window examples
Change-Id: I36586fbaa7da25208bbc1964d2708f094d0d5c98
Reviewed-by: Gunnar Sletta <gunnar.sletta@nokia.com>
2012-07-13 09:55:18 +02:00