Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. Is there a way to visually edit a cpp file with Design
Forum Updated to NodeBB v4.3 + New Features

Is there a way to visually edit a cpp file with Design

Scheduled Pinned Locked Moved Solved Qt Creator and other tools
9 Posts 4 Posters 184 Views 2 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.
  • A Online
    A Online
    AntGP
    wrote last edited by aha_1980
    #1

    The interface of the application i work whit is entierly made of cpp , across some class, and adding a single box is absolytely tidious.

    Is it possible to edit it like whit some sort of interface whit Design on .ui files, or am i condamned to do everything by hands ?

    Christian EhrlicherC 1 Reply Last reply
    0
    • A AntGP

      The interface of the application i work whit is entierly made of cpp , across some class, and adding a single box is absolytely tidious.

      Is it possible to edit it like whit some sort of interface whit Design on .ui files, or am i condamned to do everything by hands ?

      Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote last edited by
      #2

      @AntGP said in Is there a way to visually edit a cpp file whit Design:

      Is it possible to edit it like whit some sort of interface whit Design on .ui files,

      No, the designer can only handle ui files since it does not know anything about c++

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      1 Reply Last reply
      2
      • A Online
        A Online
        AntGP
        wrote last edited by
        #3

        Ok, sad, thank you

        JonBJ 1 Reply Last reply
        0
        • A AntGP has marked this topic as solved
        • A AntGP

          Ok, sad, thank you

          JonBJ Offline
          JonBJ Offline
          JonB
          wrote last edited by
          #4

          @AntGP
          Still not sure what exactly your issue is. For, say, adding "a single box" or some other UI element to an existing project you have a choice of using Designer to produce code or writing the code directly yourself to create UI elements. As for interfacing with C++, if you use Designer from Creator you have that integration.

          1 Reply Last reply
          0
          • A Online
            A Online
            AntGP
            wrote last edited by AntGP
            #5

            No it was not interfacing whit C++, but making it on C++.
            On my project everything is made of C++. So i wanted to know if there was a way to have a visual editor for it, or some way to make some part on a visual editor that i would then be able to add in. I also wanted to see if there was a visual editor to not have to compile the code everytime i change something to see if it fit on the interface while messing around whit the differents functions.

            I'v looked lot of doc and exemple on how to import a .ui file in cpp, but i just wanted to know if it was possible to convert a ui file to cpp that i would have missed.

            JonBJ 1 Reply Last reply
            0
            • A Online
              A Online
              AntGP
              wrote last edited by
              #6

              I'v seen the IUC compiler, but it only make header as far as i understand https://doc.qt.io/archives/qt-5.15/uic.html

              SGaistS 1 Reply Last reply
              0
              • A AntGP

                No it was not interfacing whit C++, but making it on C++.
                On my project everything is made of C++. So i wanted to know if there was a way to have a visual editor for it, or some way to make some part on a visual editor that i would then be able to add in. I also wanted to see if there was a visual editor to not have to compile the code everytime i change something to see if it fit on the interface while messing around whit the differents functions.

                I'v looked lot of doc and exemple on how to import a .ui file in cpp, but i just wanted to know if it was possible to convert a ui file to cpp that i would have missed.

                JonBJ Offline
                JonBJ Offline
                JonB
                wrote last edited by JonB
                #7

                @AntGP
                Still don't understand what you are actually saying.

                You have a "visual editor" for .ui files: it's Designer, and if you run that from within Creator you also have (some) integration with C++ code. If you change the design/.ui file you have to recompile if you want to build and run the new code. However, if you just want to see what it looks like with your changes but without recompiling there is a key press inside Designer to preview what it will look like: https://doc.qt.io/qtcreator/creator-keyboard-shortcuts.html#qt-widgets-designer-shortcuts

                Preview Alt+Shift+R [Windows, Linux] Opt+Shift+R [MacOS] [Or it must be on a menu somewhere]

                There are two things you can do with a .ui file:

                • Read it in at run time without doing anything at design/compiler time. But you probably don't want to do this as it involves you doing quite a bit of coding to make it "useful".

                • Allow Creator's build system to run uic on it, which produces a .h file and a class for code to use.

                I'v looked lot of doc and exemple on how to import a .ui file in cpp, but i just wanted to know if it was possible to convert a ui file to cpp that i would have missed.

                I'v seen the IUC compiler, but it only make header as far as i understand https://doc.qt.io/archives/qt-5.15/uic.html

                That's what uic already does. It just happens to be a .h rather than a .cpp file --- so what, what's the problem? Your desire for a .cpp over .h simply makes no sense, it doesn't matter which one it produces.

                1 Reply Last reply
                0
                • A AntGP

                  I'v seen the IUC compiler, but it only make header as far as i understand https://doc.qt.io/archives/qt-5.15/uic.html

                  SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote last edited by
                  #8

                  @AntGP hi,

                  To add to @JonB, the header generated by uic is not to be edited. Check the designer examples. You have a pair of header/implementation files that will use that generated header and that's where you'll be adding the business logic.

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  A 1 Reply Last reply
                  1
                  • SGaistS SGaist

                    @AntGP hi,

                    To add to @JonB, the header generated by uic is not to be edited. Check the designer examples. You have a pair of header/implementation files that will use that generated header and that's where you'll be adding the business logic.

                    A Online
                    A Online
                    AntGP
                    wrote last edited by AntGP
                    #9

                    @SGaist said in Is there a way to visually edit a cpp file with Design:

                    To add to @JonB, the header generated by uic is not to be edited. Check the designer examples. You have a pair of header/implementation files that will use that generated header and that's where you'll be adding the business logic

                    Yes i know, and i did not wanted to edit the .h generated from the .ui after i saw it was just a .h for interfacing

                    @JonB said in Is there a way to visually edit a cpp file with Design:

                    Still don't understand what you are actually saying.

                    It's just that i'm working on a project that is 13 year old, and all the interface is made whit C++, no ui file at all, only pure cpp and some java scripts.
                    Adding some elements in midle of the existing code of the interface is not possible whit .ui files

                    I wanted to know if there was a way to have any kind of interface editor for all the layout and widgets made in C++.
                    And after reasearch and the first answer that confirmed that we can't do anithing whit cpp files on designer, i understood that i can't have any interface editor for what i have.

                    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