Skip to main content

Why xtd simplifies your code compared to Qt or wxWidgets

Tired of starting your C++ console app with 10 lines of boilerplate? xtd keeps it simple.


When you look at popular C++ frameworks like Qt or wxWidgets, even a simple console program often comes with boilerplate code.

Qt

#include <QApplication>
#include <QTextStream>

QTextStream& qCout() {
static auto ts = QTextStream {stdout};
return ts;
}

auto main(int argc, char* argv[]) -> int {
auto application = QApplication {argc, argv};

qCout() << "Hello, World!" << Qt::endl;
}

wxWidgets

#include <wx/app.h>
#include <wx/crt.h>

class MyApp : public wxApp {
bool OnInit() override {
wxPrintf("Hello, World!\n");
return false;
}
};

wxIMPLEMENT_APP(MyApp);

Even if you just want to print text or manipulate an image, you need to initialize an application object and sometimes start an event loop, because the framework requires it. This works, but it creates invisible complexity and friction for the developer.

xtd : simplicity by design

With xtd, everything works naturally in a standard main() function.

#include <xtd/xtd>

auto main() -> int {
console::write_line("Hello, World!");
}
  • No application object required for console, image processing, events, or delegates.
  • Event loop only where needed – only for visible controls, just like Windows.
  • Delegates and events work instantly without a loop – async via thread_pool or delegate::begin_invoke.
  • Consistent model for console, GUI, image manipulation, fonts, and async.

The hidden benefits

Many developers might think “what’s the harm in instantiating QApplication?” but those little things accumulate:

  • Redundant boilerplate for simple programs.
  • Hidden dependencies for graphics, fonts, or timers.
  • Confusing behavior when mixing console logic with GUI.
  • Platform-specific quirks.

xtd eliminates these frustrations. You can focus on what your program does, not on framework plumbing. It’s not just less code—it’s less cognitive overhead, and more predictable, portable behavior.

Conclusion

xtd is designed for clarity and simplicity — this is not an accident, it’s simplicity by design.
Unlike Qt or wxWidgets, it lets developers write logical, asynchronous, or GUI code without worrying about unnecessary initialization or hidden loops.
Small design decisions like this make a big difference in developer experience and productivity.

See also