Commit Graph

531 Commits

Author SHA1 Message Date
Nico Vertriest
8d75c6765d Doc: Complete Simple Anchor Layout Example
Task-number: QTBUG-60635
Change-Id: I1351df7c514c57ed04ff6e640d7338d62c8f91ac
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
2017-11-30 14:15:08 +00:00
Nico Vertriest
d0812cbdab Doc: modify connect statement to new syntax
Task-number: QTBUG-60635
Change-Id: I776bdc49ae42e2d0c11dc33d58d9ce91b9f5e753
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
2017-11-29 14:09:31 +00:00
Nico Vertriest
1fe6a75fec Doc: Minor corrections custom sort filter example
Task-number: QTBUG-60635
Change-Id: I17a69f85663eaa92e92b4e97385c21a729405e1f
Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
2017-11-29 14:09:18 +00:00
Shawn Rutledge
cfccd44b9d Demonstrate the new AA_CompressTabletEvents in the tablet example
Change-Id: I1972da2ead51274771ff24b4c506c2b581ee6abe
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@qt.io>
Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
2017-11-24 11:50:01 +00:00
Nico Vertriest
64298b42a3 Doc: drop Application Chooser Example
There are plenty of other examples showing how to use QStateMachine

Task-number: QTBUG-60635
Change-Id: I82300b2a0f4e7733f08579a2aa9b548cb7d87efa
Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2017-11-20 09:32:38 +00:00
Nico Vertriest
b00feb8cfc Doc: Add screenshot to Validators example
Task-number: QTBUG-60635
Change-Id: Ie68e611b57900847a00587fdf8558be4be38f23d
Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
2017-11-20 09:32:31 +00:00
Nico Vertriest
6e7cf8b918 Doc: update screenshots in Addressbook Example doc
Task-number: QTBUG-60635
Change-Id: I5b098120f0e47687ac90d7f05b91a2a60f1eab32
Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
2017-11-20 09:32:20 +00:00
Nico Vertriest
f39f813113 Doc: drop Lighting Effect Example
Task-number: QTBUG-60635
Change-Id: If455a778ff6ebd53d8110b3dc25d8b9e27255bac
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
Reviewed-by: Nico Vertriest <nico.vertriest@qt.io>
2017-11-20 09:31:55 +00:00
Nico Vertriest
0bdbefa3c0 Doc: add doc to Style Sheet example
Task-number: QTBUG-60635
Change-Id: I6c80427bce1efc67bbf4ec67b0afeafc27088d79
Reviewed-by: Martin Smith <martin.smith@qt.io>
2017-11-20 09:31:22 +00:00
Nico Vertriest
a78cae73b1 Doc: review Star Delegate Example
- update screenshot
- minor corrections description example

Task-number: QTBUG-60635
Change-Id: I2351160ee9ec0a926fddb122e720c887f851dba5
Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
2017-11-20 09:30:58 +00:00
Thiago Macieira
19b0ce5daa Change almost all other uses of qrand() to QRandomGenerator
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>
2017-11-08 09:14:03 +00:00
Alexander Volkov
c181f418b9 Address Book example: Correctly update "Edit entry" and "Remove entry" actions
They are not updated after switching tabs. Thus they can be enabled even
when no entry is selected: select an entry on the current tab and then
switch to an empty tab.

Emit AddressWidget::selectionChanged() signal after changing the current tab
to update these actions.

Change-Id: I00da15ed6c3d3839210ae3ffbe1436e234695522
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2017-10-23 14:38:22 +00:00
Friedemann Kleint
879f98106d Revamp QtWidgets/DragAndDrop examples to C++11
Introduce nullptr and replace foreach with new C++11 range based for
loops. Minor fixups of signals, file dialog usage.

Apply the same changes to the ItemViews/puzzle example since it
shares parts of the code with DragAndDrop/puzzle. Make some
changes to both examples to that the diff of the two becomes
small for easier comparison.

Task-number: QTBUG-60635
Change-Id: I8af824229ebac24d6ec151eae92176d227695490
Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
Reviewed-by: Gatis Paeglis <gatis.paeglis@qt.io>
2017-10-18 10:31:44 +00:00
Liang Qi
7e4571b7e7 Merge "Merge remote-tracking branch 'origin/5.9' into 5.10" into refs/staging/5.10 2017-10-17 18:29:37 +00:00
Alexander Volkov
66119a07e8 Address Book example: Replace QPair by struct
Introduce Contact struct to store contact data and use it
instead of QPair<QString, QString>. Proper naming really
clarifies the code.

Task-number: QTBUG-60635
Change-Id: Ibfb421dfc854accc382212b0da46e7aafc0d528a
Reviewed-by: Jesus Fernandez <Jesus.Fernandez@qt.io>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2017-10-17 16:42:55 +00:00
Liang Qi
01afc8c810 Merge remote-tracking branch 'origin/5.9' into 5.10
Change-Id: I3cf73c53cf131d0babfb558c2507bed0e0fc5f08
2017-10-16 22:21:52 +03:00
Nico Vertriest
56a3cbc5c7 Doc: minor language edits
Task-number: QTBUG-60635
Change-Id: Ic1aef003be9cd08dc38021e5b4a4add8cabbfa98
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
2017-09-29 08:52:59 +00:00
Nico Vertriest
e30d67ba27 Doc: update screenshot stylesheet example
Task-number: QTBUG-60635
Change-Id: I4485502510aca2797ead28f3b0085d1060ea3d49
Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
Reviewed-by: Nico Vertriest <nico.vertriest@qt.io>
2017-09-29 08:52:45 +00:00
Nico Vertriest
b7005aa565 Doc: minor corrections doc Calendar Widget Example
Task-number: QTBUG-60635
Change-Id: I41d9af6836dc80b5c5c5303d313d15daff72b37f
Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
2017-09-29 08:52:34 +00:00
Nico Vertriest
7631f815db Doc: update Editable Tree Model Example
- 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>
2017-09-29 08:52:20 +00:00
Friedemann Kleint
267b1a140a regularexpression example: Fix compilation with clipboard disabled
Use the new configure system consistently.

Task-number: QTBUG-63429
Change-Id: I6668ba9fde09492f3e60e614103e18e88783d0c4
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
2017-09-28 04:14:02 +00:00
Gatis Paeglis
971adcaea1 examples: remove wince leftovers
This patch ammends c8602f45cc

Change-Id: I6bbc892b514b1768e4cc3a4d52aa420a6e9bb4e9
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2017-09-22 19:22:07 +00:00
Friedemann Kleint
29b38bea45 Polish the StorageView example
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>
2017-09-20 12:19:39 +00:00
Oswald Buddenhagen
ee07b912a1 Merge remote-tracking branch 'origin/5.9' into dev
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
2017-08-02 22:52:32 +02:00
Friedemann Kleint
f54327c3c3 Regular Expression Example: Add context menu
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>
2017-07-19 20:58:19 +00:00
Simon Hausmann
407302fb1b Merge remote-tracking branch 'origin/5.9' into dev
Conflicts:
	src/corelib/io/qwindowspipewriter.cpp
	src/widgets/styles/qcommonstyle.cpp

Change-Id: I0d33efdc4dc256e234abc490a18ccda72cd1d9e6
2017-07-19 09:47:29 +02:00
Friedemann Kleint
dc81a99dec Examples: Remove remains of wince
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>
2017-07-14 17:30:51 +00:00
Gabriel de Dietrich
d38fe875c7 Merge remote-tracking branch 'origin/5.9' into dev
Conflicts:
    src/widgets/widgets/qmainwindowlayout.cpp

Change-Id: I306b4f5ad11bceb336c9091241b468d455fe6bb6
2017-07-13 16:36:10 -07:00
Friedemann Kleint
6e861d8412 pathstroke example: Add Q_FALLTHROUGH to unmarked fallthrough seen by GCC 7
Task-number: QTBUG-60635
Change-Id: I10695f96122f1b0859bbe7fadb349efb3c7277a6
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2017-07-09 11:07:17 +00:00
Allan Sandfeld Jensen
4f88475a96 Allow QImage with more than 2GByte of image data
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>
2017-07-08 08:17:13 +00:00
Edward Welbourne
3a9e135d55 Exploit QVector3D::length() instead of duplicating its work
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>
2017-07-07 18:09:08 +00:00
Liang Qi
7f269a5db8 Merge remote-tracking branch 'origin/5.9' into dev
Conflicts:
	.qmake.conf

Change-Id: I43531e087bb810889d5c1fbfcdffb29b78804839
2017-07-06 13:54:25 +02:00
Friedemann Kleint
c8602f45cc Remove WinCE-specific sipdialog example
Task-number: QTBUG-52590
Task-number: QTBUG-60635
Change-Id: Ie6d59d1431645faf93d1538fe9f5bf1bea9f3014
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
2017-07-05 15:32:22 +00:00
Edward Welbourne
8095c33bcd Use qRadiansToDegrees() and qDegreesToRadians() more widely
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>
2017-07-05 10:15:34 +00:00
Liang Qi
c2b224a758 Merge remote-tracking branch 'origin/5.9' into dev
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
2017-07-04 16:05:53 +02:00
Nico Vertriest
db6e357d48 Doc: Add list with widgets examples using layouts
Change-Id: I585cd63f68220467de1beed3346cdaa12af2b34b
Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
2017-07-03 11:51:23 +00:00
Stephan Binner
330f024589 Convert features.wizard to QT_[REQUIRE_]CONFIG
Change-Id: I43e3d9f55a21ae0f602fc43c570321d0152cd8b6
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2017-07-02 10:38:46 +00:00
Stephan Binner
bf6f91e527 Convert features.statustip to QT_CONFIG
Change-Id: Ic719ab93ed1802fcc713885ad0421cb44c7a998b
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2017-06-29 02:23:52 +00:00
Stephan Binner
5ede5706a8 Convert features.wheelevent to QT_CONFIG
Change-Id: I46083a9115c199d1ebe024ed5f64b160a27462f1
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2017-06-28 16:15:09 +00:00
Edward Welbourne
02b7ec05d5 Be (somewhat more) consistent about the value of pi
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>
2017-06-20 09:53:46 +00:00
Shawn Rutledge
9d23aebb27 Add QLocale::formattedDataSize and consolidate use cases
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>
2017-06-20 09:53:14 +00:00
Liang Qi
7cbee56296 Merge remote-tracking branch 'origin/5.9' into dev
Conflicts:
	src/widgets/widgets/qmenu.cpp

Change-Id: I6d3baf56eb24501cddb129a3cb6b958ccc25a308
2017-06-07 14:02:43 +02:00
Shawn Rutledge
4480f47f7b tablet example: don't update the cursor image on iOS
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>
2017-06-02 20:31:16 +00:00
Stephan Binner
dbeb748de3 Convert features.printdialog to QT_[REQUIRE_]CONFIG
Change-Id: Ifb016ae2a0986b436f788b34513c81ea91f3804a
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2017-05-30 17:21:26 +00:00
Liang Qi
6a772fd201 Merge remote-tracking branch 'origin/5.9' into dev
Conflicts:
	.qmake.conf
	mkspecs/common/msvc-desktop.conf
	mkspecs/win32-g++/qmake.conf
	mkspecs/win32-icc/qmake.conf
	src/platformsupport/fontdatabases/mac/coretext.pri
	src/plugins/platforms/cocoa/qcocoawindow.h
	src/plugins/platforms/cocoa/qcocoawindow.mm

Change-Id: I74a6f7705c9547ed8bbac7260eb4645543e32655
2017-05-29 10:54:41 +02:00
Leena Miettinen
b2d8e1e5be Doc: Replace "Macintosh" with something suitable or omit it
Change-Id: I3067bd7e6ae2d6d68d5232a56eaf368a0415876c
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
2017-05-23 13:02:33 +00:00
Shawn Rutledge
8eccd1b0ad tablet example: enable high-DPI rendering
Change-Id: Ie03867208902fdc9cf794de16d7249c8994351f4
Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2017-05-15 20:49:12 +00:00
Frederik Gladhorn
6881e1613a Merge remote-tracking branch 'origin/5.9' into dev
Change-Id: I172e3e19ddcc5b7665e6c8382d725e7cc4f9794f
2017-05-10 10:11:57 +02:00
Shawn Rutledge
5f2eee18c9 tablet example: use stylus rotation property correctly
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>
2017-05-08 17:49:18 +00:00
Shawn Rutledge
3ea4f54db7 tablet example: make smoother strokes with the rotation stylus
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>
2017-05-08 17:49:12 +00:00