Problem resizing a QFrame
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
Code:
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QtGui/QMainWindow>
#include <QVBoxLayout>
#include <QFrame>
{
Q_OBJECT
public:
~MainWindow();
void baseLayerSettings(void);
private:
};
#endif // MAINWINDOW_H
mainwindow.cpp
Code:
#include "mainwindow.h"
MainWindow
::MainWindow(QWidget *parent
){
baseLayerSettings();
}
MainWindow::~MainWindow()
{
}
void MainWindow::baseLayerSettings(void)
{
baseLayer->setGeometry(0, 0, 800, 600);
baseLayer
->setFrameStyle
(QFrame::StyledPanel |
QFrame::Plain);
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))");
}
Please help me with this. Thank you.
Re: Problem resizing a QFrame
Quote:
Originally Posted by
rawfool
. . . added a frame to it. . . .
No, you haven't. Try this:
Code:
baseLayerSettings();
setCentralWidget(baseLayer);
Re: Problem resizing a QFrame
Thank you dude. It worked.