summaryrefslogtreecommitdiffstats
path: root/examples
Commit message (Collapse)AuthorAgeFilesLines
* QtNetwork (examples) - update the second download manager exampleTimur Pocheptsov2017-10-025-41/+71
| | | | | | | | | | | | | | | | | It's the one that is more complex - with a text-based 'progress-bar' and queueing (for some, probably educational, reason) of requests. Changes: - update the C++ syntax (mem-initializers, range for, etc.) - new-style headers - redirects should not result in creating an empty file. Since we have no UI, and this example is already complex enough, settle for just reporting the redirect and removing the empty file. Task-number: QTBUG-60628 Change-Id: I0b69cd77414ecac7c0bc6b2f8f787befc978de28 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QtNetwork (examples) - update network download managerTimur Pocheptsov2017-10-021-26/+32
| | | | | | | | | | | | | Mainly 'modernizing' - use <c...> c-library includes (<stdio.h> -> <cstdio>), add appropriate using directive; minor fixes in formatting + removal of a hated double negation (aka ifndef QT_NO_NOTHING). Also, as our rules ('how to write examples') suggest - replace too many inclusion directives with module-level headers. Basic redirects handling - do not create empty files for redirected requests (or even files with some useless html). Task-number: QTBUG-60628 Change-Id: Ia4398d39126313e6213bc7244d11a55958e64dec Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Doc: minor language editsNico Vertriest2017-09-291-3/+3
| | | | | | Task-number: QTBUG-60635 Change-Id: Ic1aef003be9cd08dc38021e5b4a4add8cabbfa98 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
* Doc: update screenshot stylesheet exampleNico Vertriest2017-09-291-0/+0
| | | | | | | Task-number: QTBUG-60635 Change-Id: I4485502510aca2797ead28f3b0085d1060ea3d49 Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io> Reviewed-by: Nico Vertriest <nico.vertriest@qt.io>
* Doc: minor corrections doc Calendar Widget ExampleNico Vertriest2017-09-291-5/+5
| | | | | | Task-number: QTBUG-60635 Change-Id: I41d9af6836dc80b5c5c5303d313d15daff72b37f Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
* Doc: update Editable Tree Model ExampleNico Vertriest2017-09-291-0/+0
| | | | | | | | | | | - new screenshot with more up-to-date graphical look - deleted itemviews-editabletreemodel.png from old folder doc/src/images - deleted unnecessary item in qtwidgets.qdocconf Task-number: QTBUG-60635 Change-Id: I9b82fa027347fb0fd7adb86038abd32853e68c3a Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
* QtNetwork (examples) - update the fortune server exampleTimur Pocheptsov2017-09-283-54/+48
| | | | | | | | | | | | | | Unlike client, this needs a bit more changes: - remove redundant (and outdated) stdlib.h includes - use QRandomGenerator (instead of qsrand/qrand pair) - replace QStringList with QVector<QString> - Q_NULLPTR->nullptr, ExplicitType * -> auto - fix some weird indentation Task-number: QTBUG-60628 Change-Id: I12eed12711b1e622407bd8ecd1afdf56a2cf2097 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QtNetwork (examples) - update the fortune client exampleTimur Pocheptsov2017-09-283-21/+20
| | | | | | | | | | Minimal changes: Q_NULLPTR->nullptr, Type->auto where initializing expression self documents the type actually. Task-number: QTBUG-60628 Change-Id: I2fa784aeb30ac40c6b78e34dd58ad837ad607180 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QtNetwork (examples) - update multicastreceiver exampleTimur Pocheptsov2017-09-282-27/+23
| | | | | | | | | | | | ... as soon as we updated multicastsender. Changes are minimal and mostly cosmetic - use 'explcit' and 'nullptr' where appropriate, make a socket data-member and not a pointer, move the 'datagram's declaration outside of a loop. Task-number: QTBUG-60628 Change-Id: Icfa46e6d2844c40a605f2f4066847594943a8ea8 Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QtNetwork (examples) - update broadcastreceiver tooTimur Pocheptsov2017-09-272-14/+11
| | | | | | | | | | | ... as soon as we updated the 'sender' example. Changes are purely cosmetic though - 'explicit', nullptrs and local variables instead of redundant data-members (QPushButton). Task-number: QTBUG-60628 Change-Id: I572219da9d2a0ced07d94efb6f52f00b5a9c546d Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QtNetwork (examples) - update multicastsenderTimur Pocheptsov2017-09-252-47/+26
| | | | | | | | | | | | Similar to broadcast sender: - where possible use local variables instead of data-members - where possible avoid heap-allocated objects, use sub-objects instead - change signal-slot connection syntax (and as a "bonus" - show our QOverload) Task-number: QTBUG-60628 Change-Id: I8cd4f888c1d0653bdc8591800e713bbd347ad2fb Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QtNetwork (examples) - update secure socket client exampleTimur Pocheptsov2017-09-258-114/+135
| | | | | | | | | | | | | | | | This patch contains: - some cosmetic changes to make example look more like modern C++; - UI initialization code and SSL signals handling were split into separate member-functions; - useless checks 'if (socket)' were deleted; - widget's minimum size is now fixed + font size in 'CertInfo' dialog increased to make it readable. Change-Id: I7aadb78896832a989494d280d6da0635045f948c Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* examples: remove wince leftoversGatis Paeglis2017-09-221-1/+0
| | | | | | | This patch ammends c8602f45cc13c3c900e6db9f09b38365d00cdccc Change-Id: I6bbc892b514b1768e4cc3a4d52aa420a6e9bb4e9 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Modernize the Local Fortune Client and Server examplesMårten Nordheim2017-09-226-63/+60
| | | | | | Task-number: QTBUG-60625 Change-Id: I8ae77b782b580baf84cd5f353f8d584f674fb014 Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@qt.io>
* Slightly revamp the http exampleMårten Nordheim2017-09-223-22/+32
| | | | | | | | | | | | | | | It was already revamped a fair bit 2 years ago Replaced Q_NULLPTR with nullptr. Added a minimum size to the progressbar dialog. Update the label if a redirect is rejected. Improve the overwrite dialog message. Replaced the documentation image. Task-number: QTBUG-60628 Change-Id: I0fb70d90e1d6ca84a8307bd6ea4ea1ce220feeaf Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
* QtNetwork (examples) - update broadcastsenderTimur Pocheptsov2017-09-222-23/+18
| | | | | | | | | | | Fix copyrights, update signal-slot connection syntax, use some simple C++11 features (member-initializers, 'auto'), delete some data-members (where a local variable is enough), where possible - use data-memebrs as sub-objects (instead of heap allocated). Task-number: QTBUG-60628 Change-Id: Ia440d8471eafb47481c0d010175c907037bae841 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Merge "Merge remote-tracking branch 'origin/5.9' into 5.10" into ↵Liang Qi2017-09-2130-146/+171
|\ | | | | | | refs/staging/5.10
| * Merge remote-tracking branch 'origin/5.9' into 5.10Liang Qi2017-09-2030-146/+171
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/plugins/styles/mac/qmacstyle_mac.mm src/widgets/util/qcompleter.cpp src/widgets/widgets/qmainwindowlayout.cpp src/widgets/widgets/qmdisubwindow.cpp Change-Id: If0e96981af07ce36ac68f2e69211bc2120f93973
| | * Revamp SQL examples to C++11Michael Winkelmann2017-09-1430-146/+171
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Changed signals and slots to new syntax, used nullptr and replaced foreach with new C++11 range based for loops. Also fixed a few minor flaws. Task-number: QTBUG-60633 Change-Id: Ice4030133971912f96752d9d84c638c70fd73e35 Reviewed-by: Jesus Fernandez <Jesus.Fernandez@qt.io> Reviewed-by: André Hartmann <aha_1980@gmx.de> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* | | Polish the StorageView exampleFriedemann Kleint2017-09-203-10/+67
|/ / | | | | | | | | | | | | | | | | | | Introduce nullptr and override. Change the ready/valid columns to use check marks. Right-align the numerical columns. Add a shortcut to refresh. Sort by path, making sure the root volume is first. Task-number: QTBUG-60635 Change-Id: I74cda7647f544902aaf4d2a0ab76986f1523aa6f Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
* | Merge remote-tracking branch 'origin/5.9' into 5.10Liang Qi2017-09-066-13/+87
|\| | | | | | | | | | | | | | | | | | | Conflicts: examples/opengl/qopenglwidget/main.cpp src/3rdparty/pcre2/src/pcre2_printint.c src/plugins/platforms/cocoa/qnsview.mm src/widgets/widgets/qcombobox.cpp Change-Id: I37ced9da1e8056f95851568bcc52cd5dc34f56af
| * Hello GL2 example: Fix exit crashFriedemann Kleint2017-09-051-0/+2
| | | | | | | | | | | | | | | | Bail out of cleanup() when run 2nd time. Task-number: QTBUG-60626 Change-Id: I8a9be2fcfb0e8a5584ce8ed7952affff24bd2a33 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
| * OpenGL examples: Introduce QCommandLineParserFriedemann Kleint2017-09-056-12/+82
| | | | | | | | | | | | Task-number: QTBUG-60626 Change-Id: I6d102327c89206fcdce10f3ac04e112270b11ad2 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
| * examples: fix compile without opengl supportPeter Seiderer2017-08-291-1/+2
| | | | | | | | | | | | | | | | | | Compile examples/opengl only in case opengl support is available. Task-number: QTBUG-62372 Change-Id: I742a1eb7b7639a5a722c4d5e9b4ee070b629b02e Reviewed-by: Jake Petroules <jake.petroules@qt.io> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
* | Modernize the json savegame exampleMårten Nordheim2017-08-318-82/+175
| | | | | | | | | | | | | | Task-number: QTBUG-60625 Change-Id: I8d5bf860478ee2566b9f96854fc6491f088a28fa Reviewed-by: Topi Reiniö <topi.reinio@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* | Merge remote-tracking branch 'origin/5.9' into devOswald Buddenhagen2017-08-021-7/+94
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/plugins/platforms/xcb/qxcbconnection.h src/plugins/platforms/xcb/qxcbconnection_xi2.cpp src/plugins/sqldrivers/sqlite/qsql_sqlite.cpp src/plugins/styles/mac/qmacstyle_mac.mm src/widgets/widgets/qdockarealayout.cpp src/widgets/widgets/qmainwindow.cpp src/widgets/widgets/qmainwindowlayout.cpp src/widgets/widgets/qmainwindowlayout_p.h tests/auto/corelib/tools/qlocale/tst_qlocale.cpp tests/auto/other/macnativeevents/BLACKLIST tests/auto/widgets/widgets/qmenu/BLACKLIST Change-Id: Ic8e724b80a65e7b1af25511b0e674d209265e567
| * Regular Expression Example: Add context menuFriedemann Kleint2017-07-191-7/+94
| | | | | | | | | | | | | | | | | | | | | | Add context menu providing: "Escape Selection" Apply QRegularExpression::escape() to selection "Paste from Code" Paste from C++ "Copy to Code" (for completeness) Task-number: QTBUG-60635 Change-Id: Iee15c2243c7d0435b623dde4a1b26249aecd0553 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* | Merge remote-tracking branch 'origin/5.9' into devSimon Hausmann2017-07-1913-65/+16
|\| | | | | | | | | | | | | | | Conflicts: src/corelib/io/qwindowspipewriter.cpp src/widgets/styles/qcommonstyle.cpp Change-Id: I0d33efdc4dc256e234abc490a18ccda72cd1d9e6
| * Examples: Remove remains of winceFriedemann Kleint2017-07-1413-65/+16
| | | | | | | | | | | | | | | | | | | | | | Task-number: QTBUG-52590 Task-number: QTBUG-60628 Task-number: QTBUG-60633 Task-number: QTBUG-60635 Task-number: QTBUG-60641 Task-number: QTBUG-60659 Change-Id: I9ffc3e25893d2281b19cc12b70e1a92fb2a8b708 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* | Clean up some arithmetic code in an exampleEdward Welbourne2017-07-141-17/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The square root of a sum of squares is easier to read and should be computed more accurately if done for us by hypot(). Variables set only once should be set as an initializer and declared const, to make clear this is what's happening. Loop variables can be local to loops. Adding a value to, or subtracting one from, a multiple of itself just multiplies it be one plus (or minus) the multiplier; assigning the result to the same variable is clearer as a *= (especially when the factors are now overt numeric constants). An array of 16k floats all updated in locksteck to the same value can be replaced by a single float that holds that value. Simple things should not be needlessly made more complicated - especially in example code, which should be pedagogic. Change-Id: Idab585cd7df1399c250d4b9f1396a085ae8f3864 Reviewed-by: hjk <hjk@qt.io>
* | Merge remote-tracking branch 'origin/5.9' into devGabriel de Dietrich2017-07-136-404/+1
|\| | | | | | | | | | | | | Conflicts: src/widgets/widgets/qmainwindowlayout.cpp Change-Id: I306b4f5ad11bceb336c9091241b468d455fe6bb6
| * pathstroke example: Add Q_FALLTHROUGH to unmarked fallthrough seen by GCC 7Friedemann Kleint2017-07-091-0/+1
| | | | | | | | | | | | Task-number: QTBUG-60635 Change-Id: I10695f96122f1b0859bbe7fadb349efb3c7277a6 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
| * Remove WinCE-specific sipdialog exampleFriedemann Kleint2017-07-055-404/+0
| | | | | | | | | | | | | | Task-number: QTBUG-52590 Task-number: QTBUG-60635 Change-Id: Ie6d59d1431645faf93d1538fe9f5bf1bea9f3014 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* | Allow QImage with more than 2GByte of image dataAllan Sandfeld Jensen2017-07-081-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Changes internal data-size and pointer calculations to qssize_t. Adds new sizeInBytes() accessor to read byte size, and marks the old one deprecated. Task-number: QTBUG-50912 Change-Id: Idf0c2010542b0ec1c9abef8afd02d6db07f43e6d Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | 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>
* | Call sinh() rather than implementing it using exp()Edward Welbourne2017-07-071-1/+1
| | | | | | | | | | | | Change-Id: I8dda2f94524b19bcdec640e7541b04d46a6c3941 Reviewed-by: Jesus Fernandez <Jesus.Fernandez@qt.io> Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* | Merge remote-tracking branch 'origin/5.9' into devLiang Qi2017-07-0611-8/+13
|\| | | | | | | | | | | | | Conflicts: .qmake.conf Change-Id: I43531e087bb810889d5c1fbfcdffb29b78804839
| * Doc: Add list with widgets examples using layoutsNico Vertriest2017-07-0310-0/+10
| | | | | | | | | | Change-Id: I585cd63f68220467de1beed3346cdaa12af2b34b Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
| * doc: cleanup raster window exampleGatis Paeglis2017-07-031-8/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Use qRadiansToDegrees() and qDegreesToRadians() more widelyEdward Welbourne2017-07-057-40/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Merge remote-tracking branch 'origin/5.9' into devLiang Qi2017-07-0412-13/+17
|\| | | | | | | | | | | | | | | | | | | | | | | 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.wizard to QT_[REQUIRE_]CONFIGStephan Binner2017-07-021-1/+5
| | | | | | | | | | Change-Id: I43e3d9f55a21ae0f602fc43c570321d0152cd8b6 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
| * 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-2810-10/+10
| | | | | | | | | | Change-Id: I46083a9115c199d1ebe024ed5f64b160a27462f1 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
* | Don’t flicker on startup: render on exposeMorten Johan Sørvig2017-06-272-1/+3
| | | | | | | | | | | | | | | | All QWindow implementations must produce a frame before returning from the expose event. Change-Id: I5640809c47e948101879c1623c12230fa0a63c44 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
* | Be (somewhat more) consistent about the value of piEdward Welbourne2017-06-2020-143/+102
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Add QLocale::formattedDataSize and consolidate use casesShawn Rutledge2017-06-201-22/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It should be easier to translate sizes in bytes to human-readable strings consistently rather than having to repeat this code (and the string translations) in various places. The FileDialog in QtQuick.Controls has a use for this, too. [ChangeLog][QtCore][QLocale] Added QLocale::formattedDataSize() for formatting quantities of bytes as kB, MB, GB etc. Done-with: Edward Welbourne <edward.welbourne@qt.io> Change-Id: I27bca146c3eba90fa7a5d52ef6626ce85723e3f0 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Typo-fix: s/looses/loses/gEdward Welbourne2017-06-081-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | When an archer lets go of the bow-string, she looses an arrow; when the hounds are straining at their leashes and the handler lets go, he looses the dogs. It's archaic usage now; we'd normally say "lets loose", "lets go" or "releases". In any case what was meant here was that something got lost; a widget loses focus or a network loses its connection. Change-Id: Ic1fbe9e1f76185bcb7caf034d6be97ebfeb2e270 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Martin Smith <martin.smith@qt.io>
* | Merge remote-tracking branch 'origin/5.9' into devLiang Qi2017-06-0712-24/+69
|\| | | | | | | | | | | | | Conflicts: src/widgets/widgets/qmenu.cpp Change-Id: I6d3baf56eb24501cddb129a3cb6b958ccc25a308
| * Convert features.printdialog to QT_[REQUIRE_]CONFIGStephan Binner2017-05-3012-24/+69
| | | | | | | | | | Change-Id: Ifb016ae2a0986b436f788b34513c81ea91f3804a Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>