papillon
9th August 2012, 01:02
Hi, I'm getting mad trying to solve this issue.
I'm developing an application and the interface is organized like this:
mainWindow(QWidget) -> vLayout(QVBoxLayout) -> myTabWidget(QTabWidget) -> myTab1(QWidget) -> myGridLayout(QGridLayout) -> redFrame,blueFrame,greenFrame,yellowFrame(QFrame)
This is the code:
mainWindow = new myMainWindow(); // instancing QWidget in a separate class
QVBoxLayout *vLayout=new QVBoxLayout(mainWindow);
myTabWidget = new QTabWidget();
vLayout->addWidget(myTabWidget);
myTab1 = new QWidget();
myTabWidget->addTab(myTab1, QString());
blueFrame = new QFrame(myTab1); // blueFrame
yellowFrame=new QFrame(myTab1); // yellowFrame
QFrame *redFrame=new QFrame(myTab1); // redFrame
greenFrame=new QFrame(myTab1); // greenFrame
QGridLayout *myGridLayout= new QGridLayout();
myGridLayout->addWidget(redFrame,0,0);
myGridLayout->addWidget(blueFrame,0,1);
myGridLayout->addWidget(yellowFrame,1,0);
myGridLayout->addWidget(greenFrame,1,1);
myTab1->setLayout( myGridLayout );
The application starts ok and all controls are displayed correctly (see first image).
The issue I'm having is that when I resize the window, everything goes "berserk" (see second image) and the application eventually crashes. I think I'm doing an improper use of the layouts. Could somebody be so kind to help? Thanks again.
81108109
I'm developing an application and the interface is organized like this:
mainWindow(QWidget) -> vLayout(QVBoxLayout) -> myTabWidget(QTabWidget) -> myTab1(QWidget) -> myGridLayout(QGridLayout) -> redFrame,blueFrame,greenFrame,yellowFrame(QFrame)
This is the code:
mainWindow = new myMainWindow(); // instancing QWidget in a separate class
QVBoxLayout *vLayout=new QVBoxLayout(mainWindow);
myTabWidget = new QTabWidget();
vLayout->addWidget(myTabWidget);
myTab1 = new QWidget();
myTabWidget->addTab(myTab1, QString());
blueFrame = new QFrame(myTab1); // blueFrame
yellowFrame=new QFrame(myTab1); // yellowFrame
QFrame *redFrame=new QFrame(myTab1); // redFrame
greenFrame=new QFrame(myTab1); // greenFrame
QGridLayout *myGridLayout= new QGridLayout();
myGridLayout->addWidget(redFrame,0,0);
myGridLayout->addWidget(blueFrame,0,1);
myGridLayout->addWidget(yellowFrame,1,0);
myGridLayout->addWidget(greenFrame,1,1);
myTab1->setLayout( myGridLayout );
The application starts ok and all controls are displayed correctly (see first image).
The issue I'm having is that when I resize the window, everything goes "berserk" (see second image) and the application eventually crashes. I think I'm doing an improper use of the layouts. Could somebody be so kind to help? Thanks again.
81108109