I've created a window and added a frame to it. The frame would contain some widgets such as LineEdit, ListBox, etc. I would change one frame with another one according to a menu selection. Now my issue is, when I maximize the main window, the frame is not getting expanded according to the new size. I tried to look at a few functions like sizePolicy, etc, but didn't understand though. I've provided the code below.

mainwindow.h
Qt Code:
  1. #ifndef MAINWINDOW_H
  2. #define MAINWINDOW_H
  3.  
  4. #include <QtGui/QMainWindow>
  5. #include <QVBoxLayout>
  6. #include <QFrame>
  7.  
  8. class MainWindow : public QMainWindow
  9. {
  10. Q_OBJECT
  11.  
  12. public:
  13. MainWindow(QWidget *parent = 0);
  14. ~MainWindow();
  15. void baseLayerSettings(void);
  16.  
  17. private:
  18. QFrame *baseLayer;
  19.  
  20. };
  21.  
  22. #endif // MAINWINDOW_H
To copy to clipboard, switch view to plain text mode 

mainwindow.cpp
Qt Code:
  1. #include "mainwindow.h"
  2.  
  3. MainWindow::MainWindow(QWidget *parent)
  4. : QMainWindow(parent)
  5. {
  6. baseLayerSettings();
  7. }
  8.  
  9. MainWindow::~MainWindow()
  10. {
  11.  
  12. }
  13. void MainWindow::baseLayerSettings(void)
  14. {
  15. baseLayer = new QFrame(this);
  16. baseLayer->setGeometry(0, 0, 800, 600);
  17. baseLayer->setFrameStyle(QFrame::StyledPanel | QFrame::Plain);
  18. baseLayer->setStyleSheet("background-color: qlineargradient(spread:pad, x1:0.504, y1:1, x2:0.497273, y2:0, stop:0 rgba(51, 142, 220, 255), stop:1 rgba(255, 255, 255, 255))");
  19.  
  20. }
To copy to clipboard, switch view to plain text mode 

Please help me with this. Thank you.