I was looking at this article How to make a Qt Widget grow with the window size? but when i got to the answer I got stuck on "activating" the central widget. I notice an icon with a red circle so I guess that means its disabled. I've been searching the net to try to figure out how to "activate" it but I am not having any luck.
Can someone please help me out?
The centralwidget refers to a relative position but it is not exactly a central position: #include <QtWidgets> int main(int argc, char *argv[]) { QApplication a(argc, argv); QMainWindow w; QLabel *central_widget = new QLabel("Central Widget"); central_widget->setAlignment(Qt::AlignCenter); w.
To add widgets in Qt Designer: In the Qt Creator Edit mode, double-click the notepad. ui file in the Projects view to launch the file in the integrated Qt Designer. Drag and drop widgets Text Edit (QTextEdit) to the form.
Add at least one widget on your MainWindow . Then select your window by clicking on it and click on the VerticalLayout Button at the top of QTCreator . You Vertical Layout is automatically added to the central widget and fills all the surface.
Have a look at the layout system. That icon does not mean your QWidget is disabled, that just mean you do not apply a layout on it. Try to press like Ctrl+1 in order to apply a basic layout. If nothing has changed, you might need to put a QWidget inside the central widget first and then apply the layout.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With