Results 1 to 8 of 8

Thread: Change objectName in Designer does not get updated in Creator

  1. #1
    Join Date
    Sep 2017
    Posts
    29
    Thanks
    3
    Thanked 2 Times in 2 Posts
    Qt products
    Qt5 Qt/Embedded
    Platforms
    Windows

    Default Change objectName in Designer does not get updated in Creator

    I am working in a project and I open both Qt creator in one screen and in another monitor i open Qt designer.
    When i change the widget's objectname and saved the ui, the completion code does not detect the new name.
    the only way to make the changes reflect on creator is to restart the IDE. which is dumb. any way to avoid this
    stupidity?

  2. #2
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,716
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Change objectName in Designer does not get updated in Creator

    The reason for this is that the changes in the designer form are saved to the *.ui file which is xml.
    In order for QtCreator to be able to show you the changes in the code completion they have to take place in the C++ code as well.
    For that you need to call the uic on the changed form to generate the new C++ code that include the changes from the *.ui file.
    So simply building the project will work.
    I am not aware of the option to run only uic separately directly from QtCreator but you can do it from the console like this:
    uic -o my_form.h my_form.ui
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  3. The following user says thank you to high_flyer for this useful post:

    GeneCode (26th September 2017)

  4. #3
    Join Date
    Sep 2017
    Posts
    1
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Change objectName in Designer does not get updated in Creator

    Hi,
    I have similar problem, hope anybody could help me.

    When I change objectName of my QMainWindow at my *.ui file the *.h and *.cpp
    files are not apdated automatically and when I try to RUN it I have the error.
    I tried "clean" and "build" but the files are not updated!
    I also tried uic command from console - did not help.
    And when I change manually it works.

  5. #4
    Join Date
    Sep 2017
    Posts
    29
    Thanks
    3
    Thanked 2 Times in 2 Posts
    Qt products
    Qt5 Qt/Embedded
    Platforms
    Windows

    Default Re: Change objectName in Designer does not get updated in Creator

    Quote Originally Posted by MaksymS View Post
    Hi,
    I have similar problem, hope anybody could help me.

    When I change objectName of my QMainWindow at my *.ui file the *.h and *.cpp
    files are not apdated automatically and when I try to RUN it I have the error.
    I tried "clean" and "build" but the files are not updated!
    I also tried uic command from console - did not help.
    And when I change manually it works.
    So far what I did is restart Qt.
    It is dumb, but that's the only thing that worked for me.
    Maybe Qt is not meant to work when Qt Designer is opened
    side by side with Creator. idk... it sucksssss

  6. #5
    Join Date
    Jul 2008
    Location
    Germany
    Posts
    459
    Thanks
    10
    Thanked 61 Times in 59 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Change objectName in Designer does not get updated in Creator

    Quote Originally Posted by MaksymS View Post
    When I change objectName of my QMainWindow at my *.ui file the *.h and *.cpp
    files are not apdated automatically and when I try to RUN it I have the error.
    As high_flyer wrote, the designer edits an .ui file. The uic command converts this to the ui_xyz.h file, which is then included in your .h and .cpp files.
    Neither the designer nor the uic will change your code!

    Ginsengelf

  7. #6
    Join Date
    Sep 2017
    Posts
    29
    Thanks
    3
    Thanked 2 Times in 2 Posts
    Qt products
    Qt5 Qt/Embedded
    Platforms
    Windows

    Default Re: Change objectName in Designer does not get updated in Creator

    Quote Originally Posted by high_flyer View Post
    So simply building the project will work.
    Ok building does update the names.
    I guess this is better than restarting Qt.
    I am noob. Are you noob? Lets learn Qt together! https://qtnoobies.blogspot.com/

  8. #7
    Join Date
    Dec 2020
    Posts
    1
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Change objectName in Designer does not get updated in Creator

    Well, looks like re-build is not enough: the object names are not updated in the .cpp file.
    What am I missing?
    Thanks in advance

  9. #8
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    4,836
    Thanks
    269
    Thanked 785 Times in 775 Posts
    Qt products
    Qt5
    Platforms
    Windows Android

    Default Re: Change objectName in Designer does not get updated in Creator

    What am I missing?
    The object names (as well as any other settings made through Designer) are updated on the C++ side only when 1) you save the UI file from Designer, 2) the UIC compiler runs as part of the build process to convert the .ui file into the ui_*.h file that gets #included in the class declaration header file, 3) you are #include-ing the correct ui_*.h header file and not some previous version that is still hanging around because you renamed it without deleting the old one, and 4) your .pro file is set up to run UIC on all of the UI files needed.

    Since you haven't provided any information other than "it doesn't work", it's hard to say what is wrong in your case.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

Similar Threads

  1. QT Designer and QT Creator
    By rakeshthp in forum Newbie
    Replies: 1
    Last Post: 8th November 2015, 07:58
  2. Replies: 2
    Last Post: 29th August 2012, 02:01
  3. Using Qt Designer on Qt Creator
    By Ramzeez in forum Newbie
    Replies: 1
    Last Post: 24th April 2012, 23:54
  4. tableWidget created in Qt Creator not updated
    By binaural in forum Qt Programming
    Replies: 2
    Last Post: 10th July 2009, 22:50

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.