Commit Graph

504 Commits

Author SHA1 Message Date
Laszlo Agocs
1219dbe543 Add an example for creating OpenGL contexts
Besides serving as an example for performing OpenGL rendering inside
a window container in a way that it works across all GL versions,
this is an extremely useful tool for developers and users alike
since it allows quick and easy checking of what sort of context a
particular driver returns for a particular QSurfaceFormat.

NB! Depending on the OpenGL driver, some surprises can be expected.
The handling of core/compatibility profiles, the fwdcompat bit,
the supported GLSL versions, etc. tend to be somewhat different
across the different OpenGL implementations.

Task-number: QTBUG-37071
Change-Id: Iae4328e66cd0bb19f74a77fefef93ea5a3221e31
Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com>
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
2014-02-28 18:00:39 +01:00
Sze Howe Koh
b648195c31 Doc: Replace obsolete types with their newer counterparts
This patch ignores:
- Docs for obsolete types themselves
- Comparisons between new and obsolete types

Change-Id: Id9b1e628255113e7c44520abe0f8a4e0db4a283d
Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
2014-02-25 16:36:34 +01:00
Friedemann Kleint
c05e5948a0 Fix division by zero in hellogl_es2 example.
Task-number: QTBUG-37027

Change-Id: Id18ee9c44650de9c434a82d3d10cf48e6ba9e78c
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@digia.com>
Reviewed-by: Kai Koehne <kai.koehne@digia.com>
2014-02-24 12:30: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
Laszlo Agocs
97c187da3c Dynamic GL switch on Windows
The patch introduces a new build configuration on Windows which
can be requested by passing -opengl dynamic to configure.

Platforms other than Windows (including WinRT) are not affected.
The existing Angle and desktop configurations are not affected.
These continue to function as before and Angle remains the default.

In the future, when all modules have added support for the dynamic
path, as described below, the default configuration could be changed
to be the dynamic one. This would allow providing a single set of
binaries in the official builds instead of the current two.

When requesting dynamic GL, Angle is built but QT_OPENGL_ES[_2] are
never defined. Instead, the code path that has traditionally been
desktop GL only becomes the dynamic path that has to do runtime
checks. Qt modules and applications are not linked to opengl32.dll or
libegl/glesv2.dll in this case. Instead, QtGui exports all necessary
egl/egl/gl functions which will, under the hood, forward all requests
to a dynamically loaded EGL/WGL/GL implementation.

Porting guide (better said, changes needed to prepare your code to
work with dynamic GL builds when the fallback to Angle is utilized):

1. In !QT_OPENGL_ES[_2] code branches use QOpenGLFunctions::isES() to
differentiate between desktop and ES where needed. Keep in mind that
it is the desktop GL header (plus qopenglext.h) that is included,
not the GLES one.

QtGui's proxy will handle some differences, for example calling
glClearDepth will route to glClearDepthf when needed. The built-in
eglGetProcAddress is able to retrieve pointers for standard GLES2
functions too so code resolving OpenGL 2 functions will function
in any case.

2. QT_CONFIG will contain "opengl" and "dynamicgl" in dynamic builds,
but never "angle" or "opengles2".

3. The preprocessor define QT_OPENGL_DYNAMIC is also available in
dynamic builds. The usage of this is strongly discouraged and should
not be needed anywhere except for QtGui and the platform plugin.

4. Code in need of the library handle can use
QOpenGLFunctions::platformGLHandle().

The decision on which library to load is currently based on a simple
test that creates a dummy window/context and tries to resolve an
OpenGL 2 function. If this fails, it goes for Angle. This seems to work
well on Win7 PCs for example that do not have proper graphics drivers
providing OpenGL installed but are D3D9 capable using the default drivers.

Setting QT_OPENGL to desktop or angle skips the test and forces
usage of the given GL. There are also two new application attributes
that could be used for the same purpose.

If Angle is requested but the libraries are not present, desktop is
tried. If desktop is requested, or if angle is requested but nothing
works, the EGL/WGL functions will still be callable but will return 0.
This conveniently means that eglInitialize() and such will report a failure.

Debug messages can be enabled by setting QT_OPENGLPROXY_DEBUG. This will
tell which implementation is chosen.

The textures example application is ported to OpenGL 2, the GL 1
code path is removed.

[ChangeLog][QtGui] Qt builds on Windows can now be configured for
dynamic loading of the OpenGL implementation. This can be requested
by passing -opengl dynamic to configure. In this mode no modules will
link to opengl32.dll or Angle's libegl/libglesv2. Instead, QtGui will
dynamically choose between desktop and Angle during the first GL/EGL/WGL
call. This allows deploying applications with a single set of Qt libraries
with the ability of transparently falling back to Angle in case the
opengl32.dll is not suitable, due to missing graphics drivers for example.

Task-number: QTBUG-36483
Change-Id: I716fdebbf60b355b7d9ef57d1e069eef366b4ab9
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
2014-02-14 10:51:44 +01:00
Frederik Gladhorn
a9c88c1f39 Merge remote-tracking branch 'origin/stable' into dev
Conflicts:
	src/gui/image/qimage.cpp
	src/gui/text/qtextengine.cpp
	src/plugins/platforms/linuxfb/qlinuxfbscreen.cpp
	src/printsupport/kernel/qprintengine_win.cpp

Change-Id: I09ce991a57f39bc7b1ad6978d0e0d858df0cd444
2014-02-12 16:28:07 +01:00
Frederik Gladhorn
df62c31807 Merge "Merge remote-tracking branch 'origin/stable' into dev" into refs/staging/dev 2014-02-11 15:12:00 +01:00
Kai Koehne
dc05fe7a5b Fix out-of-tree compilation of widget examples
'styles' are only defined in the qt build internals, when the
examples are compiled inside a configured Qt source. That's not
the case for the examples e.g. in the Qt SDK.

(windows is a default style on all platforms, anyway. So I
think the check is superfluous in the first place.)

Task-number: QTBUG-36655
Change-Id: I7114619efd479408dad99c8514f8e33ddcab7c7c
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2014-02-11 12:35:03 +01:00
Friedemann Kleint
59892468c9 widgets/mainwindows/mainwindow example: Use mouse release event for dock title.
Task-number: QTBUG-36364

Change-Id: Ie3352c8e72a636aee2099ca3138eb0ac77425e7e
Reviewed-by: Topi Reiniö <topi.reinio@digia.com>
2014-02-07 22:12:10 +01:00
Frederik Gladhorn
a1fe728fa5 Merge remote-tracking branch 'origin/stable' into dev
Conflicts:
	src/gui/kernel/qguiapplication.cpp
	src/plugins/platforms/android/androidjnimain.cpp
	src/plugins/platforms/android/qandroidplatformintegration.cpp
	src/plugins/platforms/android/qandroidplatformintegration.h
	src/plugins/platforms/android/qandroidplatformopenglcontext.cpp
	src/plugins/platforms/cocoa/qcocoawindow.h
	src/plugins/platforms/cocoa/qcocoawindow.mm
	src/plugins/platforms/xcb/qxcbconnection_xi2.cpp
	src/sql/doc/src/sql-driver.qdoc
	src/widgets/widgets/qtoolbararealayout.cpp

Change-Id: Ifd7e58760c3cb6bd8a7d1dd32ef83b7ec190d41e
2014-02-07 13:07:25 +01:00
Mitch Curtis
1d5ee90969 Update some more screenshots in qtbase/examples/widgets.
The screenshots were taken on Windows 7 with the Aero theme.

Change-Id: I2517664e25389f4fb87408daec7b720dfb785bf0
Reviewed-by: Topi Reiniö <topi.reinio@digia.com>
2014-01-31 16:18:07 +01:00
Nico Vertriest
0b26ad05bb Doc: corrected link/example errors
Update pro files after move gestures folder
Update snippet statements
Corrected path in imagegestures.pro

Task-number: QTBUG-34749

Change-Id: Icc19908914e36507e412ab63bf0cc2809aa48e17
Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
2014-01-31 16:18:07 +01:00
Mitch Curtis
14addd2cbb Update some screenshots in qtbase/examples/widgets.
The screenshots were taken on Windows 7 with the Aero theme.

Change-Id: Ief04c3a9c0084a778606ba72f1f3199119d5c64e
Reviewed-by: Topi Reiniö <topi.reinio@digia.com>
2014-01-31 14:46:31 +01:00
Friedemann Kleint
1fb42377a2 Fix MSVC-warnings about double to float truncation.
Change-Id: I4aef12bd8fe37dffb06fc7d0b6a330bfc42fa270
Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com>
2014-01-24 20:26:39 +01:00
Friedemann Kleint
558ae43b1b Fix MSVC-warnings about stray */* in sources.
Change-Id: Ifa8de548dc8df79fa2b5d884383dc120661cb45a
Reviewed-by: Topi Reiniö <topi.reinio@digia.com>
2014-01-24 18:50:05 +01:00
Nico Vertriest
4fab72a5eb Doc: corrected broken links
Links fixed:  Extra Filters
              Basic Tools
              blockingfortuneclient
              Thread Support
              Drag and drop examples
              qBinaryFind
              qmake common project types
              imagegestures
Task-number: QTBUG-34749
Change-Id: Ib93dda00716dc596db327fee5b97e110a9f27fa7
Reviewed-by: Martin Smith <martin.smith@digia.com>
2014-01-23 17:00:30 +01:00
Frederik Gladhorn
9033977d39 Merge remote-tracking branch 'origin/stable' into dev
Conflicts:
	src/corelib/global/qglobal.h
	src/corelib/tools/qstring.cpp
	src/gui/image/image.pri
	src/gui/image/qimage.cpp
	src/plugins/platforms/cocoa/qcocoawindow.h
	src/plugins/platforms/cocoa/qcocoawindow.mm
	src/plugins/platforms/eglfs/qeglfshooks_stub.cpp
	tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp

Change-Id: I3b9ba029c8f2263b011f204fdf68c3231c6d4ce5
2014-01-20 18:18:59 +01:00
Jonathan Liu
b765a0b19d Doc: Fix typo in Fade Message Effect Example documentation
Change-Id: I3a64f296d01f2b0147f87b406163ff25c4d12ada
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
2014-01-16 02:38:11 +01:00
Oswald Buddenhagen
882bf3475c expand tabs and related whitespace fixes in *.{cpp,h,qdoc}
the diff -w for this commit is empty.

Started-by: Thiago Macieira <thiago.macieira@intel.com>
Change-Id: I77bb84e71c63ce75e0709e5b94bee18e3ce6ab9e
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2014-01-13 22:46:50 +01:00
Simon Hausmann
b5ab7ee0d7 Merge remote-tracking branch 'origin/stable' into dev
Change-Id: Id13badc270db98806048753fd7fb658aa17f1ede
2014-01-03 14:30:21 +01:00
Jeff Tranter
2e8c3f7444 Fix some typos in documentation.
Fix some spelling and grammatical errors in comments that show up in Qt documentation. No changes to code.

Change-Id: I2e946fda0bd9a2117f8e9b2fb300df9bf0a98a6c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Topi Reiniö <topi.reinio@digia.com>
2014-01-02 17:21:09 +01:00
Frederik Gladhorn
f0fbff4c90 Merge remote-tracking branch 'origin/stable' into dev
Change-Id: I2defae1904154283446b069d151c3ef57302ec7b
2013-12-24 00:56:59 +01:00
Nico Vertriest
ac90b4c46f Doc: corrected broken links
Task-number: QTBUG-34749

Corrected link to drag and drop example.
Corrected link to {mandatory fields}
Created target referring to macros for defining plugins

Change-Id: I387a2d9bab428b2eacd8d371f08c72f42f7e2be2
Reviewed-by: Topi Reiniö <topi.reinio@digia.com>
2013-12-20 10:38:01 +01:00
Nico Vertriest
04133551a5 Doc: Move XML example documentation to correct location
Moving the examples documentation to resolve doc linking
issues.

Task-number: QTBUG-34749
Change-Id: I2adb1b5d37911c7df6a78a03741d3d43ab24eafb
Reviewed-by: Topi Reiniö <topi.reinio@digia.com>
2013-12-20 10:37:43 +01:00
Nico Vertriest
d9bad12fc8 Doc: solved link problem for dombookmarks.qdoc
Task-number: QTBUG-34749
Change-Id: I2f2fbf16314e069ab04e5c5ab4bcef9780c008a2
Reviewed-by: Venugopal Shivashankar <venugopal.shivashankar@digia.com>
Reviewed-by: Topi Reiniö <topi.reinio@digia.com>
2013-12-16 19:29:52 +01:00
Simon Hausmann
25b390256b Merge "Merge remote-tracking branch 'origin/stable' into dev" into refs/staging/dev 2013-12-09 10:13:48 +01:00
Oliver Wolff
e4af81f13a WinRT: Fixed compilation of bearermonitor example
Change-Id: I761ad1d85d97d7746d826225f03f95c2f04f8b88
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@digia.com>
2013-12-06 15:06:47 +01:00
Frederik Gladhorn
f6dbdd9c16 Merge remote-tracking branch 'origin/stable' into dev
Conflicts:
	src/sql/drivers/sqlite/qsql_sqlite.cpp

Change-Id: Ia7cffd2c99ae3d5eea6b5740683c06e921336dcd
2013-12-05 18:52:38 +01:00
Nico Vertriest
eaff48d362 Doc: Moved Books SQL Example documentation
Moved qdoc and image file to correct qdoc folder.
Added brief and ingroup statements to books.qdoc.

Task-number: QTBUG-34749

Change-Id: I5806ffd6f116cccf10238e3e1a9fc627ad0e93a9
Reviewed-by: Topi Reiniö <topi.reinio@digia.com>
2013-12-05 14:56:29 +01:00
Frederik Gladhorn
777cdb00e7 Merge remote-tracking branch 'origin/stable' into dev
Change-Id: Ibb342cc5fc55ff9a3f4b3ecbd53936b57bc13e63
2013-11-29 15:59:34 +01:00
Morten Johan Sørvig
af1dbfd223 Make OpenGL examples work on retina displays.
glViewport expects device pixels, but the various
geometry accessors returns values in device-independent
pixels.

Change-Id: I8004692de82251e4f1f25bf8f2698895f222ede3
Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
2013-11-29 10:05:24 +01:00
Frederik Gladhorn
4a8273a6fc Merge remote-tracking branch 'origin/stable' into dev
For the conflicts in msvc_nmake.cpp the ifdefs are extended since we
need to support windows phone in the target branch while it is not there
in the current stable branch (as of Qt 5.2).

Conflicts:
	configure
	qmake/generators/win32/msvc_nmake.cpp
	src/3rdparty/angle/src/libEGL/Surface.cpp
	src/angle/src/common/common.pri
	src/corelib/global/qglobal.h
	src/corelib/io/qstandardpaths.cpp
	src/plugins/platforms/qnx/qqnxintegration.cpp
	src/plugins/platforms/qnx/qqnxscreeneventhandler.h
	src/plugins/platforms/xcb/qglxintegration.h
	src/widgets/kernel/win.pri
	tests/auto/corelib/thread/qreadwritelock/tst_qreadwritelock.cpp
	tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp
	tests/auto/gui/text/qtextdocument/tst_qtextdocument.cpp
	tools/configure/configureapp.cpp

Change-Id: I00b579eefebaf61d26ab9b00046d2b5bd5958812
2013-11-26 22:35:48 +01:00
Mandeep Sandhu
60dc35e428 Examples: Add support for custom nameserver to dnslookup
Updated dnslookup example to take an optional nameserver argument
for doing DNS lookup against a specific nameserver.

Task-number: QTBUG-30166
Change-Id: I9f46f9f766b56f770d2c8372e3bfad5c71023c73
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2013-11-07 09:44:44 +01:00
Sze Howe Koh
16198d963d Doc: Fix broken links
Task-number: QTBUG-33360

Change-Id: Ic944cb2f575c35ebad64852ef5fc44a50ac03571
Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
Reviewed-by: Topi Reiniö <topi.reinio@digia.com>
2013-11-05 00:29:01 +01:00
Sze Howe Koh
6b8e866391 Doc: Clean up threading examples
- Example 3 (Clock) is a collection of anti-patterns.
    - It implements a slot in a QThread subclass and then forces the new
      thread to use Qt::DirectConnection to invoke the slot in the
      "wrong" thread.
    - It talks about getting away with non-thread-safe usage
    - It uses a thread as a timer and then admits that it's an over-
      complicated approach.
- Example 4 (Permanent Thread) is over-complicated yet incomplete. A
  better one exists in the QThread class ref.
- Example 1 (Thread Pool) is covered by the QThreadPool class ref.
- Example 2 (QtConcurrent::run()) is covered in the "Threading and
  Concurrent Programming Examples" page and the "QtConcurrentRun" page.
- The undocumented "Hello Thread" example is covered in the QThread
  class ref.
- These examples cannot be accessed from Qt Creator's Examples tool.
- These examples are neither widget-related nor tutorials, contrary to
  their source paths.

Task-number: QTBUG-33360
Change-Id: Ic79cb764ee925ddbcbeafee8e1d01db7fe0f6cfe
Reviewed-by: Topi Reiniö <topi.reinio@digia.com>
Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
2013-11-05 00:29:01 +01:00
Oswald Buddenhagen
f6a5e3d1e8 remove remaining non-concurrent branches from concurrent samples
amends 677825f0ba.

Change-Id: I8bc3ade3a1602b9a2c0bdc837f4b19c67b2e0dba
Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
2013-10-29 15:37:30 +01:00
Oto Magaldadze
e913972d52 added QAbstractSpinBox::setGroupSeparatorShown function.
[ChangeLog][QtWidgets][QAbstractSpinBox] QTBUG-5142 - This will
allow a group (thousand) separator to be shown in QSpinBox
and QDoubleSpinBox widgets.

Task-number: QTBUG-5142

Change-Id: I2e23f5f83c93bb092a2dbd784e06d17d40d42909
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2013-10-29 12:12:16 +01:00
Frederik Gladhorn
840f6a40e6 Merge remote-tracking branch 'origin/stable' into dev
Change-Id: Ie56539b2e0be611a363b5f15ae5412a78d6945a2
2013-10-24 12:48:42 +02:00
Oswald Buddenhagen
f14e268694 don't erroneously claim that gui support is needed
Change-Id: Ia7b1f02cab9fa0fc9e487ca49d75e85ed0cfee9d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2013-10-16 17:10:15 +02:00
Oswald Buddenhagen
677825f0ba remove non-concurrent branch from concurrent example
kinda stupid to have it ...

Change-Id: Icb31c524e04f43b0fb966c5500e22dfd574f969f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2013-10-16 17:10:15 +02: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
Frederik Gladhorn
d0eb444a49 Merge remote-tracking branch 'origin/stable' into dev
Change-Id: Ib8cfeee7d9ca15e8ad520e428b72c200827a8628
2013-10-11 16:12:35 +02:00
Tor Arne Vestbø
5466eb289f Remove warnings about examples not running in the Qt Simulator
The Qt Simulator is no longer supported with Qt 5.

Change-Id: I0f98351d482dd0554ea0754746d56f94ee6bf22f
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
2013-10-09 21:45:31 +02:00
Sergio Ahumada
16a36239ab Merge branch 'stable' into dev
Change-Id: I06694436322a7810a163b27b8a059cee2b046f06
2013-09-27 11:15:09 +02:00
Gabriel de Dietrich
db9abc72ef QMacNativeWidget: Have example use a delegate
This would be the case in most if not all the real life use cases.

Change-Id: Ib7ebc6dbe471ce50f4bd1df9becba8e9806008e7
Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
2013-09-26 22:25:10 +02:00
Andrew Knight
8cc0f19f83 WinRT: Don't build the network-chat example
WinRT doesn't support QProcess, so the network-chat example shouldn't be
built there.

Change-Id: I7885a992d3b8baffd5530c694063140535240f07
Reviewed-by: Oliver Wolff <oliver.wolff@digia.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
2013-09-26 17:26:56 +02:00
Morten Johan Sørvig
68b42cd595 Port QMacCocoaViewContainer to Qt 5.
Includes example.

Change-Id: Ifdda5c535d0ec41694712405d921b2c32cb8dfc8
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
2013-09-23 07:18:27 +02:00
Morten Johan Sørvig
f370f77e48 Port QMacNativeWidget to Qt 5
Also adds examples/widgets/mac subdir for Mac specific examples,
starting with one for this feature.

Change-Id: I4cc7d84ce3d7562259d6206faa5d6996c2392a3e
Reviewed-by: Liang Qi <liang.qi@digia.com>
2013-09-23 07:18:24 +02:00
Sergio Ahumada
a5d34b34fb Merge branch 'stable' into dev
Change-Id: I37d85631ab1165ab91457d8880c4da907a9df73b
2013-09-21 17:33:15 +02:00
Marc Mutz
579de35909 stickman example: fix header include guard
Change-Id: I65f2187b309f075035ad6c8beab40bf2a177140c
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
2013-09-16 21:30:54 +02:00