PDA

View Full Version : Grid Layout problem



succorguy
26th April 2009, 10:32
Hi,

I am writing a simple calendar app and am facing a few problems in creating my layout. This is the basic layout I created :



QWidget *centralWidget = new QWidget;
QPushButton* next = new QPushButton;
QPushButton* previous = new QPushButton;

calendar->setStyleSheet("border-radius:20px;background-color:#ffffff");

QGridLayout *layout = new QGridLayout;

layout->addWidget(calendar,0,0);
layout->addWidget(next,1,0);
layout->addWidget(previous,1,1);

centralWidget->setLayout(layout);
setCentralWidget(centralWidget);



I have uploaded the image . The calendar widget is actually a QTableWidget . how do I get it centered and of a fixed size ?

drhex
27th April 2009, 00:01
QGridLayout::addWidget() takes an optional alignment parameter.