| CMakeLists.txt |
|
3794 |
- |
| doc |
|
|
- |
| qquicklabsplatformcolordialog.cpp |
!
\qmltype ColorDialog
\inherits Dialog
//! \nativetype QQuickLabsPlatformColorDialog
\inqmlmodule Qt.labs.platform
\since 5.8
\deprecated [6.9] Use \l [QtQuickDialogs] {ColorDialog}{QtQuick.Dialogs ColorDialog} instead.
\brief A native color dialog.
The ColorDialog type provides a QML API for native platform color dialogs.
\image {qtlabsplatform-colordialog-gtk.png} {A native color dialog}
To show a color dialog, construct an instance of ColorDialog, set the
desired properties, and call \l {Dialog::}{open()}. The \l currentColor
property can be used to determine the currently selected color in the
dialog. The \l color property is updated only after the final selection
has been made by accepting the dialog.
\code
MenuItem {
text: "Color"
onTriggered: colorDialog.open()
}
ColorDialog {
id: colorDialog
currentColor: document.color
}
MyDocument {
id: document
color: colorDialog.color
}
\endcode
\section2 Availability
A native platform color dialog is currently available on the following platforms:
\list
\li iOS
\li Linux (when running with the GTK+ platform theme)
\li macOS
\endlist
\input includes/widgets.qdocinc 1
\labs
\sa QtQuick.Dialogs::ColorDialog
|
5588 |
- |
| qquicklabsplatformcolordialog_p.h |
|
2086 |
- |
| qquicklabsplatformdialog.cpp |
!
\qmltype Dialog
\inherits QtObject
//! \nativetype QQuickLabsPlatformDialog
\inqmlmodule Qt.labs.platform
\since 5.8
\deprecated [6.11] Use \l [QtQuickDialogs] {Dialog}{QtQuick.Dialogs Dialog} instead.
\brief The base class of native dialogs.
The Dialog type provides common QML API for native platform dialogs.
To show a native dialog, construct an instance of one of the concrete
Dialog implementations, set the desired properties, and call \l open().
Dialog emits \l accepted() or \l rejected() when the user is done with
the dialog.
\labs
|
9050 |
- |
| qquicklabsplatformdialog_p.h |
|
3541 |
- |
| qquicklabsplatformfiledialog.cpp |
!
\qmltype FileDialog
\inherits Dialog
//! \nativetype QQuickLabsPlatformFileDialog
\inqmlmodule Qt.labs.platform
\since 5.8
\deprecated [6.9] Use \l [QtQuickDialogs] {FileDialog}{QtQuick.Dialogs FileDialog} instead.
\brief A native file dialog.
The FileDialog type provides a QML API for native platform file dialogs.
\image {qtlabsplatform-filedialog-gtk.png} {A native file dialog}
To show a file dialog, construct an instance of FileDialog, set the
desired properties, and call \l {Dialog::}{open()}. The \l currentFile
or \l currentFiles properties can be used to determine the currently
selected file(s) in the dialog. The \l file and \l files properties
are updated only after the final selection has been made by accepting
the dialog.
\code
MenuItem {
text: "Open..."
onTriggered: fileDialog.open()
}
FileDialog {
id: fileDialog
currentFile: document.source
folder: StandardPaths.writableLocation(StandardPaths.DocumentsLocation)
}
MyDocument {
id: document
source: fileDialog.file
}
\endcode
\section2 Availability
A native platform file dialog is currently available on the following platforms:
\list
\li Android
\li iOS
\li Linux (when running with the GTK+ platform theme)
\li macOS
\li Windows
\endlist
\input includes/widgets.qdocinc 1
\labs
\sa QtQuick.Dialogs::FileDialog, FolderDialog, StandardPaths
|
20188 |
- |
| qquicklabsplatformfiledialog_p.h |
|
5625 |
- |
| qquicklabsplatformfolderdialog.cpp |
!
\qmltype FolderDialog
\inherits Dialog
//! \nativetype QQuickLabsPlatformFolderDialog
\inqmlmodule Qt.labs.platform
\since 5.8
\deprecated [6.9] Use \l [QtQuickDialogs] {FolderDialog}{QtQuick.Dialogs FolderDialog} instead.
\brief A native folder dialog.
The FolderDialog type provides a QML API for native platform folder dialogs.
\image {qtlabsplatform-folderdialog-gtk.png} {A native folder dialog}
To show a folder dialog, construct an instance of FolderDialog, set the
desired properties, and call \l {Dialog::}{open()}. The \l currentFolder
property can be used to determine the currently selected folder in the
dialog. The \l folder property is updated only after the final selection
has been made by accepting the dialog.
\code
MenuItem {
text: "Open..."
onTriggered: folderDialog.open()
}
FolderDialog {
id: folderDialog
currentFolder: viewer.folder
folder: StandardPaths.standardLocations(StandardPaths.PicturesLocation)[0]
}
MyViewer {
id: viewer
folder: folderDialog.folder
}
\endcode
\section2 Availability
A native platform folder dialog is currently available on the following platforms:
\list
\li Android
\li iOS
\li Linux (when running with the GTK+ platform theme)
\li macOS
\li Windows
\endlist
\input includes/widgets.qdocinc 1
\labs
\sa QtQuick.Dialogs::FolderDialog, FileDialog, StandardPaths
|
7874 |
- |
| qquicklabsplatformfolderdialog_p.h |
|
2604 |
- |
| qquicklabsplatformfontdialog.cpp |
!
\qmltype FontDialog
\inherits Dialog
//! \nativetype QQuickLabsPlatformFontDialog
\inqmlmodule Qt.labs.platform
\since 5.8
\deprecated [6.9] Use \l [QtQuickDialogs] {FontDialog}{QtQuick.Dialogs FontDialog} instead.
\brief A native font dialog.
The FontDialog type provides a QML API for native platform font dialogs.
\image {qtlabsplatform-fontdialog-gtk.png} {A native font dialog}
To show a font dialog, construct an instance of FontDialog, set the
desired properties, and call \l {Dialog::}{open()}. The \l currentFont
property can be used to determine the currently selected font in the
dialog. The \l font property is updated only after the final selection
has been made by accepting the dialog.
\code
MenuItem {
text: "Font"
onTriggered: fontDialog.open()
}
FontDialog {
id: fontDialog
currentFont.family: document.font
}
MyDocument {
id: document
font: fontDialog.font
}
\endcode
\section2 Availability
A native platform font dialog is currently available on the following platforms:
\list
\li iOS
\li Linux (when running with the GTK+ platform theme)
\li macOS
\endlist
\input includes/widgets.qdocinc 1
\labs
\sa QtQuick.Dialogs::FontDialog
|
5583 |
- |
| qquicklabsplatformfontdialog_p.h |
|
2043 |
- |
| qquicklabsplatformicon.cpp |
|
1059 |
- |
| qquicklabsplatformicon_p.h |
|
1398 |
- |
| qquicklabsplatformiconloader.cpp |
|
1613 |
- |
| qquicklabsplatformiconloader_p.h |
|
1227 |
- |
| qquicklabsplatformmenu.cpp |
!
\qmltype Menu
\inherits QtObject
//! \nativetype QQuickLabsPlatformMenu
\inqmlmodule Qt.labs.platform
\since 5.8
\brief A native menu.
The Menu type provides a QML API for native platform menu popups.
\image {qtlabsplatform-menu.png} {A native popup menu}
Menu can be used in a \l MenuBar, or as a stand-alone context menu.
The following example shows how to open a context menu on right mouse
click:
\code
MouseArea {
anchors.fill: parent
acceptedButtons: Qt.RightButton
onClicked: zoomMenu.open()
}
Menu {
id: zoomMenu
MenuItem {
text: qsTr("Zoom In")
shortcut: StandardKey.ZoomIn
onTriggered: zoomIn()
}
MenuItem {
text: qsTr("Zoom Out")
shortcut: StandardKey.ZoomOut
onTriggered: zoomOut()
}
}
\endcode
\section2 Submenus
To create submenus, declare a Menu as a child of another Menu:
\qml
Menu {
title: qsTr("Edit")
Menu {
title: qsTr("Advanced")
MenuItem {
text: qsTr("Auto-indent Selection")
onTriggered: autoIndentSelection()
}
MenuItem {
text: qsTr("Rewrap Paragraph")
onTriggered: rewrapParagraph()
}
}
}
\endqml
\section2 Dynamically generating menu items
You can dynamically generate menu items with \l Instantiator. The following
code shows how you can implement a "Recent Files" submenu, where the items
come from a list of files stored in settings:
\snippet qtlabsplatform-menu-instantiator.qml menu
\section2 Availability
A native platform menu is currently available on the following platforms:
\list
\li macOS
\li iOS
\li Android
\li Linux (only available as a stand-alone context menu when running with the GTK+ platform theme)
\endlist
\input includes/widgets.qdocinc 1
\labs
\sa MenuItem, MenuSeparator, MenuBar
|
21713 |
- |
| qquicklabsplatformmenu_p.h |
|
6291 |
- |
| qquicklabsplatformmenubar.cpp |
!
\qmltype MenuBar
\inherits QtObject
//! \nativetype QQuickLabsPlatformMenuBar
\inqmlmodule Qt.labs.platform
\since 5.8
\brief A native menubar.
The MenuBar type provides a QML API for native platform menubars.
\image {qtlabsplatform-menubar.png} {A native menubar}
A menubar consists of a list of drop-down menus.
\code
MenuBar {
id: menuBar
Menu {
id: fileMenu
title: qsTr("File")
// ...
}
Menu {
id: editMenu
title: qsTr("&Edit")
// ...
}
Menu {
id: viewMenu
title: qsTr("&View")
// ...
}
Menu {
id: helpMenu
title: qsTr("&Help")
// ...
}
}
\endcode
MenuBar is currently available on the following platforms:
\list
\li macOS
\li Android
\li Linux (only available on desktop environments that provide a global D-Bus menu bar)
\li Windows
\endlist
\labs
\sa Menu
|
8075 |
- |
| qquicklabsplatformmenubar_p.h |
|
2875 |
- |
| qquicklabsplatformmenuitem.cpp |
!
\qmltype MenuItem
\inherits QtObject
//! \nativetype QQuickLabsPlatformMenuItem
\inqmlmodule Qt.labs.platform
\since 5.8
\brief A native menu item.
The MenuItem type provides a QML API for native platform menu items.
\image qtlabsplatform-menu.png
{Native menu with Zoom In and Zoom Out items}
A menu item consists of an \l icon, \l text, and \l shortcut.
\code
Menu {
id: zoomMenu
MenuItem {
text: qsTr("Zoom In")
shortcut: StandardKey.ZoomIn
onTriggered: zoomIn()
}
MenuItem {
text: qsTr("Zoom Out")
shortcut: StandardKey.ZoomOut
onTriggered: zoomOut()
}
}
\endcode
\labs
\sa Menu, MenuItemGroup
|
16173 |
- |
| qquicklabsplatformmenuitem_p.h |
|
4912 |
- |
| qquicklabsplatformmenuitemgroup.cpp |
!
\qmltype MenuItemGroup
\inherits QtObject
//! \nativetype QQuickLabsPlatformMenuItemGroup
\inqmlmodule Qt.labs.platform
\since 5.8
\brief A group for managing native menu items.
The MenuItemGroup groups native menu items together.
MenuItemGroup is exclusive by default. In an exclusive menu item
group, only one item can be checked at any time; checking another
item automatically unchecks the previously checked one. MenuItemGroup
can be configured as non-exclusive, which is particularly useful for
showing, hiding, enabling and disabling items together as a group.
The most straight-forward way to use MenuItemGroup is to assign
a list of items.
\code
Menu {
id: verticalMenu
title: qsTr("Vertical")
MenuItemGroup {
id: verticalGroup
items: verticalMenu.items
}
MenuItem { text: qsTr("Top"); checkable: true }
MenuItem { text: qsTr("Center"); checked: true }
MenuItem { text: qsTr("Bottom"); checkable: true }
}
\endcode
The same menu may sometimes contain items that should not be included
in the same exclusive group. Such cases are best handled using the
\l {MenuItem::group}{group} property.
\code
Menu {
id: horizontalMenu
title: qsTr("Horizontal")
MenuItemGroup {
id: horizontalGroup
}
MenuItem {
checked: true
text: qsTr("Left")
group: horizontalGroup
}
MenuItem {
checkable: true
text: qsTr("Center")
group: horizontalGroup
}
MenuItem {
text: qsTr("Right")
checkable: true
group: horizontalGroup
}
MenuItem { separator: true }
MenuItem { text: qsTr("Justify"); checkable: true }
MenuItem { text: qsTr("Absolute"); checkable: true }
}
\endcode
More advanced use cases can be handled using the addItem() and
removeItem() methods.
\labs
\sa MenuItem
|
10467 |
- |
| qquicklabsplatformmenuitemgroup_p.h |
|
3064 |
- |
| qquicklabsplatformmenuseparator.cpp |
!
\qmltype MenuSeparator
\inherits MenuItem
//! \nativetype QQuickLabsPlatformMenuSeparator
\inqmlmodule Qt.labs.platform
\since 5.8
\brief A native menu separator.
The MenuSeparator type is provided for convenience. It is a MenuItem
that has the \l {MenuItem::}{separator} property set to \c true by default.
\image qtlabsplatform-menubar.png
{Native menubar with Edit menu showing Cut, Copy, and Paste}
\labs
\sa Menu, MenuItem
|
979 |
- |
| qquicklabsplatformmenuseparator_p.h |
|
897 |
- |
| qquicklabsplatformmessagedialog.cpp |
!
\qmltype MessageDialog
\inherits Dialog
//! \nativetype QQuickLabsPlatformMessageDialog
\inqmlmodule Qt.labs.platform
\since 5.8
\deprecated [6.9] Use \l [QtQuickDialogs] {MessageDialog}{QtQuick.Dialogs MessageDialog} instead.
\brief A native message dialog.
The MessageDialog type provides a QML API for native platform message dialogs.
\image {qtlabsplatform-messagedialog-android.png} {A native message dialog}
A message dialog is used to inform the user, or ask the user a question.
A message dialog displays a primary \l text to alert the user to a situation,
an \l {informativeText}{informative text} to further explain the alert or to
ask the user a question, and an optional \l {detailedText}{detailed text} to
provide even more data if the user requests it. A message box can also display
a configurable set of \l buttons for accepting a user response.
To show a message dialog, construct an instance of MessageDialog, set the
desired properties, and call \l {Dialog::}{open()}.
\code
MessageDialog {
buttons: MessageDialog.Ok
text: "The document has been modified."
}
\endcode
The user must click the \uicontrol OK button to dismiss the message dialog.
A modal message dialog blocks the rest of the GUI until the message is
dismissed.
A more elaborate approach than just alerting the user to an event is to
also ask the user what to do about it. Store the question in the
\l {informativeText}{informative text} property, and specify the \l buttons
property to the set of buttons you want as the set of user responses. The
buttons are specified by combining values using the bitwise OR operator. The
display order for the buttons is platform dependent.
\code
MessageDialog {
text: "The document has been modified."
informativeText: "Do you want to save your changes?"
buttons: MessageDialog.Ok | MessageDialog.Cancel
onAccepted: document.save()
}
\endcode
\image {qtlabsplatform-messagedialog-informative-android.png} {A native informative message dialog}
The \l clicked() signal passes the information of which button was clicked.
A native platform message dialog is currently available on the following platforms:
\list
\li Android
\li iOS
\li macOS
\endlist
\input includes/widgets.qdocinc 1
\labs
\sa QtQuick.Dialogs::MessageDialog
|
11597 |
- |
| qquicklabsplatformmessagedialog_p.h |
|
2765 |
- |
| qquicklabsplatformstandardpaths.cpp |
!
\qmltype StandardPaths
\inherits QtObject
//! \nativetype QQuickLabsPlatformStandardPaths
\inqmlmodule Qt.labs.platform
\since 5.8
\deprecated [6.4] Use QtCore::StandardPaths instead.
\brief Provides access to the standard system paths.
The StandardPaths singleton type provides methods for querying the standard
system paths. The standard paths are mostly useful in conjunction with the
FileDialog and FolderDialog types.
\qml
FileDialog {
folder: StandardPaths.writableLocation(StandardPaths.DocumentsLocation)
}
\endqml
\labs
\sa QtCore::StandardPaths, FileDialog, FolderDialog, QStandardPaths
|
4401 |
- |
| qquicklabsplatformstandardpaths_p.h |
|
2076 |
- |
| qquicklabsplatformsystemtrayicon.cpp |
!
\qmltype SystemTrayIcon
\inherits QtObject
//! \nativetype QQuickLabsPlatformSystemTrayIcon
\inqmlmodule Qt.labs.platform
\since 5.8
\brief A system tray icon.
The SystemTrayIcon type provides an icon for an application in the system tray.
Many desktop platforms provide a special system tray or notification area,
where applications can display icons and notification messages.
\image {qtlabsplatform-systemtrayicon.png} {System tray icon}
The following example shows how to create a system tray icon, and how to make
use of the \l activated() signal:
\code
SystemTrayIcon {
visible: true
icon.source: "qrc:/images/tray-icon.png"
onActivated: {
window.show()
window.raise()
window.requestActivate()
}
}
\endcode
\section2 Tray menu
SystemTrayIcon can have a menu that opens when the icon is activated.
\image {qtlabsplatform-systemtrayicon-menu.png} {System tray icon with menu}
The following example illustrates how to assign a \l Menu to a system tray icon:
\code
SystemTrayIcon {
visible: true
icon.source: "qrc:/images/tray-icon.png"
menu: Menu {
MenuItem {
text: qsTr("Quit")
onTriggered: Qt.quit()
}
}
}
\endcode
\section2 Notification messages
SystemTrayIcon can display notification messages.
\image {qtlabsplatform-systemtrayicon-message.png} {System tray icon message popup}
The following example presents how to show a notification message using
\l showMessage(), and how to make use of the \l messageClicked() signal:
\code
SystemTrayIcon {
visible: true
icon.source: "qrc:/images/tray-icon.png"
onMessageClicked: console.log("Message clicked")
Component.onCompleted: showMessage("Message title", "Something important came up. Click this to know more.")
}
\endcode
\section2 Availability
A native system tray icon is currently \l available on the following platforms:
\list
\li All window managers and independent tray implementations for X11 that implement the
\l{http://standards.freedesktop.org/systemtray-spec/systemtray-spec-0.2.html}
{freedesktop.org XEmbed system tray specification}.
\li All desktop environments that implement the
\l{http://www.freedesktop.org/wiki/Specifications/StatusNotifierItem/StatusNotifierItem}
{freedesktop.org D-Bus StatusNotifierItem specification}, including recent versions of KDE and Unity.
\li All supported versions of macOS. Note that the Growl notification system must be installed
for showMessage() to display messages on OS X prior to 10.8 (Mountain Lion).
\endlist
\input includes/widgets.qdocinc 1
\labs
\sa Menu
|
11350 |
- |
| qquicklabsplatformsystemtrayicon_p.h |
|
3312 |
- |
| widgets |
|
|
- |