summaryrefslogtreecommitdiffstats
path: root/examples/widgets/widgets
Commit message (Collapse)AuthorAgeFilesLines
* Demonstrate the new AA_CompressTabletEvents in the tablet exampleShawn Rutledge2017-11-242-0/+11
| | | | | | Change-Id: I1972da2ead51274771ff24b4c506c2b581ee6abe Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io> Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
* Change almost all other uses of qrand() to QRandomGeneratorThiago Macieira2017-11-084-5/+3
| | | | | | | | | | | | | | | | | | | 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>
* Merge remote-tracking branch 'origin/5.9' into devLiang Qi2017-07-043-4/+4
|\ | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/io/qprocess_unix.cpp src/plugins/platforms/xcb/qxcbconnection.cpp src/plugins/platforms/xcb/qxcbwindow.cpp src/widgets/util/util.pri tests/auto/corelib/thread/qthread/qthread.pro tests/auto/corelib/thread/qthread/tst_qthread.cpp Change-Id: I5c45ab54d46d3c75a5c6c116777ebf5bc47a871b
| * Convert features.statustip to QT_CONFIGStephan Binner2017-06-291-2/+2
| | | | | | | | | | Change-Id: Ic719ab93ed1802fcc713885ad0421cb44c7a998b Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
| * Convert features.wheelevent to QT_CONFIGStephan Binner2017-06-282-2/+2
| | | | | | | | | | Change-Id: I46083a9115c199d1ebe024ed5f64b160a27462f1 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
* | Merge remote-tracking branch 'origin/5.9' into devLiang Qi2017-06-072-5/+11
|\| | | | | | | | | | | | | Conflicts: src/widgets/widgets/qmenu.cpp Change-Id: I6d3baf56eb24501cddb129a3cb6b958ccc25a308
| * Convert features.printdialog to QT_[REQUIRE_]CONFIGStephan Binner2017-05-302-5/+11
| | | | | | | | | | Change-Id: Ifb016ae2a0986b436f788b34513c81ea91f3804a Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
* | tablet example: don't update the cursor image on iOSShawn Rutledge2017-06-021-0/+2
| | | | | | | | | | | | | | | | There is no visible cursor on iOS, so updating the image is a waste of time. Removing this does in fact speed up rendering of the strokes. Change-Id: If958fabeefd4273644707277d4a084855d415bb1 Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* | tablet example: enable high-DPI renderingShawn Rutledge2017-05-151-13/+15
| | | | | | | | | | | | Change-Id: Ie03867208902fdc9cf794de16d7249c8994351f4 Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io> Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* | tablet example: use stylus rotation property correctlyShawn Rutledge2017-05-081-5/+5
| | | | | | | | | | | | | | | | | | It was backwards from the expected value, consistently on iOS and xcb. It was already that way in 5.6, and we don't document which way is clockwise. So it seems to be just the example which is wrong. Change-Id: Ibbdadc2ae240017abc87439a2694fb5fbd3d07f8 Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* | tablet example: make smoother strokes with the rotation stylusShawn Rutledge2017-05-082-2/+12
|/ | | | | | | | | | Each stroke is a polygon (quadrilateral) connecting the previous tablet event point to the current one. Previously we used the same width for both ends of the stroke, so rapid changes in pressure caused steps in the stroke width. Now it is tapered from one end to the other. Change-Id: I909a2e85334a1a6e20fd28ee4babf6825da36612 Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* make TabletMove hover events conditional on QWidget::tabletTrackingShawn Rutledge2017-02-231-0/+1
| | | | | | | | | | | | | | | | | | This adds the tabletTracking property in the same way that mouseTracking already existed: there is a WA_TabletTracking attribute, and a TabletTrackingChange event to notify when it changes. So for widget applications it's an opt-in feature. QtQuick applications don't yet make use of tablet events, but when they do in the future, we don't yet have a mechanism to turn the move events off; it remains to be seen whether that will be necessary. [ChangeLog][QtWidget] QWidget now has a tabletTracking property, analogous to mouseTracking, which will enable TabletMove events while the stylus is hovering, even if no button is pressed. This allows applications to show feedback based on the other tablet event properties such as rotation and tilt. Task-number: QTBUG-26116 Change-Id: Ie96e8acad882b167e967796cdd17f1ad747a2771 Reviewed-by: Andy Shaw <andy.shaw@qt.io>
* Example: migrate stylesheet example to use QRegularExpressionSamuel Gaist2017-02-151-3/+4
| | | | | | | | Update the stylesheet example to use the new QRegularExpression class in place of the deprecated QRegExp. Change-Id: I7061b8fd462ff012cb67bfdade656b3bfe442dd8 Reviewed-by: Sze Howe Koh <szehowe.koh@gmail.com>
* examples: Use QOverload to select overloaded signals and slotsAlexander Volkov2016-12-223-11/+6
| | | | | | | | | | | We can use QOverload since Qt 5.7 (it depends on Q_COMPILER_VARIADIC_TEMPLATES which is required since Qt 5.7). Use it in the examples to show the best practice. qOverload currently can't be used because it requires c++14. Change-Id: I94a3c0db9d551fe169fa3d19c07ec0b329d5946c Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
* Merge remote-tracking branch 'origin/5.7' into devLiang Qi2016-08-164-0/+0
|\ | | | | | | | | | | | | | | | | | | | | | | Conflicts: qmake/doc/src/qmake-manual.qdoc src/corelib/global/qglobal.cpp src/corelib/tools/qstring.cpp src/network/socket/qabstractsocket.cpp src/network/socket/qnativesocketengine_unix.cpp src/plugins/platforms/eglfs/api/qeglfsglobal.h Change-Id: Id5dfdbd30fa996f9b4b66a0b030b7d3b8c0ef288
| * Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-08-104-0/+0
| |\ | | | | | | | | | Change-Id: I1a63523de158757964b6fb5ea026cf69a6c5ddcf
| | * Update logo icons in icons exampleFriedemann Kleint2016-08-104-0/+0
| | | | | | | | | | | | | | | | | | Task-number: QTBUG-55137 Change-Id: I51a16a40112f5f5bbea00540178999382752a6f2 Reviewed-by: Topi Reiniö <topi.reinio@theqtcompany.com>
* | | Merge remote-tracking branch 'origin/5.7' into devLiang Qi2016-08-094-29/+117
|\| | | | | | | | | | | Change-Id: I36e6b890b65d12bf6931757540bcc9c553b5eb8f
| * | Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-08-054-29/+117
| |\| | | | | | | | | | | | | | | | | | | Conflicts: tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp Change-Id: I6f3878b204464313aa2f9d988d3b35121d4d9867
| | * Polish charactermap exampleFriedemann Kleint2016-08-024-29/+117
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Use Qt 5 connection syntax. - Introduce helper function to calculate the square size, remove the existing 24 pixel limitation since that makes it impossible to render 20pt fonts. - Add filter chooser for font filters. - Add menu and info dialog showing DPI and default fonts. - Streamline code Change-Id: I0cd4d0475b5a7ed3c475de7a413abebbe688dfe2 Reviewed-by: Topi Reiniö <topi.reinio@theqtcompany.com>
* | | Merge remote-tracking branch 'origin/5.7' into devEdward Welbourne2016-08-011-15/+17
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: configure 5.7 now supports clang on android; but dev re-worked configure src/gui/kernel/qevent.h One side renamed a parameter of a constructor; the other added an alternate constructor on the next line. Applied the rename to both for consistency. tests/auto/tools/moc/tst_moc.cpp Each side added a new test at the end. .qmake.conf Ignored 5.7's change to MODULE_VERSION. configure.json No conflict noticed by git; but changes in 5.7 were needed for the re-worked configure to accommodate 5.7's stricter handling of C++11. Change-Id: I9cda53836a32d7bf83828212c7ea00b1de3e09d2
| * | Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-08-011-15/+17
| |\| | | | | | | | | | | | | | | | | | | | | | Conflicts: src/widgets/itemviews/qabstractitemview.cpp src/widgets/itemviews/qabstractitemview_p.h Change-Id: I54589b1365103cb1749186af92aab03a49c94b64
| | * examples: use QSignalBlockerMarc Mutz2016-07-281-15/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Examples should show idiomatic Qt, and QSignalBlocker is idiomatic since it's inception in Qt 5.3. Just updating the examples was forgotten. This commit makes good for that. Fix coding-style issues as a drive-by. Change-Id: If138e87ea2ab7a444599734113f7cc6df11fb42d Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* | | Examples: Replace 'Q_DECL_OVERRIDE' by 'override'hjk2016-06-1518-55/+55
| | | | | | | | | | | | | | | | | | | | | | | | Examples should demonstrate best practice, and we can use the keyword directly nowadays. Change-Id: I1f122e5caceca17290757ffbaf3d660e7daa9ae4 Reviewed-by: Topi Reiniö <topi.reinio@theqtcompany.com>
* | | Merge remote-tracking branch 'origin/5.7' into devLiang Qi2016-04-111-0/+1
|\| | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/kernel/qobject.cpp src/gui/painting/qpaintengine_raster.cpp Change-Id: I74e1779832f43d033708dcfd6b666c7b4f0111fb
| * | add cross-platform tablet->mouse event synth; enable on AndroidShawn Rutledge2016-04-081-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It's urgent to fix the issue that on Android, it became impossible to interact with any widget or MouseArea which handles only mouse events but not tablet events, using the stylus, because stylus events are sent only as QTabletEvents. Before 5.6 (change 01d78ba86a631386a4d47b7c12d2a359da28f517) they were sent as touch events, and mouse events were synthesized from those. Whereas on other platforms, every QTabletEvent is followed by a synthesized QMouseEvent. This fix proceeds in the direction that event synthesis should be done in cross-platform code so that platform plugins don't have to repeat it, following the same pattern as for touch->mouse synthesis. Just as in that case, the application can disable it, and the platform plugin can also report that it's unnecessary for Qt to do the synthesis because the platform already does. So QTBUG-51618 is fixed, but QTBUG-47007 requires us to remove the tablet->mouse synthesis from all platform plugins, because the plugin does not know whether the tablet event was accepted or not, so it does not have enough information to decide whether to synthesize a mouse event. Synthesis has been unconditional until now, which contradicts what the documentation says: the mouse event should be sent only if the tablet event is NOT accepted. We can now gradually make this promise come true. [ChangeLog][QtCore][Tablet support] A synthetic mouse event will no longer be sent after every QTabletEvent, only after those which are not accepted (as documented). Task-number: QTBUG-47007 Task-number: QTBUG-51618 Change-Id: I99404e0c2b39bbca4377be6fd48e0c6b20338466 Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
* | | QtWidgets: Remove Windows CE.Friedemann Kleint2016-04-073-23/+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>
* / Unify license header usage.Jani Heikkinen2016-03-29111-336/+1446
|/ | | | | | | | | 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>
* Polish the Tablet exampleShawn Rutledge2016-01-286-278/+174
| | | | | | | | | | | | | | | | | | | | | - Introduce Qt 5 signal-slot connection syntax. - Merge MainWindow::createMenus()/createActions() into MainWindow::createMenus(), removing the need to store the actions as member variables. Use QMenu::addAction() for brevity. - For actions in QActionGroups, carry the Valuator enum in QAction::data so that the slot to handle the selection does not need to compare the QAction pointer itself. - Use a non-modal QColorDialog, so that the user can change colors more easily while drawing. - Choose saner shortcut keys: control-Q should not override the default usage for quitting the application, and using shortcuts for About dialogs is anyway dubious. - Improve the example documentation. Change-Id: I57aaf5f5b885c13a953482dbcc41275dd3d6bff4 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> Reviewed-by: Topi Reiniö <topi.reinio@theqtcompany.com>
* Image viewer example: Fix broken error message formatting.Friedemann Kleint2015-10-191-1/+1
| | | | | | Task-number: QTBUG-48851 Change-Id: Ie86bcc498c9dc1f9754192a256a28fa467f6dbc9 Reviewed-by: Shawn Rutledge <shawn.rutledge@theqtcompany.com>
* Examples/Doc snippets: Fix single-character string literals.Friedemann Kleint2015-10-131-1/+1
| | | | | | | Use character literals where applicable. Change-Id: I79fa5018f05735201ae35ee94ba0d356fcad1056 Reviewed-by: Topi Reiniö <topi.reinio@digia.com>
* Doc: Update obsolete URLs to external documentationTopi Reinio2015-10-021-1/+1
| | | | | | | Change-Id: I199de83971701c14e903e712fcdcd29aaff95c6d Task-number: QTBUG-48420 Reviewed-by: Venugopal Shivashankar <venugopal.shivashankar@digia.com> Reviewed-by: Liang Qi <liang.qi@theqtcompany.com>
* Polish the Icons example.Friedemann Kleint2015-09-1410-281/+448
| | | | | | | | | | | | | | | | | | | | | | | | | | - Remove unneeded member variables. - Use new connection syntax in createActions() to assemble the menu there, removing the createMenus() function. - Use a QButtonGroup for the sizes with the style metrics as id. - Streamline code, rename variables for clarity. - Introduce static functions returning the list of states/modes and their names in display order to IconPreviewArea, removing the duplicates. - Split actions to open sample icons provided from source directory or standard pictures location to make sample icons more prominently visible. - Check and display @2x images and add tooltips showing device pixel ratio and actual size. - HighDPI: Add groupbox displaying screen name and device pixel ratio, connect to screen changed signal and update icons panel accordingly. Add check box for toggling Qt::AA_UseHighDpiPixmaps. - Adjust documentation Task-number: QTBUG-18680 Task-number: QTBUG-46615 Change-Id: Ice96e9898f168ef2a30e9f46cb260ed57ae015f0 Reviewed-by: Topi Reiniö <topi.reinio@digia.com>
* Extend the image viewer example.Friedemann Kleint2015-08-242-17/+120
| | | | | | | | | | Add: - Save As - Copy - Paste from clipboard into new image Change-Id: Ibbc308e9bbd2ce407119cd9358874f5c22a6bb83 Reviewed-by: Topi Reiniö <topi.reinio@digia.com>
* Polish the imageviewer example.Friedemann Kleint2015-08-212-66/+34
| | | | | | | | | | | | | | | | | - Remove unneeded member variables. - Use member initialization in the constructor. - Use new connection syntax in createActions() to assemble the menu there, removing the createMenus() function. - Fix coding style issue (braces) - Avoid empty label showing up by setting the scroll area invisible until an image is loaded. - Set a new image only if image read succeeds. - Add status bar with information message. Task-number: QTBUG-46848 Change-Id: I32d5af70d8eb71ec16dd58a0b98c32eb2bd988d7 Reviewed-by: Topi Reiniö <topi.reinio@digia.com>
* Tablet example: update the cursor according to the toolShawn Rutledge2015-07-319-11/+62
| | | | | Change-Id: Ibbe530856bb833e465dd9fa1da5425c018fecc21 Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
* Tablet example: smoother, rotation stylus, better airbrushShawn Rutledge2015-07-314-59/+68
| | | | | | | | | | | | The drawing is antialiased and with rounded caps and joins. Rotation stylus acts like a felt marker. Airbrush sprays a radial gradient of color, and its alpha can depend on the tangential pressure if so chosen. Task-number: QTBUG-46694 Change-Id: I4fb16eb621707e3c56a75aa302dd0d3bf418a745 Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com> Reviewed-by: Topi Reiniö <topi.reinio@digia.com>
* Merge remote-tracking branch 'origin/5.5' into HEADSimon Hausmann2015-07-171-1/+3
|\ | | | | | | | | | | | | Conflicts: src/plugins/platforms/windows/qwindowsopengltester.cpp Change-Id: Ia7abeba9395ccf84e2fa81b91a5725a86dedb9fe
| * Use QImageReader::setAutoTransform() in examples.Friedemann Kleint2015-07-131-1/+3
| | | | | | | | | | | | Change-Id: If80616d680f1aa6c9d5cd1a4080710e5ad67d603 Reviewed-by: Rainer Keller <rainer.keller@theqtcompany.com> Reviewed-by: Allan Sandfeld Jensen <allan.jensen@theqtcompany.com>
* | Merge remote-tracking branch 'origin/5.5' into devLiang Qi2015-07-013-3/+3
|\| | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/global/qglobal.cpp src/corelib/global/qglobal.h src/corelib/global/qsysinfo.h src/corelib/global/qsystemdetection.h src/corelib/kernel/qobjectdefs.h src/plugins/plugins.pro tests/auto/widgets/itemviews/qlistview/qlistview.pro Change-Id: Ib55aa79d707c4c1453fb9d697f6cf92211ed665c
| * fix usage of wince scopeOswald Buddenhagen2015-06-053-3/+3
| | | | | | | | | | | | | | Fix style issues along the way. Change-Id: Ic6a6de28e198eb0b14c198b802e78845703909b9 Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
* | Merge "Merge remote-tracking branch 'origin/5.5' into dev" into refs/staging/devSimon Hausmann2015-06-041-1/+1
|\|
| * imageviewer example: support loading images on iOSRichard Moe Gustavsen2015-06-021-1/+1
| | | | | | | | | | | | | | | | | | Use the last path from QSP to hint that we want to load photos from the global photo library. This should currently only make a difference on iOS. Change-Id: I7a6217dbbbc2e247b69bf406c02001458c757211 Reviewed-by: Shawn Rutledge <shawn.rutledge@theqtcompany.com>
* | use INSTALLS instead of DEPLOYMENTJoerg Bornemann2015-06-032-2/+2
|/ | | | | | | The DEPLOYMENT variable has been deprecated. Change-Id: I1c7c07b36a2e665ae302e4f43f7f2dc752f3c1f4 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
* Use C++ <cmath> instead of <math.h>Allan Sandfeld Jensen2015-02-161-3/+3
| | | | | | | | | | | | | | 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>
* Updated BSD licensed file headersJani Heikkinen2015-02-15111-333/+333
| | | | | Change-Id: I6441ff931dbd33b698d762e6f6784898f3f60fe7 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
* Update copyright headersJani Heikkinen2015-02-11111-555/+555
| | | | | | | | | | | | | | | | | | 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>
* Remove traces of the Maemo platformTor Arne Vestbø2015-02-041-3/+0
| | | | | | | Change-Id: I6b551de331aa0386ea53d8e96f50b669777d2d69 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@theqtcompany.com>
* New Qt logoAlessandro Portale2014-11-053-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>
* Fix includes in mousebuttons exampleAlexander Volkov2014-10-273-3/+6
| | | | | | | Remove QtWidgets from buttontester.h and QtGui from main.cpp. Change-Id: Ie5925a33c58c1abd9747ab0ab7040e7d1b0769a9 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>