Commit Graph

737 Commits

Author SHA1 Message Date
Gabriel de Dietrich
8ebe8ae35e HiDPI Drag and Drop: Properly render the default image on Mac
This is only when the attached MIME data contains text, and we
fall back to rendering that text into a pixmap. It requires
getting the device pixel ratio from the source which, for now,
may be a QWidget or a QWindow. Other cases may exist, but that
would bring more dependencies than desired.

Similarly, it fixes the draggabletext example. Other examples
would require either to get updated pixmaps or change substantially
in order to support HiDPI (e.g., the fridgemagnets example).

Change-Id: I66198214233e3e06c87505744e2aaa9691fe1bb6
Reviewed-by: Filipe Azevedo <filipe.azevedo@kdab.com>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com>
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2016-08-09 18:22:03 +00:00
Jake Petroules
47511046a4 Fix rasterwindow example
At least with the eglfs platform plugin, the QBackingStore constructor
results in a null pointer access if done before creation.

Change-Id: I2e78e70700fa48499a35c55797e1b962b6e6285a
Reviewed-by: Rebecca Worledge <rebecca.worledge@theqtcompany.com>
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2016-08-04 19:55:14 +00:00
Friedemann Kleint
d1a30be5ab Polish the findfiles example to be actually useful
- Simplify the code, remove unused members
- Fix the translations of plurals to use %n
- Add tooltip displaying full paths in list
- Add context menu allowing to copy the name and  open
- Display the correct slashes on Windows
- Connect the returnPressed() signals of the line edits
- Make the search recursive
- Do not search binary files by checking the mime type

Change-Id: I3663799c88931db1f58c03ea35211e7ab03737ec
Reviewed-by: Topi Reiniö <topi.reinio@theqtcompany.com>
2016-08-03 11:53:55 +00:00
Friedemann Kleint
d5be0d3058 Polish the codecs example
- Port to Qt 5 connection syntax.
- Remove unneeded member variables.
- Adapt to screen size.
- Add a tab widget with a hex dump view to the preview dialog.
- Handle conversion errors in preview dialog,
  add status label displaying errors and warnings about failures
  and invalid characters encountered.
- Fix translated messages.

Change-Id: I916100c903e73d0d2326523753ed7398b1c34df0
Reviewed-by: Topi Reiniö <topi.reinio@theqtcompany.com>
2016-08-03 11:53:47 +00:00
Friedemann Kleint
9b1db44c2a Polish charactermap example
- 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>
2016-08-02 18:57:49 +00:00
Marc Mutz
10d4969966 examples: use QSignalBlocker
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>
2016-07-28 23:43:32 +00:00
Edward Welbourne
178ab88562 PathStrokeRenderer::initializePoints(): use float division
The (example) code used a real to hold 360 / 7, which is of course 51,
discarding the 3/7 that was most likely meant to be kept.  Noticed by
Coverity (CID 22364).  Use 360.0 instead of 360 to get more accurate
results.

Change-Id: Ifdfbb932589d8ea728710e8b656af651c9f8a7d2
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
2016-07-15 11:35:12 +00:00
Thiago Macieira
3b5db8f3a6 Examples: Fix stringification of the Qt version
(QT_VERSION % 0xffff00) is useless for now, as QT_VERSION < 0x1000000
(for now). The author of this code probably meant to use bitwise-AND.
But even that is unnecessary as the right shift discards the lower 8
bits anyway.

Change-Id: Ie585843cfb684bc3b6e3fffd145d533b05288dfc
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-07-02 16:38:39 +00:00
Olivier Goffart
ac9899b4cb mainwindow example: fix creating custom QDockWidget
The signal was connected to the wrong slot.
Regressed in 2fe56e37ed.

Change-Id: I33135fc79c3585dfbe0f6ebc04f819e919ed9ed7
Reviewed-by: Sérgio Martins <sergio.martins@kdab.com>
2016-06-24 10:57:56 +00:00
Andy Nichols
58408ffa1b Add install target to mac widget examples
Change-Id: I524ba3fcc82a6ef015241d90f212059ae7772443
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2016-06-01 02:30:45 +00:00
Friedemann Kleint
965b5b7ae0 OpenGL legacy example: Fix compilation in namespaced builds.
Change-Id: I6b2f3e8c240e105c73008fa61f9ed50cc9d982ac
Reviewed-by: Alexandru Croitor <alexandru.croitor@theqtcompany.com>
Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
Reviewed-by: Topi Reiniö <topi.reinio@theqtcompany.com>
2016-05-27 20:28:30 +00:00
Jake Petroules
2ceacd5372 Fix httpwindow example.
DownloadLocation is not writable on some platforms (iOS) in Qt 5.6,
and qt-project.org HTTPS does not work anymore.

Change-Id: I78bfbee1472cd39cd05ec7f846d1195d4fbb1b2c
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com>
2016-05-26 01:55:49 +00:00
Friedemann Kleint
37a983cd98 Dirview example: Add option for DontUseCustomDirectoryIcons.
This enables people to toy around with the option and check
what impact it has.

Change-Id: I8b49c31211cc48721b3326eea48b4e74967b1a92
Reviewed-by: Sérgio Martins <iamsergio@gmail.com>
2016-05-11 17:29:17 +00:00
Oswald Buddenhagen
780d21e129 fix example installs
Change-Id: Ib34795f10b1d7120b28958127ced049af3b4f72b
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
2016-05-03 10:25:33 +00:00
Oswald Buddenhagen
1ae1f0da0d delete unreferenced file
Change-Id: Ibc70cafdc098ff4f6036182d6f41a2debb15a996
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
2016-05-03 10:25:30 +00:00
Oswald Buddenhagen
2c7b3726bf install the opengl legacy examples
while they are not built, their sources should be installed as long we
don't delete them completely.

Change-Id: I5e628e96cc9715520cb6e5aadb2cae61d1d03a4f
Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
2016-05-03 10:25:25 +00:00
Oswald Buddenhagen
619ab8080d fix build and installation of queuedcustomtype example
it was not built at all (and didn't build with qt in a namespace), and
consequently was not installed as well.

Change-Id: I24d8ac4dd5d70927c262ad6336e5ee32a0fd003a
Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
2016-05-03 10:25:22 +00:00
Oswald Buddenhagen
5bbbea4c83 normalize structure of plugandpaint example
as in other examples which come with plugins, use an additional
hierarchy level which contains the app and plugin subdirs.

Change-Id: I2487755967aa3474c337c8c8af10be49627b63d0
Reviewed-by: Topi Reiniö <topi.reinio@theqtcompany.com>
2016-05-03 10:25:18 +00:00
Allan Sandfeld Jensen
1b21170faa Add missing indentation
Discovered with gcc 6.

Change-Id: Ib5ba49df6a1f4d9574842ffe5f3e9856da0e60d0
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
2016-04-28 22:39:46 +00:00
Friedemann Kleint
759b3f49c5 OpenGL/contextinfo-Example: Add command line options and status label.
Add command line options to be able to set the QCoreApplication attributes
that influence Open GL context creation and add a status label at the
bottom that displays it besides the QT_OPENGL environment variable.

Task-number: QTBUG-52693
Change-Id: Id9793292596e0feb3da5220fde2e5b2e495f87ff
Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
2016-04-23 06:10:45 +00:00
Joni Poikelin
684ae5f7fe Fix compiling examples with -no-sm
There is access to session manager functions which are not present when
building with -no-sm.

Change-Id: I1c92b4a70f7adb56816877930fb9f55b04ff8940
Reviewed-by: Andy Shaw <andy.shaw@theqtcompany.com>
2016-04-07 08:39:37 +00:00
Friedemann Kleint
2a282551ac Remove empty first lines of files.
They might upset licensing related tools.

Change-Id: I858d21fc418ba16959c88847b559b11bea29ed6b
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
2016-04-06 18:26:26 +00:00
Friedemann Kleint
dd9cf15005 QtXml/htmlnfo example: Remove Nokia-related HTML demo file.
Change-Id: I0b0ebcf20747a607ad9eed130d7b4fe810a1f2e1
Reviewed-by: Mitch Curtis <mitch.curtis@theqtcompany.com>
2016-04-06 18:25:29 +00:00
Frederik Gladhorn
6380cc710e Merge remote-tracking branch 'origin/5.6.0' into 5.6
Change-Id: Iac8ff05cd76cbacf859138a73e8e2ed0a979c75a
2016-03-17 16:02:45 +01:00
Edward Welbourne
6a2892bdef Skip spurious .toLower() on returns of QUrl::scheme()
QUrl::setScheme() parses and canonicalises the scheme, so that
scheme() always returns a lower-case string anyway; no need to
.toLower() it.

Change-Id: Ied00814b63f159386a42552dcf06346ee56f9f97
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@theqtcompany.com>
2016-03-10 15:00:59 +00:00
Andreas Hartmetz
e7bf0edfd4 Add option to disable "session management by closing windows".
That feature is a poor man's session management for applications
that do not implement any specific session management features.
It badly interferes with proper session management support, so
applications must be able to disable it.

This enables fixing applications with
QGuiApplication::quitOnLastWindowClosed() true - the default -
dying too early, before they are enumerated for the list of
applications to restart on session restore, thus preventing them
from being restored. See
https://bugs.kde.org/show_bug.cgi?id=354724

[ChangeLog][QtGui] Qt asking to close windows on session exit as
a fallback session management mechanism has been made optional.
Disabling it fixes session management for applications that
implement full session management. See
QGuiApplication::isFallbackSessionManagementEnabled().

Task-number: QTBUG-49667
Change-Id: Ib22e58c9c64351dea8b7e2a74db91d26dd7ab7aa
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: David Faure <david.faure@kdab.com>
2016-02-15 16:10:20 +00:00
Friedemann Kleint
ab3e2f66e9 Standarddialogs example: Remove horizontal spacer from fullscreen layout.
It does not work as expected since the QLineEdits do not expand.
Amends b880b7e1ac.

Change-Id: I0b3b3822cca7fc6442a7155eecd46bd3d134d069
Reviewed-by: Shawn Rutledge <shawn.rutledge@theqtcompany.com>
2016-02-09 15:24:54 +00:00
Nico Vertriest
3b0c75316c Doc: Replaced Trolltech logo with Qt logo
Task-number: QTBUG-37505
Change-Id: If59039b2f7e60ffea3e8c7803d38e528acf35383
Reviewed-by: Martin Smith <martin.smith@theqtcompany.com>
2016-02-03 12:37:37 +00:00
Shawn Rutledge
e6de387ea0 Polish the Tablet example
- 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>
2016-01-28 19:17:08 +00:00
Nico Vertriest
397061a6a9 Doc: Added brief statement to XML examples
Task-number: QTBUG-50261
Change-Id: I0ba4bd630746612d0f1f1632e87c6fdd6aef160f
Reviewed-by: Topi Reiniö <topi.reinio@theqtcompany.com>
2016-01-26 09:39:33 +00:00
Nico Vertriest
149c659dc1 Doc: removed double occurrence of systray.qdoc
Task-number: QTBUG-50287
Change-Id: Iaf8602fc338dadcc0998f33d41ad9fbc827589e2
Reviewed-by: Topi Reiniö <topi.reinio@theqtcompany.com>
2016-01-26 09:39:21 +00:00
Nico Vertriest
d9bbf610a4 Doc: Added brief statement for examples overview page
Task-number: QTBUG-50261
Change-Id: Ia0daf0c5c7fc0b2e54904f0b7fe6ebe1220e5c4d
Reviewed-by: Martin Smith <martin.smith@theqtcompany.com>
2016-01-26 09:32:49 +00:00
Liang Qi
8f569c740a Merge remote-tracking branch 'origin/5.5' into 5.6
Conflicts:
	config.tests/common/atomic64/atomic64.cpp
	configure
	src/3rdparty/forkfd/forkfd.c
	src/corelib/io/forkfd_qt.cpp
	src/widgets/kernel/qwidgetwindow.cpp
	tests/auto/corelib/statemachine/qstatemachine/tst_qstatemachine.cpp
	tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp
	tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp
	tools/configure/configureapp.cpp

Change-Id: Ic6168d82e51a0ef1862c3a63bee6722e8f138414
2016-01-19 10:03:01 +01:00
Andy Shaw
faf4865b80 Use unique shortcuts for the different actions
Change-Id: Ibc143ffac83dfb30facc9e93651e5f18550ab612
Reviewed-by: Topi Reiniö <topi.reinio@theqtcompany.com>
2015-12-11 09:40:55 +00:00
Friedemann Kleint
b880b7e1ac Standarddialogs example: Adapt layout for fullscreen platforms.
Insert a group box depending on style hints.

Change-Id: I1b49dc31d5bd32c92d88f95be0683d5223329c11
Reviewed-by: Topi Reiniö <topi.reinio@theqtcompany.com>
Reviewed-by: Oliver Wolff <oliver.wolff@theqtcompany.com>
2015-12-09 10:22:55 +00:00
Friedemann Kleint
fcedf8998e fortuneserver/fortuneclient: Fix layout for WinRT.
Use the new API QStyleHints::showIsMaximized().

Change-Id: I1342b3c29ef4ccfcf635a32d403f9aa7ce0cb4e4
Reviewed-by: Oliver Wolff <oliver.wolff@theqtcompany.com>
2015-12-09 10:19:48 +00:00
Friedemann Kleint
de7d2eb2ad Polish the fortune server/client examples.
- Remove Qt::WindowContextHelpButtonHint.
- Make the server label interactive (enable copy).
- Introduce new connection syntax.
- Remove unneeded member variables.
- Use constructor initialization where appropriate.
- Adapt the layout to fullscreen platforms by wrapping it
  into a QGroupBox.

Change-Id: I6e397ad082f22ba1e99fc5a17440b2be1f9584f6
Reviewed-by: Topi Reiniö <topi.reinio@theqtcompany.com>
2015-12-03 15:03:26 +00:00
Topi Reinio
87d6b0514b Doc: Fortune Server Example: fix typo in function name
Change-Id: Ib0a5030cc2f88cf90ba7d25c75871c439486abe3
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
2015-11-30 12:24:17 +00:00
Nico Vertriest
037b05ac76 Doc: corrected error in doc static plugins
Task-number: QTBUG-43160
Change-Id: I94f92318cec095391050b2af90980010bd1066b9
Reviewed-by: Topi Reiniö <topi.reinio@digia.com>
Reviewed-by: Martin Smith <martin.smith@digia.com>
2015-11-13 20:33:44 +00:00
Friedemann Kleint
d482a92858 Polish the HTTP example.
- Remove unneeded member variables.
- Use new connection syntax.
- Streamline code.
- Add a QCheckBox for launching the file after download
  and make the default file name and download directory configureable.
- Make status messages more verbose.
- Set Password echo mode on authentication dialog.
- Extract the progress dialog to a separate class
  that is directly connected to the QNetworkReply, which
  is created on demand. Set set minimum  and duration on it.
  This fixes a crash that currently occurs when clicking "Abort"
  on the SSL error dialog and "Cancel" on the progress dialog that is
  then re-shown due to its internal force timer/minimum duration handling.
- Resize according to screen size.

Task-number: QTBUG-48332
Change-Id: Ia2611e63fe96d6f49e4cdd06049a206ddb2c2864
Reviewed-by: David Faure <david.faure@kdab.com>
2015-11-05 13:54:13 +00:00
Alejandro Exojo
115f303352 Fix the closeEvent of the systray example on OS X
The implementation of the close event handler requires handling the two
close events that are received on OS X when the user quits through the
application menu bar or the Command+Q shortcut. The first is an
spontaneous event, and the second a non-spontaneous one with the window
already closed.

Change-Id: I24e3d3f0de4d631bd2d5616c85ce747f085691e0
Reviewed-by: Topi Reiniö <topi.reinio@digia.com>
2015-11-03 09:01:36 +00:00
Marc Mutz
1c9f53c4e5 examples: remove use of obsolete QStyleOption*V<N> typedefs
These are obsolete since Qt 5.0.

Change-Id: I297477eff129558553f52a04bb7828d95db27969
Reviewed-by: Topi Reiniö <topi.reinio@digia.com>
2015-11-02 18:43:26 +00:00
Rafael Roquetto
c9195ab36d TextEdit example: fix build when clipboard is disabled.
Change-Id: Ib25563e3dc299dc2d23bed8b3071af1ba81150e7
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
2015-10-19 14:56:45 +00:00
Friedemann Kleint
6ea67f52da Image viewer example: Fix broken error message formatting.
Task-number: QTBUG-48851
Change-Id: Ie86bcc498c9dc1f9754192a256a28fa467f6dbc9
Reviewed-by: Shawn Rutledge <shawn.rutledge@theqtcompany.com>
2015-10-19 14:50:32 +00:00
Alexander Volkov
59b860450f Polish the complexpingpong example
- Use QDBusServiceWatcher to detect that pong service became available
  (QDBusConnectionInterface::serviceOwnerChanged() signal is deprecated).
- Use new connection syntax.

Task-number: QTBUG-28082
Change-Id: I7b93b961ee6d45aaeefab77fa1d1943e38b4a4c0
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
2015-10-19 10:29:50 +00:00
Kai Koehne
c890fa4787 Remove webkit-guide from examples
Qt5WebKit is now deprecated and removed from the packages.

Change-Id: I176344cb2a6b43ffc44cc0e7ef1abb4e765a35b4
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@theqtcompany.com>
Reviewed-by: Topi Reiniö <topi.reinio@digia.com>
2015-10-19 08:44:45 +00:00
Liang Qi
b7ac036b72 Merge remote-tracking branch 'origin/5.5' into 5.6
Conflicts:
	src/network/socket/qabstractsocket.cpp
	src/plugins/platforms/winrt/qwinrtscreen.cpp
	src/sql/drivers/mysql/qsql_mysql.cpp

Change-Id: Ifb73623d09f53340ee5e10283f1f86b580998902
2015-10-13 23:03:51 +02:00
Friedemann Kleint
f9bf737d74 Examples/Doc snippets: Fix single-character string literals.
Use character literals where applicable.

Change-Id: I79fa5018f05735201ae35ee94ba0d356fcad1056
Reviewed-by: Topi Reiniö <topi.reinio@digia.com>
2015-10-13 16:37:07 +00:00
Friedemann Kleint
c8cd9f1b9a Polish DnD Examples.
- Remove class DragLabel in draggabletext and add a static creation
  function instead since it only has a constructor setting some
  properties.
- Use QRegularExpression instead of QRegExp
- Use new connection syntax.
- Ensure compilation with
  DEFINES += QT_NO_CAST_TO_ASCII QT_NO_CAST_FROM_ASCII
  demonstrating use of QLatin1String vs QStringLiteral.
- Streamline code.

Change-Id: I2e2ddeb40837dba379990836c77fb72ad7263e2d
Reviewed-by: Oliver Wolff <oliver.wolff@theqtcompany.com>
2015-10-09 15:59:21 +00:00
Samuel Gaist
decc546368 Doc: remove unused code from OpenGL Window example
Change-Id: Ifb2c7206dee55102eba91b4c30543f3ac4838259
Reviewed-by: Topi Reiniö <topi.reinio@digia.com>
2015-10-07 10:56:04 +00:00