AIToday
AI Coding AssistantsZenn AI/MLPublished: Oct 20, 2026, 13:00 JST

Qt 6 + CMake adds icons without Qt Creator, Antigravity shows

Qt 6 + CMake adds icons without Qt Creator, Antigravity shows

3 Key Points

  1. What happened

    In the latest Zenn series installment, the author added SVG toolbar icons to a Qt/QML image viewer by listing paths under RESOURCES in qt_add_qml_module. The AI agent Antigravity advised that Qt 6 and CMake handle .qrc generation and compilation automatically.

  2. Why it matters

    This means developers can manage image resources entirely through text edits in the build file, with no manual GUI steps, according to the post.

Not sure about something? Ask the AI

Questions and answers are published on this page.

Summaries like this, in your inbox every morning.

Context & Analysis

This is the fifth entry in a series documenting the building of a Qt/QML image viewer with AI assistance. Earlier installments covered environment setup, UI creation with drag-and-drop, C++ backend integration, and debugging with AI. This installment shifts to a practical concern: adding toolbar icons. Traditionally, Qt developers used Qt Creator to create a .qrc resource file and register images through a GUI, a process that required opening the IDE whenever assets changed. The AI agent Antigravity pointed out that with Qt 6 and CMake, the qt_add_qml_module command can take a RESOURCES list directly, letting CMake generate and compile the .qrc file behind the scenes. The author applied this by creating an icons folder with SVG files and listing them in CMakeLists.txt, then referenced them in QML with a qrc path or relative path. The build succeeded, showing a toolbar with SVG icons, and the author notes that the entire change was done in a text editor without any GUI tool. The post frames this as an example of AI suggesting current best practices that save time compared to reading outdated documentation.

FAQ
Do I need Qt Creator to add resource images with this method?
No. The author says you only need to create an icons folder, place SVG files there, and list their paths in CMakeLists.txt. CMake handles the rest.
How do I reference these resources from QML?
You can use a path like 'qrc:/ImageAnnotator/icons/save.svg', or a relative path like 'icons/save.svg' if within the same module.
What did the AI agent Antigravity recommend?
Antigravity recommended using Qt 6 and CMake's qt_add_qml_module with a RESOURCES section, which automatically generates and compiles the .qrc file.

AI news that matters for your work, delivered every morning.

Pick your industry and the AI tools you use, and get news related to your work every day.

Free · 30 seconds with Google · unsubscribe anytimeWhat is AIToday? →

Ask AI

Ask AI anything about this article. The AI reads this article, earlier AIToday articles, and Wikipedia, and cites its sources. Q&As are published on this page for other readers too.

Questions and answers are published on this page.

Related Articles

Next articleMamdani: AI not inevitable, feds abdicated on rules