-
Bug
-
Resolution: Done
-
P4: Low
-
4.6.2
-
None
-
Suse Linux 9.1; Qt 4.6.2; linked statically using cmake
-
0402309e1e3fc30e9d7f643e135aa9af26cca99b
When the QFormBuilder class processes a QGridLayout, it does not save the cell positions (row, col, rowspan, colspan) of individual QLayoutItems living in the grid.
Thus when rebuilding the widget from the .ui file (or viewing it in the designer tool) it's shaped completely different.
Examplecode: (see attachment)
#include <QtGui/QLabel>
#include <QtGui/QGridLayout>
#include <QtGui/QApplication>
#include <QtDesigner/QFormBuilder>
void
setupWidget()
{
QWidget* pWidget=new QWidget();
QGridLayout* pLayout=new QGridLayout(pWidget);
pWidget->setLayout(pLayout);
//add elements to the layout
pLayout->addWidget(new QLabel("1/1"),0,0,1,1);
pLayout->addWidget(new QLabel("1/2"),0,1,1,1);
pLayout->addWidget(new QLabel("1/3"),0,2,1,1);
pLayout->addWidget(new QLabel("2/1"),1,0,1,1);
pLayout->addWidget(new QLabel("2/2+3"),1,1,1,2);
//show the widget
pWidget->show();
//open file for writing
QFile fOutput("/tmp/out.ui");
fOutput.open(QIODevice::WriteOnly);
Q_ASSERT(fOutput.isOpen());
//save .ui file
QFormBuilder builder;
builder.save(&fOutput,pWidget);
//close file
fOutput.close();
}
int
main(int argc,char** argv)
{
//setup application
QApplication app(argc,argv);
//setup and save widget
setupWidget();
return app.exec();
}