summaryrefslogtreecommitdiffstats
path: root/src/widgets/kernel/qopenglwidget.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Start supporting purely offscreen QOpenGLWidgetLaszlo Agocs2017-06-081-9/+23
| | | | | | | | | | | | | | | | | | | | | | | Due to popular demand. It does have it benefits (especially when it comes to convenience) to allow grabbing QOpenGLWidgets even when they are not part of an actual window and are not actually visible. Does not involve much more than dropping the warnings and bailouts when there is active native window (because the QOpenGLWidget/its parents are still hidden). In addition the device pixel ratio from metric() has to be fixed as well. [ChangeLog][Qt Widgets] QOpenGLWidget is now able to render and return its content via grabFramebuffer(), QWidget::grab() or QWidget::render() even when the widget has not been made visible. Task-number: QTBUG-47185 Task-number: QTBUG-61280 Change-Id: Icc2b0b3ce9778a3eb6409d54744238568abb0f0d Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Merge remote-tracking branch 'origin/5.9' into devLiang Qi2017-05-071-6/+2
|\ | | | | | | | | | | | | | | Conflicts: src/network/access/qnetworkreply.cpp tests/auto/corelib/kernel/qmetaobject/tst_qmetaobject.cpp Change-Id: Iadf766269454087e69fb216fc3857d85b0ddfaad
| * QOpenGLWidget: Fix UB (invalid cast) in ~QOpenGLWidgetPrivateDyami Caliri2017-04-271-6/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The QOpenGLWidgetPrivate destructor calls reset(), which accesses the Q-pointer. Calling Q_Q(Class) while still inside the private class's destructor is wrong due to the cast in q_func() which is undefined behavior at that stage. Here is the UB report: qopenglwidget.cpp:548:5: runtime error: downcast of address 0x000016d0e200 which does not point to an object of type 'QOpenGLWidget' 0x000016d0e200: note: object is of type 'QObject' 00 00 00 00 10 30 32 0f 00 00 00 00 40 e2 d0 16 00 00 00 00 80 7b 42 0f 00 00 00 00 00 00 00 00 ^~~~~~~~~~~~~~~~~~~~~~~ vptr for 'QObject' 0 QOpenGLWidgetPrivate::reset qopenglwidget.cpp 656 0x607e667 1 QOpenGLWidgetPrivate::~QOpenGLWidgetPrivate qopenglwidget.cpp 570 0x60982ab 2 QOpenGLWidgetPrivate::~QOpenGLWidgetPrivate qopenglwidget.cpp 569 0x6098516 3 QScopedPointerDeleter<QObjectData>::cleanup qscopedpointer.h 54 0xcbf7058 4 QScopedPointer<QObjectData, QScopedPointerDeleter<QObjectData>>::~QScopedPointer qscopedpointer.h 101 0xcbde858 5 QObject::~QObject qobject.cpp 1042 0xcb94792 6 QWidget::~QWidget qwidget.cpp 1701 0x5e173f7 7 QOpenGLWidget::~QOpenGLWidget qopenglwidget.cpp 946 0x608d72b 8 ImagePreviewComponent::~ImagePreviewComponent imagepreviewcomponent.h 16 0x58237b6 9 ImagePreviewComponent::~ImagePreviewComponent imagepreviewcomponent.h 16 0x58238c6 Change-Id: If13932ac657afb9d1358ac82ab911a05e96cfbcd Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* | Docs: Fix some warningsFriedemann Kleint2017-04-211-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | qtbase/src/corelib/tools/qbytearray.cpp:3043: warning: Can't link to '.' qtbase/src/corelib/tools/qstring.cpp:4522: warning: Can't link to '.' qtbase/src/corelib/tools/qstring.cpp:10331: warning: Can't link to '.' qtbase/src/network/access/qhstspolicy.cpp:105: warning: Undocumented parameter 'flags' in QHstsPolicy::QHstsPolicy() qtbase/src/network/access/qhstspolicy.cpp:105: warning: No such parameter 'includeSubDomains' in QHstsPolicy::QHstsPolicy() qtbase/src/network/access/qnetworkaccessmanager.cpp:732: warning: Undocumented parameter 'knownHosts' in QNetworkAccessManager::addStrictTransportSecurityHosts() qtbase/src/network/access/qnetworkreply.cpp:307: warning: Can't link to 'QNetworkRequest::UserVerifiedRedirectsPolicy' qtbase/src/gui/painting/qpagedpaintdevice.cpp:246: warning: No such enum item 'PdfFormat_1_4' in QPagedPaintDevice::PdfVersion qtbase/src/gui/painting/qpagedpaintdevice.cpp:246: warning: Undocumented enum item 'PdfVersion_1_4' in QPagedPaintDevice::PdfVersion qtbase/src/gui/painting/qpagedpaintdevice.cpp:246: warning: Undocumented enum item 'PdfVersion_A1b' in QPagedPaintDevice::PdfVersion qtbase/src/gui/painting/qpagedpaintdevice.cpp:246: warning: No such enum item 'PdfFormat_A1b' in QPagedPaintDevice::PdfVersion qtbase/src/widgets/kernel/qopenglwidget.cpp:1076: warning: Undocumented parameter 'texFormat' in QOpenGLWidget::setTextureFormat() qtbase/src/corelib/tools/qversionnumber.cpp:460: warning: Command '\snippet (//! [3-latin1-1])' failed at end of file 'qversionnumber/main.cpp' Change-Id: Icc163dd8d94cee7e0858040bf8241a3c1f1d221d Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* | Merge remote-tracking branch 'origin/5.9' into devLiang Qi2017-03-201-0/+14
|\| | | | | | | | | | | | | | | | | Conflicts: src/corelib/io/qfilesystemengine_win.cpp src/gui/text/qdistancefield.cpp src/plugins/platforms/xcb/qxcbconnection.h Change-Id: I1be4a6f440ccb7599991159e3cb9de60990e4b1e
| * Set default fbo redirect correctly for QOpenGLWidget viewportsLaszlo Agocs2017-03-181-0/+14
| | | | | | | | | | | | Task-number: QTBUG-59318 Change-Id: Icf2ea4e5ebdeec31750edc8b34a9b9f6bfb64744 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* | Compose renderToTexture widgets with sRGB when neededLaszlo Agocs2017-02-261-0/+30
| | | | | | | | | | | | | | | | | | | | | | Just requesting an sRGB texture for a QOpenGLWidget does not lead to anything useful when it comes to the end result, the content will just get darkened. For proper operation the target window's default framebuffer must be sRGB capable and linearization during blending must be enabled. Task-number: QTBUG-50987 Change-Id: Ibad0657c29a720590fa22c84c4bc303302de6dc0 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* | Add support for custom texture format in QOpenGLWidgetLaszlo Agocs2017-02-261-3/+51
|/ | | | | | | | | | | | | | ...in order to support sRGB framebuffers. Add a --srgb option to the qopenglwidget example to allow testing. [ChangeLog][QtWidgets][QOpenGLWidget] Added support for specifying custom internal texture formats in QOpenGLWidget in order to make it possible to have the widget backed by an sRGB-capable framebuffer. Task-number: QTBUG-50987 Change-Id: I112e2f0ab0b1478c69e601031aa0bafaa87fa847 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-08-131-2/+2
|\ | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/global/qglobal.cpp src/corelib/io/qsettings.cpp src/corelib/itemmodels/qstringlistmodel.cpp tests/auto/gui/image/qimagewriter/tst_qimagewriter.cpp Change-Id: I1c6c306ef42c3c0234b19907914b19da706b4a03
| * Doc: Change instances of '(Mac) OS X' to 'macOS'Topi Reinio2016-08-121-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As of version 10.12 (Sierra), the name of Apple's desktop operating system will be macOS. Change the occurrences where the Mac platform is discussed to use a macro \macos, which expands to 'macOS'. This helps with adapting to future renaming. Update the instructions on mac-specific Q_OS_* macro usage. Add a \target for the old 'Qt for OS X' topic to keep links working for other documentation modules that try to link with the old name. Change-Id: Id33fb0cd985df702a4ae4efb4c5fd428e77d9b85 Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
* | Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-06-061-1/+3
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: .qmake.conf config.tests/unix/nis/nis.cpp mkspecs/unsupported/freebsd-g++/qplatformdefs.h src/corelib/tools/qdatetime.cpp src/corelib/tools/qsimd.cpp src/corelib/tools/qsimd_p.h src/network/access/access.pri src/network/access/qnetworkreplynsurlconnectionimpl.mm src/network/access/qnetworkreplynsurlconnectionimpl_p.h src/plugins/platforms/cocoa/qnsview.mm src/plugins/printsupport/windows/qwindowsprintdevice.cpp tests/auto/corelib/kernel/qobject/tst_qobject.cpp tests/auto/network/access/qnetworkreply/BLACKLIST tests/auto/widgets/widgets/qopenglwidget/BLACKLIST Change-Id: I4b32055bbf922392ef0264fd403405416fffee57
| * Avoid missing paints when resizing GV with QOpenGLWidget viewportLaszlo Agocs2016-05-241-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There is nothing guaranteeing there will be a paint request after resizeViewportFramebuffer() is called. However we must not be left with a framebuffer with uninitialized content. So trigger an update. Include also a half-hearted autotest. QOpenGLWidget (or QGLWidget) viewports have not been autotested at all. Try to verify that it is functional at least, even if we cannot check the actual output. Change-Id: I34d78fe32e94c39dad919216b5a4f4bb2aea3cc2 Task-number: QTBUG-52419 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Paul Olav Tvete <paul.tvete@theqtcompany.com>
* | Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-03-211-0/+2
|\| | | | | | | | | | | | | | | | | Conflicts: src/widgets/styles/qgtkstyle_p.cpp tests/auto/corelib/io/qtextstream/test/test.pro tests/auto/corelib/plugin/plugin.pro Change-Id: I512bc1b36acf3933ed2b96c00f476ee3819c1f4b
| * QtWidgets: includemocsMarc Mutz2016-03-181-0/+2
| | | | | | | | | | | | | | | | A very simple way to save ~3KiB in test size and 440b in data size on GCC 5.3 Linux AMD64 release builds. Change-Id: I6619148cc497116b9772a00e1bc30d573a2b2534 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* | Updated license headersJani Heikkinen2016-01-151-14/+20
| | | | | | | | | | | | | | | | | | | | | | From Qt 5.7 -> LGPL v2.1 isn't an option anymore, see http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/ Updated license headers to use new LGPL header instead of LGPL21 one (in those files which will be under LGPL v3) Change-Id: I046ec3e47b1876cd7b4b0353a576b352e3a946d9 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* | Merge remote-tracking branch 'origin/5.6' into devSimon Hausmann2015-11-271-2/+1
|\| | | | | | | Change-Id: Ib43c6f126998eefcfed9a7c1f2bcbac8b4dd05ec
| * Send a paint after resize correctly from QOpenGLWidgetLaszlo Agocs2015-11-231-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Due to recreating the underlying framebuffer we absolutely need a re-render. However, going directly through paintGL() is wrong since application code may override paintEvent() instead. Such code would then miss these repaint requests. To overcome this, simply rely on paint events, like the normal code path does. Task-number: QTBUG-49466 Change-Id: I6ddb9eb53bedb1655a9714b9b77faa1c439766a2 Reviewed-by: Paul Olav Tvete <paul.tvete@theqtcompany.com>
* | QtWidgets: use Q_UNLIKELY for every qWarning() (2)Marc Mutz2015-11-251-7/+7
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | If, after checking a condition, we issue a qWarning(), by definition that check is unlikely to be true. Tell the compiler so it can move the error handling code out of the normal code path to increase the effective icache size. This change contains the changes to the accessible/, effects/, kernel/, styles/ and itemviews/ subdirs. Moved conditional code around where possible so that we could always use Q_UNLIKELY, instead of having to revert to Q_LIKELY here and there. In QWidgetPrivate::setWindowModified_helper(), as a drive-by, I swapped the evaluation order of an &&-expression (newly wrapped in Q_UNLIKELY) to be more readable and more efficient (cheaper check first) at the same time. In qDraw* (qdrawutil.cpp), simplified boolean expressions (sometimes by skipping re-checking conditions already checked in a previous guard clause). Change-Id: I58be22be0a33522c2629a66c2f6c795771a99f3f Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* Support mixing native child widgets with texture-based onesLaszlo Agocs2015-11-191-6/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently QOpenGLWidget and QQuickWidget do not support having native child widgets inside the same top-level window. In some cases this is inevitable, f.ex. multimedia may require native windows when used from widget apps. winId() calls made for various (valid or invalid) reasons are also problematic. There are no blockers for supporting this setup, however. By storing multiple texture lists (one for each subtree where the root is a native widget), adding the missing markDirtyOnScreen calls, letting each native widget access the correct texture list (i.e. the one corresponding to its children) when they are (separately) flushed, and fixing composeAndFlush() to take the update region and the (native child) offset into account, it can all be made functional. The change also fixes the issue of keeping GL-based compositing enabled even after all render-to-texture widgets in the window become hidden. Due to the changes of how such widgets are gathered, composeAndFlush() is not invoked anymore when no such widgets are discovered for a given native parent. This is great since having compositing enabled infinitely is an issue for applications like Qt Creator that implement certain views with QQuickWidgets but cannot afford the cost of texture uploads in other places (e.g. for the text editor) on slower machines. The openglwidget manual test is greatly enhanced to test various situations (MDI, scroll areas, tab widgets, QOpenGLWidget as native child, QOpenGLWidget with non-tlw native parent, etc.) Task-number: QTBUG-48130 Task-number: QTBUG-49172 Change-Id: Iad098359c8bcf749f01c050da0853415e1550eda Reviewed-by: Paul Olav Tvete <paul.tvete@theqtcompany.com> Reviewed-by: Morten Johan Sørvig <morten.sorvig@theqtcompany.com>
* QtWidgets: use printf-style qWarning/qDebug where possible (I)Marc Mutz2015-10-271-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | The printf-style version of QDebug expands to a lot less code than the std::ostream-style version. Of course, you pay in type safety (but compilers warn about it these days), you cannot stream complex Qt types and streaming QStrings is awkward, but in many cases you actually improve on readability. But the main reason is that something that's not supposed to be executed under normal operation has no business bloating executable code size. This is not an attempt at converting all qWarnings() to printf-style, only the low-hanging fruit. In this first part, replace qWarning() << "..."; with qWarning("..."); Change-Id: I1f6869b024103c98262f1deae014e0d7337a541c Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* QOpenGLWidget: Fix grabbing multisample framebuffersLaszlo Agocs2015-10-141-2/+13
| | | | | | | Task-number: QTBUG-48450 Change-Id: I0a680e0d682c7c08c3aea40d922bbf2ad66c1de0 Reviewed-by: Joni Poikelin <joni.poikelin@theqtcompany.com> Reviewed-by: Paul Olav Tvete <paul.tvete@theqtcompany.com>
* QOpenGLWidget: Do not recurse when calling grabFramebuffer() from paintGL()Laszlo Agocs2015-10-141-2/+8
| | | | | | Task-number: QTBUG-48450 Change-Id: I14b1ff40727f705d8b89371b4d3bb5d6adc139fe Reviewed-by: Paul Olav Tvete <paul.tvete@theqtcompany.com>
* Fix up QOpenGLWidget transparency supportLaszlo Agocs2015-09-241-9/+13
| | | | | | | | | | | | | | | The glColorMask call was troublesome. In addition, the Qt::WA_TranslucentBackground was misinterpreted and recommended misleadingly in the documentation. The hellogl2 example's --transparent argument was disfunctional in practice. Replace glColorMask with glBlendFuncSeparate. The hellogl2 example and the docs are now corrected wrt enabling semi-transparency in a QOpenGLWidget that is not a top-level (which is the most common case). Task-number: QTBUG-47276 Change-Id: I6f40e732d455f5efcf158649ac9a52ff9f240e85 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
* Avoid multisampled contexts in QOpenGLWidgetLaszlo Agocs2015-08-051-2/+11
| | | | | | | | | | | | | | as it is not needed at all. Multisampled FBOs do not need multisampled configs. What's more, this fixes crashing Mesa with Intel and EGL, where creating a pbuffer for a config with multisampling simply crashes. (and due to other issues we disable surfaceless QOffscreenSurface for Intel so the pbuffer cannot be avoided) Task-number: QTBUG-47509 Change-Id: I3ae3fae8513a6dc64ca4ab11c61d4777c6c09cec Reviewed-by: Andy Nichols <andy.nichols@theqtcompany.com>
* Enable non-integer device pixel ratioMorten Johan Sørvig2015-07-301-11/+17
| | | | | | | | | | | | | | | | | | | | Work around QPaintDevice::metric's int return type by adding a new metric that returns a scaled devicePixelRatio. Choose a scale factor that gives us more than enough range. The QPaintDevice::devicePixelRatio() convenience accessor is public API and can unfortunately not be changed to return a qreal. Add devicePixelRatioF() which returns the (unscaled) devicePixelRatio. Change all call sites of QPaintDevice::devicePixelRatio() to use QPainDevice::devicePixelRatioF(). Task-number: QTBUG-46615 Change-Id: I97ec4000fe379b7ff5e1624a871ae2512790aad9 Reviewed-by: Paul Olav Tvete <paul.tvete@theqtcompany.com> Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* Fix incorrect warning message in QOpenGLWidgetLaszlo Agocs2015-06-221-1/+1
| | | | | Change-Id: I3b99894171a3e63b75a14357a1be0c0dd1f45e93 Reviewed-by: Jørgen Lind <jorgen.lind@theqtcompany.com>
* Emphasize the need for calling setDefaultFormat early on OS XLaszlo Agocs2015-05-291-0/+6
| | | | | | Task-number: QTBUG-46067 Change-Id: I0fe6e7ba309306a8fc471424b30eed4491bd39e7 Reviewed-by: Topi Reiniö <topi.reinio@digia.com>
* Create contexts and pbuffers with the correct screen in QOpenGLWidgetLaszlo Agocs2015-05-121-0/+2
| | | | | | | | It won't be functional otherwise with GLX when the QOpenGLWidget is targeting a separate X screen. Change-Id: Ibe5b89023f833039bb67d94b78b173de2e021ac9 Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
* Fix incorrect FBO bindings with QOpenGLWidgetLaszlo Agocs2015-03-301-1/+9
| | | | | | | | | | | | | | QOpenGLContext::defaultFramebufferObject() knows nothing about QOpenGLWidget and QQuickWidget. The problem is that this function (and others that rely on it) is expected to give the widget's backing FBO in paintGL() and friends. To overcome this, we have to provide a way for such widgets that indicate what is the expected "default fbo". Task-number: QTBUG-43269 Change-Id: I43f439f8609382b9f7004707ab0ef9f091952b4f Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
* Add a section about QOpenGLWidget alternativesLaszlo Agocs2015-03-251-0/+17
| | | | | | | | | QOpenGLWindow with createWindowContainer() can be an option for desktop-only apps in some special cases. Document this. Task-number: QTBUG-45192 Change-Id: I7c59b7d04d6c0fe58ffe93ac72b204103bef2f4c Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
* Use glFinish() in QOpenGLWidget unless glFlush() is known to be enoughLaszlo Agocs2015-03-231-3/+3
| | | | | | | | | | | | | | | | | | | | The driver used on the Odroid-XU3 does not like doing just glFlush() before accessing the texture in another context. There is no guarantee that glFlush() is enough to sync access to resources between contexts, so start using glFinish() as the default, except on common desktop hw + iOS where flush is enough and presumably more efficient. To unify the code pathes, remove the separate flushes and do it only once, before the backingstore compositor indicates that it is about to access the textures. This should improve performance a bit, esp. when doing multisampling since we flush only once then. A helper function is added to the internal QOpenGLExtensions because it is highly likely that QQuickWidget will need the same. Task-number: QTBUG-45106 Change-Id: Ifb405c5723f29f2f6c04df8e15fb70280681755e Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* Add missing flush for multisampled QOpenGLWidgetLaszlo Agocs2015-03-091-0/+1
| | | | | | | | QOpenGLWidget exhibits the same issue as QQuickWidget in the linked bug. Task-number: QTBUG-39917 Change-Id: Ib231fb88f73c6ef68f12cc3fecf462679e8184a7 Reviewed-by: Jørgen Lind <jorgen.lind@theqtcompany.com>
* Update copyright headersJani Heikkinen2015-02-111-7/+7
| | | | | | | | | | | | | | | | | | 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>
* Merge remote-tracking branch 'origin/5.4' into devFrederik Gladhorn2015-02-101-0/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/3rdparty/harfbuzz-ng/harfbuzz-ng.pro src/gui/image/qimage_conversions.cpp src/gui/opengl/qopenglextensions_p.h src/gui/text/qtextengine.cpp src/network/ssl/qsslsocket_openssl.cpp src/plugins/platforms/eglfs/qeglfshooks_stub.cpp src/plugins/platforms/eglfs/qeglfsscreen.cpp src/plugins/platforms/eglfs/qeglfswindow.cpp src/plugins/platforms/windows/qwindowsfontdatabase.cpp src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp src/plugins/platforms/windows/qwindowsnativeinterface.cpp src/plugins/platforms/windows/qwindowsscreen.cpp src/plugins/platforms/windows/qwindowswindow.cpp src/plugins/platforms/windows/qwindowswindow.h src/plugins/platforms/xcb/qxcbdrag.h src/widgets/itemviews/qabstractitemview.cpp src/widgets/kernel/qwidget.cpp src/widgets/util/qsystemtrayicon_p.h tests/auto/corelib/itemmodels/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp Thanks to Friedemann Kleint for resolving the qwindowsfontdatabase.cpp conflicts. Change-Id: I937232c30523d5121c195d947d92aec6f129b03e
| * Set dpr of QImage in QOpenGLWidget grabFramebufferDyami Caliri2015-02-031-0/+1
| | | | | | | | | | | | | | | | The QImage returned from grabFramebuffer should have the dpr of the source. Change-Id: Iafeabc1ab4e032fc28b73307104917ba3e898ad5 Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
* | QOpenGLWidget/Window: improve docs for the dtorGiuseppe D'Angelo2015-02-071-1/+3
| | | | | | | | | | | | | | Remove a typo and add the standard sentence about a dtor. Change-Id: Ie21ad6d2e83977705ea43fdc872d08f496a32376 Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
* | Avoid warning in makeCurrentLaszlo Agocs2015-01-281-3/+1
| | | | | | | | | | | | | | | | This warning is not necessary. We don't warn in doneCurrent or QOpenGLWindow either. Task-number: QTBUG-44094 Change-Id: Icb3cf51137258c939d5dfb653cf98ded3c147aac Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
* | QOpenGLWidget/QOpenGLWindow: add a destructor which calls makeCurrentGiuseppe D'Angelo2015-01-241-2/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Generally speaking, QOpenGLWindow subclasses are going to use some various QOpenGL* wrapper object to handle their buffers, FBOs, etc. Some of those QOpenGL* wrappers are QObjects, hence it should be safe to have them as child objects, and expect Qt to clean them up properly; but that doesn't happen because of how the destruction will work. In particular, when the subclass object is deleted, there may not be the right OpenGL context set as current. The deletion will go up to ~QObject, where the child objects will be deleted, resulting in a crash. That will *also* happen if someone connected to the context's aboutToBeDestroyed() signal: the context will in fact be deleted after the child objects, since it's stored in QOpenGLWindowPrivate, whose dtor will be run after ~QObject (!). Now, in the general case, QOpenGLWindow subclasses should always have a dtor in which they call makeCurrent() (also because various QOpenGL* class are not QObjects, hence they're kept around as full members instead of pointers-to); but at the same time we should clean up properly the QObject children. All of the above of course stands for QOpenGLWidget as well. Task-number: QTBUG-44094 Change-Id: I2379041fe175416936f6d40292039f773a515b35 Reviewed-by: Sean Harmer <sean.harmer@kdab.com> Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
* | Fix discard framebuffer support in QOpenGLWidgetLaszlo Agocs2014-12-211-4/+4
| | | | | | | | | | | | | | | | | | | | | | The enum values are different for the default framebuffer and non-default ones. With QOpenGLWidget there is always a non-default fb bound, so the correct way is to use GL_COLOR_ATTACHMENT0 etc. GL_COLOR_EXT and friends are only allowed when the default framebuffer is bound, as per spec. Change-Id: Ia8c27038dc899e44d1a95eb88adbc1cac72652b0 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> Reviewed-by: Jørgen Lind <jorgen.lind@theqtcompany.com>
* | Add NoPartialUpdate support to QOpenGLWidgetJørgen Lind2014-12-111-5/+93
|/ | | | | | | | | | [ChangeLog][QtWidgets][QOpenGLWidget] Added an UpdateBehavior flag to QOpenGLWidget and enabled support for NoParitalUpdate for QOpenGLWidget. NoPartialUpdate is the default update behavior for QOpenGLWidget. Task-number: QTBUG-40717 Change-Id: I47d11460e4ef899a24cfd4964ddcac57bc3f91ff Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
* Merge remote-tracking branch 'origin/5.4.0' into 5.4Frederik Gladhorn2014-11-211-1/+1
|\ | | | | | | Change-Id: I95f235a66ce2e9b1fa435c0f911c6f7e811755f0
| * Correct the signature and access rights for the protected constructorLars Knoll2014-11-191-1/+1
| | | | | | | | | | Change-Id: Ic43398a82777f3b1a95a36f60ebc4338d60c29ec Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
* | Fix broken resource cleanup in QOpenGLWidgetLaszlo Agocs2014-11-171-0/+10
|/ | | | | | | | | | | | | | | The context has to be made current. Otherwise we may fail to clean up or, what's worse, we may delete FBOs and textures in some random context. The latter was visible with ANGLE in the qopenglwidget example. When having two QOpenGLWidget instances, the context for the second happened to be the current one when destroying the first. This is now avoided by making sure the correct context is current when deleting the FBOs. Task-number: QTBUG-42696 Change-Id: I8c1eed7c13a869968cc67141e585d02c6bc6f279 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
* Avoid breaking BC with new virtuals in QOpenGLPaintDeviceLaszlo Agocs2014-10-161-11/+22
| | | | | | Task-number: QTBUG-41046 Change-Id: Iab628d2d6811d528e2cc513b6f8a74baa628541d Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
* Fix QOpenGLWidget on Cocoa when used as viewportLaszlo Agocs2014-10-141-4/+66
| | | | | | | | | | | | | | | | | | | | | | | Having a QOpenGLWidget as a graphics view viewport was not functioning on OS X: it was showing incomplete content due to accessing the texture attached to the framebuffer object before the rendering is complete. On the normal path, when rendering is done via paintGL(), the flush was there. When used as a viewport however, this path is not used. The missing flush is now added for the other case too. For performance reasons, we will not flush on every paint engine end(). Instead, the flush is deferred until composition starts. QGLWidget also featured a weird on-by-default autoFillBackground concept. To maintain compatibility with apps that used QGLWidget as the viewport for QGraphicsView, we will now do the same for QOpenGLWidget, but only when it is used as a viewport. For regular QOpenGLWidgets autoFillBackground defaults to false, like for any other widget. The docs are extended with a small section about differences between QGLWidget and QOpenGLWidget. Task-number: QTBUG-41046 Change-Id: I42c2033fdd2ef5815783fd640fe11373761061e0 Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
* Add a warning when using QOpenGLWidget as a native childLaszlo Agocs2014-10-101-0/+6
| | | | | | | | | Just like it is done for QQuickWidget. Task-number: QTBUG-41779 Change-Id: I1b27c2ed34ecb2520edf82843b675dbf6b0eab8e Reviewed-by: Michael Bruning <michael.bruning@digia.com> Reviewed-by: Paul Olav Tvete <paul.tvete@digia.com>
* Doc: Use title case in section1 titlesNico Vertriest2014-09-301-4/+4
| | | | | | | | Using Python script title-cased.py Task-number: QTBUG-41250 Change-Id: I00d3d7a0b30db7304a7904efd6d63abd9a7b493b Reviewed-by: Topi Reiniö <topi.reinio@digia.com>
* Update license headers and add new license filesMatti Paaso2014-09-241-18/+10
| | | | | | | | | - Renamed LICENSE.LGPL to LICENSE.LGPLv21 - Added LICENSE.LGPLv3 - Removed LICENSE.GPL Change-Id: Iec3406e3eb3f133be549092015cefe33d259a3f2 Reviewed-by: Iikka Eklund <iikka.eklund@digia.com>
* QOpenGLWidget: Play nice with empty paintGLLaszlo Agocs2014-09-181-0/+1
| | | | | | | | | | | Applications that do not override paintGL() (may happen in some test code) will not perform any GL rendering, not even clearing. This is fine, but to be safe we need to do a clear right after creating the FBO in order to prevent showing garbage. Task-number: QTBUG-38327 Change-Id: If062901bb18724f961e41856085470e37b49abbe Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
* Add a note about winId() to QOpenGLWidget docsLaszlo Agocs2014-09-181-0/+3
| | | | | | Task-number: QTBUG-40765 Change-Id: I0dbb010bb96c6b41c67392b8846782a354481e5e Reviewed-by: Paul Olav Tvete <paul.tvete@digia.com>