Complete code

As you write code, Qt Creator suggests properties, IDs, and code snippets to complete the code. It shows a list of suggestions to the statement currently under your cursor.

Select Tab or Enter to accept the selected suggestion and complete the code.

Suggestions for completing C++ code

Suggestions for completing C++ code.

Suggestions for completing QML code

Suggestions for completing QML code.

To open the list of suggestions at any time, select Ctrl+Space. If only one option is available, Qt Creator inserts it automatically.

Summary of Available Types

The following table lists available types for code completion and icon used for each.

IconDescription
Class iconA class
Enum iconAn enum
Enum value iconAn enumerator (value of an enum)
Function iconA function
Private function iconA private function
Protected function iconA protected function
Variable iconA variable
Private variable iconA private variable
Protected variable iconA protected variable
Signal iconA signal
Slot iconA slot
Private slot iconA private slot
Protected slot iconA protected slot
C++ keyword iconA C++ keyword
C++ code snippet iconA C++ code snippet
QML type iconA QML type
QML code snippet iconA QML code snippet
Macro iconA macro
Namespace iconA namespace

Complete code snippets

Code snippets can consist of multiple variables that you specify values for. Select an item in the list and select Tab or Enter to complete the code. Select Tab to move between the variables and specify values for them. When you specify a value for a variable, all instances of the variable within the snippet are renamed.

C++ code snippet

C++ code snippet.

QML code snippet

QML code snippet.

See also Complete CMake code, Nim, Add code snippets to the auto-complete menu, Completion, and Snippets.

Copyright © The Qt Company Ltd. and other contributors. 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.