Home > Software design >  How can I create a Qt project without a UI/Designer file?
How can I create a Qt project without a UI/Designer file?

Time:05-16

I'd like my project to be written programmatically instead of using Qt Designer.

EDIT: I'm just asking for a template :P

CodePudding user response:

This requirement has a very simple solution: Just do write your code programatically instead of using QtDesigner. :)

CodePudding user response:

EDIT 2: I found out how, feel free to use the code down below:

#include <QtWidgets/QDialog>
#include <QtWidgets/QApplication>

class MyWindow : public QDialog {
public:
    MyWindow(QWidget* parent = nullptr);
};

MyWindow::MyWindow(QWidget* parent)
    : QDialog(parent)
{
    setWindowTitle("MyWindow");

    // Make widgets, etc...
}

int main(int argc, char** argv)
{
    QApplication app(argc, argv);

    auto win = new MyWindow;
    win->show();

    return app.exec();
}
  •  Tags:  
  • c qt
  • Related