Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Unsolved Tips and tricks for 'backtracing' UI elements into the code.

    General and Desktop
    2
    8
    984
    Loading More Posts
    • 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.
    • osssome
      osssome last edited by

      Hi,

      OK making a UI with Qt is not a problem, but for an existing codebase and tracing what goes where is what I'm having difficulty with.

      Certainly this is not a knock against Qt. All UI software is kind of like this. So for this case, where an existing codebase uses Qt and localization, how do I figure out, from looking at something like a QDialog, where the associated logic will be? I don't expect it to be in plain sight and I don't know what files/constructs/docs to look for.

      I see the text specified in .ini files being used in the QDialog but I am having trouble tracing the string's name to a form file or code.

      Thanks

      1 Reply Last reply Reply Quote 0
      • mrjj
        mrjj Lifetime Qt Champion last edited by

        Hi, its not 100% sure the dialog has a UI file.
        It is easy to make without.
        You can check the constructor of the Dialog (in cpp)
        if It has
        ui->setupUi(this);
        there is a UI file.

        Also if u stand in the Dialogs h file, you can right click functions and variables and
        use the "Find Usages" too see where its being used.
        That is what I use to "discover" the structure of a new project.

        Also "follow symbol under cursor" is good for the other way, as in
        where does this live.

        If you are after localization, you would go and look for QTranslator using the super find function.
        Note, if they use a ini file, it might not be the normal way.

        1 Reply Last reply Reply Quote 0
        • osssome
          osssome last edited by osssome

          This is too dependent of the project. I found what I needed. It's just buried by lots of fuction calls and won't have the name that you expect.

          mrjj 1 Reply Last reply Reply Quote 0
          • mrjj
            mrjj Lifetime Qt Champion @osssome last edited by

            @osssome
            super.
            well people name things very differently sometimes.

            osssome 2 Replies Last reply Reply Quote 0
            • osssome
              osssome @mrjj last edited by

              @mrjj

              I didn't get a chance to use your info yet. I will dig around some more using your advice. Thanks!

              1 Reply Last reply Reply Quote 0
              • osssome
                osssome @mrjj last edited by

                @mrjj Yes they are using .ini everywhere. :'(

                mrjj 1 Reply Last reply Reply Quote 0
                • mrjj
                  mrjj Lifetime Qt Champion @osssome last edited by

                  @osssome
                  Well sometimes running the program in debug mode and single step around also helps to see
                  what calls what and when.

                  Are you trying to add new translation to it?

                  1 Reply Last reply Reply Quote 0
                  • osssome
                    osssome last edited by

                    I'm not. But your advice helped me. Thanks!

                    1 Reply Last reply Reply Quote 1
                    • First post
                      Last post