summaryrefslogtreecommitdiffstats
path: root/examples/widgets/graphicsview/boxes
Commit message (Collapse)AuthorAgeFilesLines
* qtlite: Skip building examples when configured with no-feature-itemviewsRainer Keller2018-01-121-0/+1
| | | | | | | | | Compiling the default examples should be possible without compile errors. Task-number: QTBUG-53141 Change-Id: I73d8787241291ae6230861a89b38e91d900fede0 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Change almost all other uses of qrand() to QRandomGeneratorThiago Macieira2017-11-082-4/+8
| | | | | | | | | | | | | | | | | | | The vast majority is actually switched to QRandomGenerator::bounded(), which gives a mostly uniform distribution over the [0, bound) range. There are very few floating point cases left, as many of those that did use floating point did not need to, after all. (I did leave some that were too ugly for me to understand) This commit also found a couple of calls to rand() instead of qrand(). This commit does not include changes to SSL code that continues to use qrand() (job for someone else): src/network/ssl/qsslkey_qt.cpp src/network/ssl/qsslsocket_mac.cpp tests/auto/network/ssl/qsslsocket/tst_qsslsocket.cpp Change-Id: Icd0e0d4b27cb4e5eb892fffd14b5285d43f4afbf Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Exploit QVector3D::length() instead of duplicating its workEdward Welbourne2017-07-071-1/+1
| | | | | | | | | Calling the class-method dotProduct(x, x) in order to then take its square root is a clumsy way to obfuscate x.length() - and lacks its efforts (clumsy though they are) to limit rounding issues. Change-Id: I1dc1f38764651bc70c0620e286cb5625f505ddbf Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* Use qRadiansToDegrees() and qDegreesToRadians() more widelyEdward Welbourne2017-07-052-5/+7
| | | | | | | | | | | | | | | | Especially in examples, where we should show off our convenience functions, prefer calling these functions over doing arithmetic with M_PI (or approximations thereto) and 180 (give or take simple factors). This incidentally documents what's going on, just by the name of the function used (and reveals at least one place where variables were misnamed; the return from atan is in radians, *not* degrees). Task-number: QTBUG-58083 Change-Id: I6e5d66721cafab423378f970af525400423e971e Reviewed-by: Jüri Valdmann <juri.valdmann@qt.io> Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* Be (somewhat more) consistent about the value of piEdward Welbourne2017-06-202-4/+3
| | | | | | | | | | | | | | | | | | | | Use M_PI (and friends), where possible, in favor of hand-coded approximations of various (in)accuracies. Where that's not available (e.g. fragment shaders), use the same value that qmath.h uses for M_PI, for consistency. Replaced math.h with qmath.h in places that defined a fall-back in case math.h omits it (it's not in the C++ standard, although M_PI is in POSIX); or removed this entirely where it wasn't used. Reworked some code to reduce the amount of arithmetic needed, in the process; e.g. pulling common factors out of loops. Revised an example's doc to not waste time talking about using a six-sig-fig value for pi (which we no longer do) - it really wasn't relevant, or anything to be proud of; nor did the doc mention its later use. Task-number: QTBUG-58083 Change-Id: I5a31e3a2b6a823b97a43209bed61a37b9aa6c05f Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Remove some more register keywordsMarc Mutz2017-05-061-1/+1
| | | | | | | They're deprecated since C++11 and removed in C++17. Change-Id: Ia2acd9312707bfee96838743645a04ae1780e5dd Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Examples: Remove more redundant virtual specifiers for overridersAlexander Volkov2016-11-292-3/+3
| | | | | Change-Id: I3e378c656a2651fb7031b6cf6a6939dfc5576519 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Examples: Remove a redundant virtual specifier for overridersAlexander Volkov2016-11-253-33/+33
| | | | | | | | It's a good practice to use override without virtual: https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#Rh-override Change-Id: I5c2d73600e6c706424589c0487133c03a4ef3629 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Change confusing Q_DEAD_CODE_FROM_QT4_FOO defineTor Arne Vestbø2016-10-141-1/+1
| | | | | | | | | | | | | | | | | | | Commit c5db8fc74 changed all instances of Q_WS_FOO to have the prefix Q_DEAD_CODE_FROM_QT4 instead, to make it clearer when reading the code that the code in question was a left-over from Qt4, when we used Q_WS_ defines instead of Q_OS_ defines. This worked well for cases of #ifdef Q_DEAD_CODE_FROM_QT4, but less so for cases of #ifndef Q_DEAD_CODE_FROM_QT4, where the code was actually unconditionally included. To make this even clearer, the defines have been replaced by checks for 1 or 0, with a comment describing how the code used to look in Qt4. The use of constants in the check also makes it easier for editors to parse the condition and show visually that the code is defined out. Change-Id: I152070d87334df7259b417cd5e17d7b7950379b7 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Use qtConfig throughout in qtbaseLars Knoll2016-08-191-1/+1
| | | | | | | | | | | 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>
* Examples: Replace 'Q_DECL_OVERRIDE' by 'override'hjk2016-06-154-37/+37
| | | | | | | | Examples should demonstrate best practice, and we can use the keyword directly nowadays. Change-Id: I1f122e5caceca17290757ffbaf3d660e7daa9ae4 Reviewed-by: Topi Reiniö <topi.reinio@theqtcompany.com>
* QtWidgets: Remove Windows CE.Friedemann Kleint2016-04-071-4/+0
| | | | | | | | | Remove Windows CE-specific files, #ifdef sections for Q_OS_WINCE and wince .pro file clauses in library, examples and tests. Task-number: QTBUG-51673 Change-Id: I102745aaca9d9737f2108fe7618111743d5ae980 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* Updated license headersJani Heikkinen2016-01-2124-396/+804
| | | | | | | | | | | | From Qt 5.7 -> examples are lisenced under BSD license, see http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/ Updated license headers to use new BSD header instead of LGPL21 one (in those files which will be under BSD) Change-Id: I3ad61caaf07802eb9da7d29eca3fe49d8a51b6a8 Reviewed-by: Frederik Gladhorn <frederik.gladhorn@theqtcompany.com> Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* Examples/Doc snippets: Fix single-character string literals.Friedemann Kleint2015-10-131-2/+2
| | | | | | | Use character literals where applicable. Change-Id: I79fa5018f05735201ae35ee94ba0d356fcad1056 Reviewed-by: Topi Reiniö <topi.reinio@digia.com>
* fix usage of wince scopeOswald Buddenhagen2015-06-051-1/+1
| | | | | | | Fix style issues along the way. Change-Id: Ic6a6de28e198eb0b14c198b802e78845703909b9 Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
* Fix exclusion for legacy Open GL examples.Friedemann Kleint2015-05-151-5/+1
| | | | | | | | | Add dynamic GL and remove warning about ANGLE since that package no longer exists. Task-number: QTBUG-46103 Change-Id: Icf93d1105434395a3c9ad61bb8c921fcedfc7137 Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
* Fixed license headersJani Heikkinen2015-02-1710-10/+10
| | | | | Change-Id: Ibebe1318d1c2de97601aa07269705c87737083ee Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
* Use C++ <cmath> instead of <math.h>Allan Sandfeld Jensen2015-02-163-10/+12
| | | | | | | | | | | | | | Including math.h can pollute the default namespace, and break some compilers if cmath versions of the method are declared as using. Switching to C++ math functions also greatly simplifies handling of float qreal as C++ automatically chooses the right method. [ChangeLog][QtCore][QtMath] qmath.h no longer includes math.h, so any sources depending on that indirect inclusion may fail to build. Change-Id: I4d0e331dafba354ec05dc5052e61ef4ff8d387fe Reviewed-by: Rafael Roquetto <rafael.roquetto@kdab.com>
* MSVC: Remove use of -Zm argumentKai Koehne2015-02-131-7/+0
| | | | | | | | | | | | | | | | | | | | We've been setting the -Zm argument since the dawn of times (even before the first git commit). Anyhow, MSDN from VS2008 onwards indicates that this is not needed: "In earlier versions of Visual C++, the compiler used several discrete heaps, and each had a finite limit. Currently, the compiler dynamically grows the heaps as necessary up to a total heap size limit, and requires a fixed-size buffer only to construct precompiled headers. Consequently, the /Zm compiler option is rarely necessary." [ChangeLog][Compiler Specific Changes] Visual Studio: -Zm200 (an option to specify the precompiled header memory allocation limit) is not added anymore by qmake to the compiler calls. If you encounter an C1076 compiler error you might need to re-add it in your .pro file. Change-Id: Ia4bec7eba09d893a7d81886a1814602b9ce7563c Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
* Update copyright headersJani Heikkinen2015-02-1124-324/+244
| | | | | | | | | | | | | | | | | | 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>
* Make it more obvious that Q_WS_ is dead code, and should perhaps be portedTor Arne Vestbø2015-02-031-1/+1
| | | | | | | | | | | | We still have a bunch of Q_WS_ ifdefs in our code, which are easy to mistake for Q_OS_ ifdefs when quickly scanning the code. By renaming the ifdefs we make it clear that the code in question is dead. In incremental follow-ups, we can then selectively either remove, or port, the pieces that are dead code. Change-Id: Ib5ef3e9e0662d321f179f3e25122cacafff0f41f Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* New Qt logoAlessandro Portale2014-11-052-0/+0
| | | | | | | | | | | | | This patch replaces the old Qt logo with the new, flatter one. The PNGs were optimized via: optipng -o7 -strip "all" Task-number: QTBUG-41685 Change-Id: I51983a45144373bf7aee31a32990ecbb2582f488 Reviewed-by: Robert Loehning <robert.loehning@digia.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Update license headers and add new license filesMatti Paaso2014-09-2414-266/+154
| | | | | | | | | - Renamed LICENSE.LGPL to LICENSE.LGPLv21 - Added LICENSE.LGPLv3 - Removed LICENSE.GPL Change-Id: Iec3406e3eb3f133be549092015cefe33d259a3f2 Reviewed-by: Iikka Eklund <iikka.eklund@digia.com>
* Examples: Add Q_DECL_OVERRIDE to overridden functionsOlivier Goffart2014-07-154-37/+37
| | | | | | | | | | | | | | | | | | 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>
* expand tabs and related whitespace fixes in *.{cpp,h,qdoc}Oswald Buddenhagen2014-01-134-69/+69
| | | | | | | | 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>
* Merge remote-tracking branch 'origin/release' into stableFrederik Gladhorn2013-04-031-0/+6
|\ | | | | | | Change-Id: Icedabda08961326a0a447ec71f1b0f0f5df075eb
| * Boxes: Check for opengl version in .pro fileKai Koehne2013-04-031-0/+6
| | | | | | | | | | | | | | | | | | | | | | Make sure that people get an understandable error message when trying to compile the boxes demo with e.g. ANGLE. Task-number: QTBUG-30406 Change-Id: I0ba0e26e424d768f95d7977862d9f2c4e85b41fb Reviewed-by: Jonathan Liu <net147@gmail.com> Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com> Reviewed-by: Thomas Hartmann <Thomas.Hartmann@digia.com>
* | Whitespace cleanup: remove trailing whitespaceAxel Waggershauser2013-03-161-1/+1
|/ | | | | | | | | | | | | | | | | | | | | | | | | | Remove all trailing whitespace from the following list of files: *.cpp *.h *.conf *.qdoc *.pro *.pri *.mm *.rc *.pl *.qps *.xpm *.txt *README excluding 3rdparty, test-data and auto generated code. Note A): the only non 3rdparty c++-files that still have trailing whitespace after this change are: * src/corelib/codecs/cp949codetbl_p.h * src/corelib/codecs/qjpunicode.cpp * src/corelib/codecs/qbig5codec.cpp * src/corelib/xml/qxmlstream_p.h * src/tools/qdoc/qmlparser/qqmljsgrammar.cpp * src/tools/uic/ui4.cpp * tests/auto/other/qtokenautomaton/tokenizers/* * tests/benchmarks/corelib/tools/qstring/data.cpp * util/lexgen/tokenizer.cpp Note B): in about 30 files some overlapping 'leading tab' and 'TAB character in non-leading whitespace' issues have been fixed to make the sanity bot happy. Plus some general ws-fixes here and there as asked for during review. Change-Id: Ia713113c34d82442d6ce4d93d8b1cf545075d11d Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
* Update copyright year in Digia's license headersSergio Ahumada2013-01-1824-24/+24
| | | | | Change-Id: Ic804938fc352291d011800d21e549c10acac66fb Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* centralize and fixup example sources install targetsOswald Buddenhagen2012-11-291-5/+1
| | | | | | | | | | | | | it's confusing for the users if the examples' project files contain code to install their own sources. also, this constitutes an enormous code duplication, and lots of mistakes. consequently, automate it. more or less as a side effect, this also removes the entirely meaningless target installs in subdirs projects. Task-number: QTBUG-28184 Change-Id: I9fc1367a06db9e2c46aeb67d68729a4f67163ef9 Reviewed-by: hjk <qthjk@ovi.com>
* Examples: Install to $$[QT_INSTALL_EXAMPLES]/$submodule/$examplehjk2012-11-261-2/+2
| | | | | | | | This makes the structure of the examples after an 'make install' similar to the one in a 'developer build'. Change-Id: I9120bd741fab332e64e30adc01cefe87e5633454 Reviewed-by: Martin Smith <martin.smith@digia.com>
* Fix building of examples.Friedemann Kleint2012-11-211-2/+2
| | | | | | | | | | | - Correct install path of widget examples to contain widgets directory in target tree. - Add missing resources. Task-number: QTBUG-27977 Change-Id: If4cb117998892b0b165d7678367553d3a7553b91 Reviewed-by: Christian Kandeler <christian.kandeler@digia.com>
* Change copyrights from Nokia to DigiaIikka Eklund2012-09-2224-578/+578
| | | | | | | | 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>
* examples: Mark ctor's as explicitSergio Ahumada2012-09-172-3/+3
| | | | | | | | | Make C++ class constructors that can be used with only one required argument 'explicit' to minimize wrong use of the class. Change-Id: Ida9f9c2f0c8608c35b0137b2512a6747afd69515 Reviewed-by: Mitch Curtis <mitch.curtis@nokia.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Make gui/math3d classes use float rather than qrealSean Harmer2012-09-071-13/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This corrects the mismatch between using floats for internal storage and qreal in the API of QVector*D which leads to lots of implicit casts between double and float. This change also stops users from being surprised by the loss of precision when using these classes on desktop platforms and removes the need for the private constructors taking a dummy int as the final argument. The QMatrix4x4 and QQuaternion classes have been changed to use float for their internal storage since these are meant to be used in conjunction with the QVector*D classes. This is to prevent unexpected loss of precision and to improve performance. The on-disk format has also been changed from double to float thereby reducing the storage required when streaming vectors and matrices. This is potentially a large saving when working with complex 3D meshes etc. This also has a significant performance improvement when passing matrices to QOpenGLShaderProgram (and QGLShaderProgram) as we no longer have to iterate and convert the data to floats. This is an operation that could easily be needed many times per frame. This change also opens the door for further optimisations of these classes to be implemented by using SIMD intrinsics. This needs to be applied in conjunction with https://codereview.qt-project.org/#change,33548 Task-number: QTBUG-21035 Task-number: QTBUG-20661 Change-Id: I9321b06040ffb93ae1cbd72fd2013267ac901b2e Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Moving .qdoc files under examples/widgets/docGabriel de Dietrich2012-08-2039-0/+4721
Updated those .qdoc files to refer to the new relative examples emplacement. Images and snippets to be moved later. Also grouped all widgets related examples under widgets. Change-Id: Ib29696e2d8948524537f53e8dda88f9ee26a597f Reviewed-by: J-P Nurmi <j-p.nurmi@nokia.com>