PDA

View Full Version : How to set a custom widget on to mainwindow in designer



rawfool
24th December 2014, 10:06
This is the first time I'm using a designer, though I've been working on Qt for quite some time now.

Consider the QWidget & QMainWindow created using designer doesn't have header & source files generated. I need to set a custom QWidget created through as central widget to QMainWindow. A header file is getting generated automatically for each of the form. But if I cannot edit it as my changes would be lost.

In my case -
app_view.ui represents QMainWindow and
pstate.ui represents QWidget (This should be set as central widget for the above mentioned QMainWindow)

How do I achieve this? Kindly help me. Thanks.

I'm using Qt 4.8 in Visual Studio 2008.

anda_skoa
24th December 2014, 10:51
Multiple options:

1) in C++ create an instance of the widget and set it as the central widget
2) in Designer add a widget to the central widget and promote it to your widget
3) in Designer promote the central widget to your widget

Cheers,
_