Commit Graph

15 Commits

Author SHA1 Message Date
Shawn Rutledge e0947fa3e7 Make a few improvements to the Window example
- Splash assumes less, for better reuse: set visible where used,
  start Timer only when visible
- no need for SystemPalette: Window and Item have palette properties
- get rid of MouseAreas
- click to set a random color
- make buttons square with Unicode "icons"
- fullscreen button has Binding on checked, to be checked regardless how
  visibility is changed; onClicked is smaller
- tooltips

Pick-to: 6.5
Change-Id: Ibbc1be2a3b113e68f61c69ef695ceea8c300fd1e
Reviewed-by: Oliver Eftevaag <oliver.eftevaag@qt.io>
2023-05-18 15:59:42 +02:00
Lucie Gérard 0dc4fd240a Use SPDX license identifiers
Replace the current license disclaimer in files by
a SPDX-License-Identifier.
Files that have to be modified by hand are modified.
License files are organized under LICENSES directory.

Pick-to: 6.4
Task-number: QTBUG-67283
Change-Id: I63563bbeb6f60f89d2c99660400dca7fab78a294
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2022-06-11 08:05:15 +02:00
Oliver Eftevaag 454da9f721 Update window example to use QtQuickControls2
Replaces the use of custom made components from the shared directory, with QtQuickControls2 components.

Fixes: QTBUG-90883
Change-Id: I6e659188aa75bfacf8181689f30580783bf280a2
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
2021-02-23 13:49:51 +01:00
Ulf Hermann 828cdcabf8 Remove QtQuick.Window plugin
We move all the types into QtQuick itself and retain QtQuick.Window only
as alias to QtQuick. This requires support for qmldirs that consist of
only an import statement.

[ChangeLog][QtQuick][Important Behavior Changes] The contents of the
QtQuick.Window QML module have been moved into the QtQuick module.
QtQuick.Window is merely and alias for QtQuick now. An explicit import
of QtQuick will override this alias. Therefore, if you import QtQuick
with a different version than QtQuick.Window, you will get the
QtQuick.Window types of the version given in the QtQuick import now.

Task-number: QTBUG-84639
Change-Id: Ia82afab0ac2faba70cfdaf53dc8dfe4261e1113f
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
2020-06-15 16:56:10 +02:00
Ulf Hermann 90b4528b84 Avoid discouraged patterns in examples
In particular, use required properties where applicable, explicitly
import QtQml where we use it, avoid unqualified access into the root
scope of a component, use JavaScript functions with explicit parameters
as signal handlers.

Change-Id: I3eaaba47cc3c7a2a12d488e36f9eec145cedbb0e
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2020-02-11 19:26:05 +01:00
Tor Arne Vestbø 6d42c6fd33 window example: close window on 'X' button press, not just hide it
Change-Id: Ice699b3350b223db25e4865c930caf6e3afb647c
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
2018-04-25 17:43:12 +00:00
Kai Koehne ea6cd0de3c Fix outdated BSD license header
Change-Id: Icc08925454445fc9497fb3bfd2c26efe90605983
Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io>
2017-10-17 11:18:11 +00:00
Laszlo Agocs d6dfbe8fd5 Enable making window-screen associations from QML
Qt Quick provides a Screen attached property to query information
about the screen an item's window belongs to. This is a good start,
but has two problems: it lacks some virtual desktop related info
(e.g. the position in the virtual desktop) and it cannot be used in
combination with the Window element in order to achieve a QML
equivalent of QWindow::setScreen().

Therefore add the missing virtualX and virtualY properties and
introduce Qt.application.screens. The latter is an equivalent to
QGuiApplication::screens() and is a JS array the elements of which
can be set as the value of the new Window.targetScreen property.

This means that a call like
window->setScreen(QGuiApplication::screens()[0]) translates to
Window { targetScreen: Qt.application.screens[0]; ... } when using the
Window type from QML. Screen addition or removal can be acted upon via
onScreensChanged.

QQuickScreenAttached has been split into two in order to allow reusing the
QScreen wrapping queries for other purposes as well.

Task-number: QTBUG-56115
Change-Id: I4b2fbd873315b40d0afe878da2fc50966c00e2e0
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2016-10-10 11:48:57 +00:00
Shawn Rutledge cca4531ecf add shared Label for examples, and use in the Window example
It just saves the trouble of setting the Text color to the correct
palette text color repeatedly, and avoids having black text on
a dark background in case a dark theme is in use.

Change-Id: If5c38fabe7f047fa5f6956a9d8b235886ab7ab5c
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
2016-10-10 08:05:52 +00:00
Jani Heikkinen 20c207815a Fixed license headers
Change-Id: I4d5640ff95e1361ec7e65fb3e87d7726d8185ff5
Reviewed-by: Sergio Ahumada <sahumada@texla.cl>
2015-02-17 13:33:18 +00:00
Jani Heikkinen c5796292ad Update copyright headers
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.

Change-Id: I61120571787870c0ed17066afb31779b1e6e30e9
Reviewed-by: Iikka Eklund <iikka.eklund@theqtcompany.com>
2015-02-12 10:28:11 +00:00
Shawn Rutledge a34eddbf7a QtQuick window example improvements: window size and DPI info
On high-resolution displays it's important to size the window so that
the content will fit.  Also show the DPI conversion for pixel density.

Change-Id: Ie35852ecff0bb0ee5ab9b77c6c18e82cfc300448
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
2013-12-18 13:14:34 +01:00
Shawn Rutledge 69cf114723 examples/quick/window example: fullscreen is possible on OSX
It's normally disallowed without the WindowFullscreenButtonHint.
But if we're going to declare a value for flags, then we have to
put back the Window type which would otherwise be there by default.

Task-number: QTBUG-33607
Change-Id: Ibbd593b2648b98d37c7f70a0b9f96787b0a40f22
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
2013-11-15 16:33:24 +01:00
Shawn Rutledge 251a267fb5 window example: show only the splash screen until the timeout
The window takes time to resize itself; we can avoid letting the user
see that by delaying visibility of the main window.

Change-Id: I81d656102b384a66b5539cbd879aadb85261ba33
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
2013-05-30 12:07:21 +02:00
Shawn Rutledge 1ef4e4b156 window and Screen example: new properties; splash screen
Demonstrates the new properties, how to make a splash screen, and
how to make a standalone app with an icon.  Combined the Screen info
into this example too.

Change-Id: I5b731539b39c55327f4e5b93860a880a35835896
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@digia.com>
2013-05-28 10:08:41 +02:00