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. Editing ui C++ code ?

Editing ui C++ code ?

Scheduled Pinned Locked Moved Unsolved General and Desktop
7 Posts 3 Posters 602 Views
  • 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 Offline
    A Offline
    Anonymous_Banned275
    wrote on last edited by Anonymous_Banned275
    #1

    OK, I am having another senior moment , so be reasonable....
    I am trying to modify btchat example.
    From what I can tell it has been build without benefit of QtDesigner.

    I can open chat.ui in QtDesigner and edit it to my hart's desire.
    I actually have no idea where did "chat.ui" came from if the ui is build in C++ code.

    BUT my btchat project ignores all 'chat.ui" changes done in QtDesigner.

    I found a link which supposedly address this but it is very old and inaccessible.

    Basically - can I edit "ui" anything using both QtCreator code and QtDesigner GUI ?

    EDITED
    I found this
    https://doc.qt.io/archives/2.3/designer/chap2_2.html

    It sort of explains how "filename.ui" get created so what is left is how to make it work the opposite direction - from "filename.ui" back to "filename.cpp".

    1 Reply Last reply
    0
    • nageshN Offline
      nageshN Offline
      nagesh
      wrote on last edited by
      #2

      @AnneRanch
      refer to the following link
      https://doc.qt.io/qt-5/designer-using-a-ui-file.html

      User Interface Compiler (uic) reads an XML format user interface definition (.ui) file as generated by Qt Designer and creates a corresponding C++ header file.

      https://doc.qt.io/qt-5/uic.html

      1 Reply Last reply
      1
      • A Offline
        A Offline
        Anonymous_Banned275
        wrote on last edited by
        #3

        Been there already. It explains how "filename.ui" gets created.
        It does not help to "work from QtDesigner to QtCreator".
        I actually verified that QtDesigner can pass code "go to slot" using existing button. Works fine.
        But I cannot add any new widget to chat.ui form to be passed to chat.cpp code..

        1 Reply Last reply
        0
        • nageshN Offline
          nageshN Offline
          nagesh
          wrote on last edited by nagesh
          #4

          @AnneRanch

          BUT my btchat project ignores all 'chat.ui" changes done in QtDesigner.
          

          are you making changes for .ui by seperately launching QtDesigner?
          QtDesigner is integrated to QtCreator.

          What changes it's not reflecting?
          https://forum.qt.io/topic/124803/title-bar-messing-dialog-layout

          1 Reply Last reply
          0
          • A Offline
            A Offline
            Anonymous_Banned275
            wrote on last edited by Anonymous_Banned275
            #5

            @AnneRanch said in Editing ui C++ code ?:

            can open chat.ui in QtDesigner and edit it to my hart's desire.
            I actually have no idea where did "chat.ui" came from if the ui is build in C++ code.
            BUT my btchat project ignores all 'chat.ui" changes done in QtDesigner.

            can open chat.ui in QtDesigner - FROM qtCreator - and edit it to my hart's desire.
            BUT my btchat project ignores all 'chat.ui" changes done in QtDesigner.

            Please ignore this post .
            It is easier to copy and paste the working (example) code using standard widget form with normal relations between QtCreator and QtDesigner - none of this half baked and undocumented "build with code GUI " , thus bypassing the QtDesigner , example(s). (I guess expecting updated example using QtDesigner is foolish)

            "search and replace " works so renaming the original code would be a snap.

            CASE CLOSED ?

            J.HilkJ 1 Reply Last reply
            0
            • A Anonymous_Banned275

              @AnneRanch said in Editing ui C++ code ?:

              can open chat.ui in QtDesigner and edit it to my hart's desire.
              I actually have no idea where did "chat.ui" came from if the ui is build in C++ code.
              BUT my btchat project ignores all 'chat.ui" changes done in QtDesigner.

              can open chat.ui in QtDesigner - FROM qtCreator - and edit it to my hart's desire.
              BUT my btchat project ignores all 'chat.ui" changes done in QtDesigner.

              Please ignore this post .
              It is easier to copy and paste the working (example) code using standard widget form with normal relations between QtCreator and QtDesigner - none of this half baked and undocumented "build with code GUI " , thus bypassing the QtDesigner , example(s). (I guess expecting updated example using QtDesigner is foolish)

              "search and replace " works so renaming the original code would be a snap.

              CASE CLOSED ?

              J.HilkJ Offline
              J.HilkJ Offline
              J.Hilk
              Moderators
              wrote on last edited by
              #6

              @AnneRanch Most of the time I have a hard time deciphering what you're actually asking/wanting to do, so I'm not commenting.

              but regarding this:

              BUT my btchat project ignores all 'chat.ui" changes done in QtDesigner

              what version of QtCreator do you work with? the latest one (4.14.2) ? Because I remember some older versions that had synchronization issues.

              That said, open preferences/settings, go to build&run check the checkbox next to "run qmake on every build"

              It will increase your build time, but your issues should lessen/disappear.

              f3800ae3-c738-48bd-93a5-6bd5282b97c2-image.png

              I actually verified that QtDesigner can pass code "go to slot" using existing button. Works fine.

              I highly discourage the use of the "Connect Slot By Name" feature. It is prone to breaking with the smallest of changes in source or ui code


              Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


              Q: What's that?
              A: It's blue light.
              Q: What does it do?
              A: It turns blue.

              1 Reply Last reply
              4
              • A Offline
                A Offline
                Anonymous_Banned275
                wrote on last edited by Anonymous_Banned275
                #7

                Hope this will demonstrate the problem.
                Unfortunately I have "breal the layout" and it really doe sno match.

                BUT
                the "chat.ui" has "tab" widget and it does not show during run.
                The "chat.ui" and whatever is used during "run" do not match.

                28d036ea-fd47-4a5c-8b02-2baac702941c-image.png

                804723c9-df48-4402-9a06-21cc78514f3b-image.png

                PS I have used "go to slot" to verify that the run is actually using the "chat.ui"
                and not some other "ui" file.

                I am going to try to find what is the code difference between "btchat" code created form and when I use "QDesigner form class" .

                This is not first time I have been told to check version , however I still believe that the sample "btchat" "problem" is it was (obviously) not build using QtDEsigner and it is not that clear HOW different piece parts of the "widget" works.

                FRom get go I have struggled with C code , XML and "ui" .
                I wish some documentation would say how all these parts interact.

                For example ".ui file is build from C) source via XML ' does no really say much how it is used in C code flow.

                However , at this point I am going to build my own "chat" using "QDesigner form class" - it is proven to work as expected.

                I forgot - yes - I have "always build qmake " optioned.

                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