PDA

View Full Version : Create ui from widget



Fastman
21st November 2010, 10:16
Whether it is possible to receive from QWidget a file ui (in XML format)?

For example I have a form template in ui a file.
1. I using QFormBuilder I load ui and I display it in my form.
2. The user fills the form
3. I need to be sent on the server the filled form.

I can QWidget translate in a format ui?
Or it is possible send QWidget in a binary format ???

Added after 24 minutes:

Sorry :) I'm crazy :)
did not see a method:
void QAbstractFormBuilder:: save (QIODevice * device, QWidget * widget) [virtual]

franz
22nd November 2010, 12:47
You found it. Good :).

Fastman
29th November 2010, 19:53
I found a strange bug. Maybe I'm doing something wrong.

1. In Designer create ui file. Read file to QString, send to client app.
2. Get in client and load:


...
QFormBuilder loader;
QDataStream xmlForm(cOut.toLatin1());
m_pForm = loader.load(xmlForm.device());
...
m_addForm->setParent(ui.centralWidget());
...

ok. Works well. and i am realy saw my form
3. Save:


...
QFile file("D:/save.ui");
if (!file.open(QIODevice::WriteOnly | QIODevice::Text))
return;

QFormBuilder saver;
saver.save(&file, m_addForm);
...

But when I load a saved form, I do not see any items!
Saved form:
5543
Source form:
5544