Adding a label to a widget

前端 未结 3 2003
醉酒成梦
醉酒成梦 2021-01-21 05:49

I am trying to add a label to the main window using Qt. Here is a piece of the code:

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


        
3条回答
  •  逝去的感伤
    2021-01-21 06:23

    Add the label to a layout widget and set the window layout to that layout.

    Design note: its better to create your own MainWindow class, inheriting from QMainWindow for instance, and design it from the inside.

    or even better, use QtCreator.

提交回复
热议问题