Results 1 to 3 of 3

Thread: Create ui from widget

  1. #1
    Join Date
    Jul 2007
    Location
    BY.Minsk
    Posts
    90
    Thanks
    10
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Create ui from widget

    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]
    Last edited by Fastman; 21st November 2010 at 11:59.

  2. #2
    Join Date
    Jul 2009
    Location
    Enschede, Netherlands
    Posts
    462
    Thanked 69 Times in 67 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Create ui from widget

    You found it. Good .
    Horse sense is the thing that keeps horses from betting on people. --W.C. Fields

    Ask Smart Questions

  3. #3
    Join Date
    Jul 2007
    Location
    BY.Minsk
    Posts
    90
    Thanks
    10
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Create ui from widget

    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:
    Qt Code:
    1. ...
    2. QFormBuilder loader;
    3. QDataStream xmlForm(cOut.toLatin1());
    4. m_pForm = loader.load(xmlForm.device());
    5. ...
    6. m_addForm->setParent(ui.centralWidget());
    7. ...
    To copy to clipboard, switch view to plain text mode 
    ok. Works well. and i am realy saw my form
    3. Save:
    Qt Code:
    1. ...
    2. QFile file("D:/save.ui");
    3. if (!file.open(QIODevice::WriteOnly | QIODevice::Text))
    4. return;
    5.  
    6. saver.save(&file, m_addForm);
    7. ...
    To copy to clipboard, switch view to plain text mode 
    But when I load a saved form, I do not see any items!
    Saved form:
    saved_form.png
    Source form:
    loaded_form.png

Similar Threads

  1. How to Create child widget behind parent widget?
    By anupamgee in forum Qt Programming
    Replies: 6
    Last Post: 22nd June 2010, 13:03
  2. Create new signal for derived widget
    By GadiK in forum Qt Programming
    Replies: 3
    Last Post: 29th December 2009, 11:27
  3. How to create my own widget
    By jayreddy in forum Qt Programming
    Replies: 4
    Last Post: 30th October 2009, 11:45
  4. how to create something like widget box in qt designer
    By gregsan in forum Qt Programming
    Replies: 3
    Last Post: 18th July 2008, 15:21
  5. QFormbuilder - How to create widget
    By manivannan_1984 in forum Qt Programming
    Replies: 1
    Last Post: 8th September 2006, 18:47

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.