O'Reilly logo

Application Development with Qt Creator by Ray Rischpater

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Instantiating forms, message boxes, and dialogs in your application

The Qt Designer generates an XML-based layout file (which ends in .ui) for each form you create in the designer. At compile time, Qt Creator compiles the layout into a header file that constructs the components for your user interface layout. The pattern typically used by Qt applications is to construct a private layout class that is instantiated by a main window or dialog's constructor, and then the user interface is instantiated. Here's how it works for the main window:

#ifndef MAINWINDOW_H #define MAINWINDOW_H #include <QMainWindow> namespace Ui { class MainWindow; } class ResultDialog; class MainWindow : public QMainWindow { Q_OBJECT public: explicit MainWindow(QWidget *parent ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required