Commit Graph

540 Commits

Author SHA1 Message Date
Andre de la Rocha
ac8011c161 Make the Main Window example use high-DPI toolbar icons
The Main Window example generates icons programmatically for its
toolbars. However, these icons are shown with low resolution in a
high-DPI display because the application is not enabling high-DPI
pixmap support.

Change-Id: Id763b707105d02f63162fff2efeb607eb5b59ed1
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2017-12-19 17:57:08 +00:00
Eskil Abrahamsen Blomfeldt
4d88d79aa5 Update usage of QFontMetrics::width() to new API
QFontMetrics(F)::width() has been deprecated and is replaced by
horizontalAdvance(). This updates all usage of it in tests and
documentation.

It is worth noting that many or most of the usages of
QFontMetrics::width() probably intended to use boundingRect().width(),
but since it currently works, I have not looked into that, just
replaced the function name mechanically.

Change-Id: Iec382e5bad0b50f37a6cfff841bfb46ed4d4555f
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2017-12-08 15:06:32 +00:00
Allan Sandfeld Jensen
2c25a431d0 Use dependencies instead of CONFIG+=ordered
Also drops a few instances where the dependency was purely runtime,
especially for examples.

Change-Id: I2a0476f79928143596bdb3b8f01193af90574ae8
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2017-12-02 11:09:15 +00:00
Liang Qi
87204c856a Merge remote-tracking branch 'origin/5.10' into dev
Conflicts:
	src/corelib/thread/qsemaphore.cpp
	tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp
	tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp

Change-Id: Id35b535e88df63fdfe4007ea92ed4a39c4b6d707
2017-11-30 09:16:58 +01: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
Liang Qi
153e8b49ad Merge remote-tracking branch 'origin/5.10' into dev
Conflicts:
	src/network/access/qhttp2protocolhandler_p.h
	src/network/kernel/kernel.pri
	src/network/ssl/qsslkey_qt.cpp
	src/plugins/platforms/cocoa/qcocoascreen.mm
	src/plugins/platforms/windows/accessible/iaccessible2.cpp
	src/plugins/platforms/windows/accessible/iaccessible2.h
	src/plugins/platforms/windows/accessible/qwindowsaccessibility.cpp
	src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp
	src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.h
	src/widgets/widgets/qmenu_p.h
	tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp
	tests/auto/other/qaccessibility/tst_qaccessibility.cpp
	tests/auto/testlib/selftests/expected_cmptest.lightxml
	tests/auto/testlib/selftests/expected_cmptest.teamcity
	tests/auto/testlib/selftests/expected_cmptest.txt
	tests/auto/testlib/selftests/expected_cmptest.xml

Done-with: Edward Welbourne <edward.welbourne@qt.io>
Change-Id: I4217cc7d840cbae3e3dd28574741544469c4c6b9
2017-11-23 09:36:03 +01: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
Allan Sandfeld Jensen
fa9d12f4a2 Merge remote-tracking branch 'origin/5.10' into dev
Conflicts:
	src/plugins/platforms/windows/qwindowsmousehandler.cpp
	src/plugins/platforms/xcb/qxcbimage.cpp
	tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp
	tests/manual/qtabletevent/regular_widgets/main.cpp

Done-with: Friedemann Kleint<Friedemann.Kleint@qt.io>
Done-with: Mårten Nordheim<marten.nordheim@qt.io>
Change-Id: I5b2499513a92c590ed0756f7d2e93c35a64b7f30
2017-10-24 13:40:55 +02: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
d0a0a3c041 Merge remote-tracking branch 'origin/5.10' into dev
Conflicts:
	examples/network/fortuneclient/client.cpp
	examples/network/fortuneserver/server.cpp
	src/platformsupport/platformcompositor/qopenglcompositorbackingstore_p.h
	src/plugins/platforms/cocoa/qcocoabackingstore.h
	src/plugins/platforms/cocoa/qcocoaintegration.h
	src/plugins/platforms/cocoa/qcocoascreen.h
	src/plugins/platforms/ios/qiosbackingstore.h
	src/plugins/sqldrivers/oci/qsql_oci.cpp
	src/widgets/kernel/qwidgetwindow.cpp

Change-Id: Ia6dd2c52d4a691b671cf9a2ffca70deccece8f10
2017-10-17 10:34:24 +02: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
Liang Qi
aadfe7d634 Merge remote-tracking branch 'origin/5.10' into dev
Conflicts:
	src/gui/kernel/qguiapplication.cpp
	src/platformsupport/input/libinput/qlibinputpointer.cpp
	src/plugins/platforminputcontexts/ibus/qibusplatforminputcontext.h
	src/plugins/platforms/cocoa/qcocoawindow.h
	src/testlib/qtestsystem.h

Change-Id: I5975ffb3261c2dd82fe02ec4e57df7c0950226c5
2017-09-26 16:14:54 +02: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
Kevin Funk
58c14c4a7e Replace Q_NULLPTR with nullptr where possible
Remaining uses of Q_NULLPTR are in:
src/corelib/global/qcompilerdetection.h
  (definition and documentation of Q_NULLPTR)
tests/manual/qcursor/qcursorhighdpi/main.cpp
  (a test executable compilable both under Qt4 and Qt5)

Change-Id: If6b074d91486e9b784138f4514f5c6d072acda9a
Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2017-09-19 11:53:55 +00:00
Shawn Rutledge
0d51767b5d Tablet example: update only the drawn areas of the canvas
This makes an enormous difference in responsiveness on the iPad Pro:
it actually feels like real-time drawing with hardly any lag.

Change-Id: I17c3b948e818d4ee46b4d24934c929ab9b386e69
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
2017-09-15 12:13:51 +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