# QML 構文のサポート

> For the complete documentation index, see [llms.txt](https://www.jetbrains.com/ja-jp/help/clion/llms.txt).

CLion provides syntax support in  `.qml`  files for both Qt5 and Qt6. 以下に、QML コードインサイト機能の例をいくつか示します。

* Highlighting and code completion for QML types and properties: ![QML の完成](https://resources.jetbrains.com/help/img/idea/2026.3/cl_qml_completion.png)

* QML シンボルの [使用箇所の検索](find-highlight-usages.html)は、 `Alt+F7` (Windows), `⌥ F7` (macOS), `⌥ F7` (IntelliJ IDEA Classic (macOS)), `⌃ U` (macOS System Shortcuts), `Alt+F7` (XWin), `Alt+Shift+7` (GNOME), `Alt+Shift+7` (KDE), `Alt+F7` (Emacs), `Alt+F7` (Sublime Text), `⌥ F7` (Sublime Text (macOS)), `⌥ F7` (Xcode), `Shift+F12` (Visual Studio), `⇧ F12` (Visual Studio (macOS)), `Alt+F7` (ReSharper), `⌥ F7` (ReSharper (macOS)), `Ctrl+Shift+U` (QtCreator), `⌘ ⇧ U` (QtCreator (macOS)), `Alt+F7` (NetBeans), `Ctrl+G` (Eclipse), `⌘ ⇧ G` (Eclipse (macOS)) を押すか、エディターでヒントをクリックして呼び出すことができます。 ![QML シンボルの使い方のヒント](https://resources.jetbrains.com/help/img/idea/2026.3/cl_qml_usage_editor.png) 使用箇所ポップアップでは、それらの間を移動して検索を調整できます ( ![](https://resources.jetbrains.com/help/img/idea/2026.3/app.expui.general.settings.svg)): ![QML シンボル使用ポップアップ](https://resources.jetbrains.com/help/img/idea/2026.3/cl_qml_usage_popup.png)

* もう 1 つのナビゲーションオプションは、ファイルコンテンツの [構造ビュー](file-structure.html)です。 To open it, press `Alt+7` (Windows), `⌘ 7` (macOS), `⌘ 7` (IntelliJ IDEA Classic (macOS)), `⌘ 7` (macOS System Shortcuts), `Alt+7` (XWin), `Alt+7` (GNOME), `Alt+7` (KDE), `Alt+7` (Emacs), `Alt+7` (Sublime Text), `⌘ 7` (Sublime Text (macOS)), `⌘ 3` (Xcode), `Ctrl+Alt+F` (Visual Studio), `⌃ ⌥ F` (Visual Studio (macOS)), `Ctrl+F11` (ReSharper), `⌃ F11` (ReSharper (macOS)), `Alt+7` (QtCreator), `⌘ 7` (QtCreator (macOS)), `Ctrl+7` (NetBeans), `Alt+7` (Eclipse), `⌘ 7` (Eclipse (macOS)) or select `表示 | ツールウィンドウ | 構造` from the main menu: ![QML ファイル構造](https://resources.jetbrains.com/help/img/idea/2026.3/cl_qml_structure_view.png)

* [Quick Documentation](viewing-inline-documentation.html) popup is also available for QML symbols. Invoke it by hovering over a symbol or by pressing `Ctrl+Q` (Windows), `F1` (macOS), `⌃ J` (IntelliJ IDEA Classic (macOS)), `⌘ I` (macOS System Shortcuts), `Ctrl+Q` (XWin), `Ctrl+Q` (GNOME), `Ctrl+Q` (KDE), `Ctrl+Q` (Emacs), `Ctrl+Q` (Sublime Text), `Ctrl+Q` (Sublime Text (macOS)), `⌘ ⌃ ⇧ /` (Xcode), `Ctrl+K, I` (Visual Studio), `⌘ K, I` (Visual Studio (macOS)), `Ctrl+Q` (ReSharper), `⌃ Q` (ReSharper (macOS)), `Ctrl+Q` (QtCreator), `Ctrl+Q` (QtCreator (macOS)), `Ctrl+Q` (NetBeans), `Alt+Middle-Click` (Eclipse), `⌥ Middle-Click` (Eclipse (macOS)): ![QML シンボルのクイックドキュメント](https://resources.jetbrains.com/help/img/idea/2026.3/cl_qml_quickdoc.png)

Procedure: QML 言語サーバーを有効化する。

1. `設定 | 言語 & フレームワーク | QML`  に移動し、   QML 言語サーバーを有効化する。   チェックボックスを設定します。

![QML 言語サーバーの有効化](https://resources.jetbrains.com/help/img/idea/2026.3/cl_qml_settings_server.png)

このオプションは、  `qmlls`  コンポーネントがインストールされている場合、QML 固有のコードインスペクションを有効にします。

2. Enable   QML 言語サーバーからの補完を使用する   to get language-server-based completion suggestions for QML symbols instead of those provided by CLion.

Procedure: 追加の QML インポートパスを追加する

1. `設定 | 言語 & フレームワーク | QML`  に進みます。

2. 追加の QML インポート   フィールドに、追加の QML モジュールを含むディレクトリへのパスを指定します。

> **Note:**
> モジュール自体へのパスではなく、必ず相対パスを設定してください。
>
>
>
> 例: ここで  `./bin/`  を指定すると、  `import MYLIB`  のようなインポートステートメントは  `./bin/MYLIB`  ディレクトリを検索します。

Procedure: QML コードスタイル

IDE 設定または [qmlformat (英語)](https://doc-snapshots.qt.io/qt6-dev/qtquick-tools-and-utilities.html#qmlformat) を使用して、QML のコードスタイルを構成できます。

* By default, qmlformat is disabled and CLion uses the built-in code style settings. これらにアクセスするには、  `設定 | エディター | コードスタイル | QML`  に移動します。

![QML のコードスタイル設定](https://resources.jetbrains.com/help/img/idea/2026.3/cl_qml_codestyle.png)

設定にすばやくアクセスするには、下部のステータスバースイッチャーで   qml QML のインデントを構成する   を選択します。

![QML コードスタイルオプションを構成する](https://resources.jetbrains.com/help/img/idea/2026.3/cl_qml_codestyle_quickopen.png)

* qmlformat を有効にするには、ステータスバースイッチャー (上記を参照) を使用するか、  `設定 | 言語 & フレームワーク | QML`  に移動して   「qmlformat」をフォーマッタとして有効にする   チェックボックスを設定します。

> **Note:**
> Qmlformat は IDE コードスタイル設定をオーバーライドします。

![qmlformat の有効化](https://resources.jetbrains.com/help/img/idea/2026.3/cl_qml_enable_qmlformat.png)

qmlformat が有効になっている場合、そのインジケータが下部のステータスバーに表示されます。 そこから qmlformat を無効にすることもできます:

![ステータスバーの Qmlformat インジケーター](https://resources.jetbrains.com/help/img/idea/2026.3/cl_qml_formatter_bottombar.png)

Procedure: トラブルシューティング: QML 構文サポートを手動で有効にする

Follow the steps below if you get the editor notification indicating that CLion could not find the Qt installation path or QML imports directory:

![QML インポートディレクトリが見つからないという警告](https://resources.jetbrains.com/help/img/idea/2026.3/cl_qml_editorwarning.png)

1. `CMAKE_PREFIX_PATH`  が Qt インストールディレクトリを指していることを確認します。

CMake 設定   をクリックし、次を   CMake のオプション   に追加します。

```CMAKE
-DCMAKE_PREFIX_PATH=your_qt_installation

```

例：

![CMake オプションの Qt インストールパス](https://resources.jetbrains.com/help/img/idea/2026.3/cl_qt_cmake_path.png)

2. In most cases, configuring CMake is enough for CLion to detect Qt and QML paths, however, if the notification is still there, you might need to set the paths manually. これを行うには、   QML 設定   をクリックするか、  `設定 | 言語 & フレームワーク | QML`  に移動します。

## 既知の問題と制限

QML support is CLion is currently a work in progress. 既知の問題のリストは次のとおりです。

* 多くの標準関数とメソッドは、未解決 ( [CPP-31883(英語)](https://youtrack.jetbrains.com/issue/CPP-31883)) としてハイライトされています。

* QML ファイルの構造ビューが改善されています ( [CPP-31886(英語)](https://youtrack.jetbrains.com/issue/CPP-31886))。

* QML の配色とコードスタイルの設定は開発中です ( [CPP-30547(英語)](https://youtrack.jetbrains.com/issue/CPP-30547))。

## See also

### ハウツー

[Qt プロジェクト](qt-tutorial.html) [CMake プロファイル](cmake-profile.html)

