Application QML Type (Singleton)
多くの QML コンポーネントで共有されるグローバルなアプリケーション状態のプロパティへのアクセスを提供します。詳細...
| Import Statement: | import QtQuick |
注:この型はQMLのシングルトンです。QMLエンジン内には、この型のインスタンスが1つしか存在しません。
プロパティ
- arguments : list<string>
- displayName : string
- domain : string
- font : font
- layoutDirection : enumeration
- name : string
- organization : string
- screens : list<Screen>
- state : enumeration
- styleHints : StyleHints
- supportsMultipleWindows : bool
- version : string
信号
詳細な説明
Applicationシングルトンは、QApplication のプロパティの一部をQMLアプリケーションに対して公開します。
また、aboutToQuit() シグナルも提供しており、これはQCoreApplication::aboutToQuit() と同じ動作をします。
import QtQuick
Window {
id: root
visible: true
width: 800
height: 680
title: `${Application.name} (${Application.version})`
Connections {
target: Application
function onAboutToQuit() {
console.log("Bye!")
}
}
}「SystemPalette」も参照してください 。
プロパティのドキュメント
arguments : list<string>
これは、実行ファイルが呼び出された際の引数の文字列リストです。
displayName : string
このプロパティは、QGuiApplication インスタンスに設定されたアプリケーションの表示名を表します。アプリケーションの表示名を設定するには、このプロパティに値を書き込むことができます。
Binding {
target: Application
property: "displayName"
value: "My Awesome Application"
}domain : string
これは、QCoreApplication インスタンスに設定されている組織ドメインです。このプロパティに値を書き込むことで、組織ドメインを設定することができます。
font : font [read-only]
QGuiApplication::font() が返すデフォルトのアプリケーションフォントを返します。
layoutDirection : enumeration [read-only]
この読み取り専用プロパティを使用すると、アプリケーションのデフォルトのレイアウト方向を取得できます。システムの起動時、デフォルトのレイアウト方向はアプリケーションの言語によって決まります。テキストやグラフィック要素が右から左に読み込まれるロケールでは、このプロパティの値は `Qt.RightToLeft ` となり、左から右に読み込まれるロケールでは `Qt.LeftToRight ` となります。 このプロパティにバインドすることで、両方のレイアウト方向に対応するようにアプリケーションのレイアウトをカスタマイズできます。
取り得る値については、C++ の `Qt::LayoutDirection ` 列挙型を参照してください。
RowLayout {
layoutDirection: Application.layoutDirection
}name : string
これは、QCoreApplication インスタンスに設定されているアプリケーション名です。このプロパティに値を書き込むことで、アプリケーション名を設定できます。
organization : string
これは、QCoreApplication インスタンスに設定されている組織名です。このプロパティに値を書き込むことで、組織名を設定することができます。
screens : list<Screen> [read-only]
接続されているすべての画面の説明を含む配列。 この配列の要素は、Screen に添付されたオブジェクトと同じプロパティを持つオブジェクトです。実際には、この配列はQGuiApplication::screens()によって返される画面リストに対応しています。name、width、heightなどのプロパティを調べるだけでなく、配列の要素をWindow項目のscreenプロパティに割り当てることもできるため、C++側のQWindow::setScreen()の代替として機能します。
Screen 、Window 、およびWindow.screenも参照してください 。
state : enumeration [read-only]
このプロパティは、アプリケーションの現在の状態を表します。
取り得る値については、C++のQt::ApplicationState 列挙型を参照してください。
Timer {
interval: 1000; repeat: true
active: Application.state === Qt.ApplicationActive
onTriggered: imageFetcher.fetchLatestImages()
}styleHints : StyleHints [read-only]
styleHints プロパティは、プラットフォーム固有のスタイルのヒントや設定を提供します。詳細については、QStyleHints のドキュメントを参照してください。
次の例では、styleHints を使用して、マウスクリックまたはタッチの離し時にアイテムにフォーカスを当てるかどうかを判断しています:
import QtQuick
MouseArea {
id: button
onPressed: {
if (!Application.styleHints.setFocusOnTouchRelease)
button.forceActiveFocus()
}
onReleased: {
if (Application.styleHints.setFocusOnTouchRelease)
button.forceActiveFocus()
}
}supportsMultipleWindows : bool [read-only]
プラットフォームがマルチウィンドウに対応している場合、true を返します。たとえば、一部の組み込みプラットフォームではマルチウィンドウに対応していない場合があります。
version : string
これは、QCoreApplication インスタンスに設定されているアプリケーションのバージョンです。このプロパティに値を書き込むことで、アプリケーションのバージョンを設定できます。
Signal ドキュメント
aboutToQuit()
このシグナルは、アプリケーションがメインイベントループを終了しようとしているときに発せられます。このシグナルは、アプリケーションが終了直前にクリーンアップ処理を行う必要がある場合に特に役立ちます。この状態では、ユーザーによる操作は行えません。詳細については、Window.closing を参照してください。
注: 対応するハンドラは onAboutToQuit です。
「QCoreApplication::aboutToQuit」も参照してください 。
© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.