t4mer@notebook

// learning · #06 · qt · c++ · 11 august 2026 · 1 min

main.cpp is not index.php

A Web Developer Learns C++ · #06

A Web Developer Learns C++

In Laravel, the story has a door: public/index.php. I can always start there.

In the Qt project I opened, I searched for main.cpp as if it were public/index.php. Sometimes it is there, next to a CMakeLists.txt that looks like a dare. Sometimes the project is QML-first and main is a small C++ file that exists to start the engine, and the “application” you care about is a tree of .qml files.

I was looking for a front controller. I found a runtime.

What I understand so far

  • Widgets projects often look more like “C++ with a UI”. main.cpp creates a widget or a QApplication and you can follow calls.
  • QML projects still have C++, but the screen you are staring at may not be editable in Qt Designer the way a .ui file is. I lost time on that. See discovering the UI was QML.
  • CMakeLists.txt is not Composer. It is the map of what gets compiled. TIL.

The useful reframe

main.cpp is not index.php. It does not run again on every click. It starts a process that lives until the user quits. Once I stopped hunting for a per-request entrypoint, the file - when it exists - looked obvious: construct the application, load QML or show a window, exec() the event loop.

If you are hunting for a front controller, you brought the web map. The file - when it exists - starts a process. Clicks do not start another one.