Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How can i get c++ code from .ui file
Forum Updated to NodeBB v4.3 + New Features

How can i get c++ code from .ui file

Scheduled Pinned Locked Moved General and Desktop
5 Posts 4 Posters 6.2k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    Himanshupradhan
    wrote on last edited by
    #1

    hi, i have install Qt SDK version 1.1.4 , i am creating a empty qt project, then i am adding .ui file, now i then i run qmake, now i want to see c++ file created from that .ui file.

    1 Reply Last reply
    0
    • P Offline
      P Offline
      p-himik
      wrote on last edited by
      #2

      qmake (if .ui file is included in your .pro file) runs uic which creates ui_*.h file. Look for it in your project's build directory.

      1 Reply Last reply
      0
      • H Offline
        H Offline
        Himanshupradhan
        wrote on last edited by
        #3

        i look in build directory and i got ui_*.h file , but i am not able to see *.cpp file

        1 Reply Last reply
        0
        • sierdzioS Offline
          sierdzioS Offline
          sierdzio
          Moderators
          wrote on last edited by
          #4

          There is simply no *.cpp file for compiled UI files. The header has enough information to create the GUI.

          All logic can be programmed in a separate class that uses the UI. See basically any Qt example, or even a generic stub generated by Qt Creator.

          (Z(:^

          1 Reply Last reply
          0
          • S Offline
            S Offline
            Seba84
            wrote on last edited by
            #5

            Hi Himan,

            I confirm what sierdzio said, all the information is on the ui_*.h file. The .cpp code you are looking for is inside the setupUi function. The ui class is divided in three parts:

            pointers to QObjects, QWidgets, etc definition

            setupUi Function

            retranslateUi Function

            You can say that the setupUi is your ui class constructor. It is the one that constructs the ui, check it out.

            Regards,
            Sebastian

            Edit: fixed up list layout; Andre

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved