Results 1 to 5 of 5

Thread: When QTcreator generates ui_form.h and ... another way to see the code for a .ui ?

  1. #1
    Join Date
    Sep 2010
    Posts
    654
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    56
    Thanked 1 Time in 1 Post

    Default When QTcreator generates ui_form.h and ... another way to see the code for a .ui ?

    I have a form at designer, with buttons, and so on.
    I'd want to see the code which it would be generated for it.
    By the moment I only see a way:
    From qtcreator add a QT form class.
    Besides I dont know what happens, but the ui_form.h is generated when build.
    Is there another way ? I want to see the code generated to use 'by hand'.
    Thanks

  2. #2
    Join Date
    Sep 2009
    Location
    Wroclaw, Poland
    Posts
    1,394
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android
    Thanked 342 Times in 324 Posts

    Default Re: When QTcreator generates ui_form.h and ... another way to see the code for a .ui

    In console window:
    Qt Code:
    1. uic form.ui
    To copy to clipboard, switch view to plain text mode 
    will print generated code to stdout
    You can for example redirect to file:
    Qt Code:
    1. uic form.ui > file.h
    To copy to clipboard, switch view to plain text mode 

  3. #3
    Join Date
    Nov 2010
    Posts
    20
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    1
    Thanked 4 Times in 4 Posts

    Default Re: When QTcreator generates ui_form.h and ... another way to see the code for a .ui

    You can directly preview the generated code from the designer by Form -> View Code.

    a .ui file is just a XML file describing your Interface. It is then converted into valid C++ code by the uic tool.

  4. #4
    Join Date
    Sep 2010
    Posts
    654
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    56
    Thanked 1 Time in 1 Post

    Default Re: When QTcreator generates ui_form.h and ... another way to see the code for a .ui

    Ok, thank you very much

  5. #5
    Join Date
    May 2010
    Location
    Romania
    Posts
    1,021
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows Android
    Thanks
    62
    Thanked 260 Times in 246 Posts

    Default Re: When QTcreator generates ui_form.h and ... another way to see the code for a .ui

    You can look at that code, but remember that it's not meant to be modified "by hand".

    Also that code it's not meant to be an example on how to add widgets to layouts or else, remember that is a code generated by an computer application meant to be understood by another computer application.

    Basically you do the "by hand" stuff in the class that uses (or inherits) from the ui_UiFileName (or Ui::UiFileName) class.

Similar Threads

  1. Replies: 15
    Last Post: 24th October 2010, 15:29
  2. How to enlarge QtCreator code completion window
    By vaginoid2 in forum Qt Tools
    Replies: 2
    Last Post: 29th January 2010, 23:39
  3. Replies: 2
    Last Post: 8th November 2009, 05:30
  4. QtCreator source code
    By ^NyAw^ in forum Qt Tools
    Replies: 7
    Last Post: 30th April 2009, 13:11
  5. Moc generates uncompilable code
    By Vladimir in forum Qt Programming
    Replies: 6
    Last Post: 22nd January 2007, 15:11

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
  •  
Qt is a trademark of The Qt Company.