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. Elements added by QtDesigner does not show up in QtCreator
Forum Updated to NodeBB v4.3 + New Features

Elements added by QtDesigner does not show up in QtCreator

Scheduled Pinned Locked Moved Unsolved Qt Creator and other tools
4 Posts 2 Posters 353 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.
  • N Offline
    N Offline
    Noobish
    wrote on last edited by
    #1

    I've noticed that when I add a new component to my .ui file with QtDesigner, the new component does not show up when I start to write

    ui->
    

    in my MainWindow class.

    For regular C++ files, member variables and functions shows up in a list when I write

    my_object->
    

    Is there something I have to do to make ui-related things appear? It seems that some stuff I added earlier (I've closed Qtcreator since they were added) are found and listed when I write

    ui->
    
    JonBJ 1 Reply Last reply
    0
    • N Noobish

      I've noticed that when I add a new component to my .ui file with QtDesigner, the new component does not show up when I start to write

      ui->
      

      in my MainWindow class.

      For regular C++ files, member variables and functions shows up in a list when I write

      my_object->
      

      Is there something I have to do to make ui-related things appear? It seems that some stuff I added earlier (I've closed Qtcreator since they were added) are found and listed when I write

      ui->
      
      JonBJ Online
      JonBJ Online
      JonB
      wrote on last edited by JonB
      #2

      @Noobish Have you (re-)run uic to (re-)generate the (now changed) C++ .h file?

      N 1 Reply Last reply
      1
      • JonBJ JonB

        @Noobish Have you (re-)run uic to (re-)generate the (now changed) C++ .h file?

        N Offline
        N Offline
        Noobish
        wrote on last edited by
        #3

        @JonB said in Elements added by QtDesigner does not show up in QtCreator:

        @Noobish Have you (re-)run uic to (re-)generate the (now changed) C++ .h file?

        No I have not, well not directly any way. Even if I build the client, which I assume would run uic at some step,, I still dont get the new components to show up in Creator when writing code.

        The mainwindow.cpp file contains the line:

        #include "./ui_mainwindow.h"
        

        I found the the file in

        build/Desktop-Debug/projectname_autogen/include/ui_mainwindow.h
        

        So I guess it is placed in a directory that is not parsed by qt creator?
        Should I try tell QtCreator to look for source code in that directory also? Or what should I do? I dont want to do some manual labour (well, I could run an infinite loop making calls to uic or watch for the gui file to change, but I'd rather QtCreator would handle that for me automatically.

        JonBJ 1 Reply Last reply
        0
        • N Noobish

          @JonB said in Elements added by QtDesigner does not show up in QtCreator:

          @Noobish Have you (re-)run uic to (re-)generate the (now changed) C++ .h file?

          No I have not, well not directly any way. Even if I build the client, which I assume would run uic at some step,, I still dont get the new components to show up in Creator when writing code.

          The mainwindow.cpp file contains the line:

          #include "./ui_mainwindow.h"
          

          I found the the file in

          build/Desktop-Debug/projectname_autogen/include/ui_mainwindow.h
          

          So I guess it is placed in a directory that is not parsed by qt creator?
          Should I try tell QtCreator to look for source code in that directory also? Or what should I do? I dont want to do some manual labour (well, I could run an infinite loop making calls to uic or watch for the gui file to change, but I'd rather QtCreator would handle that for me automatically.

          JonBJ Online
          JonBJ Online
          JonB
          wrote on last edited by JonB
          #4

          @Noobish
          For code completion the .ui must be processed by uic to produce the ui_....h file as C++ code. This should happen as part of build, every time you update the .ui or force clean rebuild. There are many little things you can investigate:

          • For qmake the .h file is generated into the build output directory (where object and executable files are). I do not know for cmake, where you say you found it may be reasonable.

          • Make sure there are no other instances of that file elsewhere which could be picked up.

          • Update the .ui, do a build, verify the timestamp on the .h has been updated.

          • Read the .h into Creator and have a look through it. It's just C++ code. Verify you can see the lines generated for the components you add.

          • Forget about code completion for a moment. Type in what (you believe) is right to access some new ui-> element in your code. Do an actual compile/build. If that errors on your new component you are doing something wrong; if that succeeds but the code completion does not you have some problem in the latter area.

          • Do a complete delete and rebuild.

          • Create a brand new, standalone project elsewhere and see how you get on with creating new components.

          1 Reply Last reply
          1

          • Login

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