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. QT with Visual Studio
Forum Updated to NodeBB v4.3 + New Features

QT with Visual Studio

Scheduled Pinned Locked Moved Unsolved General and Desktop
8 Posts 4 Posters 1.0k 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
    Asphodelus
    wrote on 8 Dec 2020, 16:34 last edited by Asphodelus 12 Aug 2020, 16:35
    #1

    Hello all,

    I do small apps with QtCreator, but for various reasons, I want to use Visual Studio with Qt Designer for the .ui

    I can do an app with .ui file BUT, no way to retrieve the objects contained in this ui file (while it's so simple with QtCreator...)
    alt text
    Any idea?

    Thanks in advance :)
    Julien

    J 1 Reply Last reply 9 Dec 2020, 06:27
    0
    • A Asphodelus
      8 Dec 2020, 16:34

      Hello all,

      I do small apps with QtCreator, but for various reasons, I want to use Visual Studio with Qt Designer for the .ui

      I can do an app with .ui file BUT, no way to retrieve the objects contained in this ui file (while it's so simple with QtCreator...)
      alt text
      Any idea?

      Thanks in advance :)
      Julien

      J Offline
      J Offline
      jsulm
      Lifetime Qt Champion
      wrote on 9 Dec 2020, 06:27 last edited by
      #2

      @Asphodelus Take a look at https://doc.qt.io/archives/vs-addin/index.html

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      3
      • A Offline
        A Offline
        Asphodelus
        wrote on 9 Dec 2020, 17:54 last edited by
        #3
        This post is deleted!
        1 Reply Last reply
        0
        • A Offline
          A Offline
          Asphodelus
          wrote on 9 Dec 2020, 19:01 last edited by Asphodelus 12 Sept 2020, 19:02
          #4

          Thanks! I can use ui.my_widget. doSomething();
          BUT... :(

          In Qt Designer, I create a button called "foo", it"s working, i can do: ui.foo->setText("blabla);, But if for example I want to rename it to "bar" in QT Desinger, Visual Studio don't update this (I've tried regenerate solution etc...)

          A little example here with the button named "bar" in the *ui

          https://www.noelshack.com/2020-50-3-1607540469-capture.jpg

          1 Reply Last reply
          0
          • O Offline
            O Offline
            ollarch
            wrote on 10 Dec 2020, 08:49 last edited by
            #5

            Hi,

            As the UI is modified externally using QDesigner, Visual Studio does not know that the UI has changed. After saving the UI in QDesigner right click on the UI file on Visual Studio solution explorer and compile the file. The UIC compiler will regenerate the "ui_XXX.h" file that is the file that your application is looking for.

            J 1 Reply Last reply 10 Dec 2020, 09:04
            1
            • O ollarch
              10 Dec 2020, 08:49

              Hi,

              As the UI is modified externally using QDesigner, Visual Studio does not know that the UI has changed. After saving the UI in QDesigner right click on the UI file on Visual Studio solution explorer and compile the file. The UIC compiler will regenerate the "ui_XXX.h" file that is the file that your application is looking for.

              J Online
              J Online
              JonB
              wrote on 10 Dec 2020, 09:04 last edited by JonB 12 Oct 2020, 09:11
              #6

              @ollarch
              Indeed that will be the OP's issue. But is there any way (I don't know or use VS) to tell the VS project that the ui....h file depends on the .ui file, and run the necessary uic to regenerate it, so that you know you can build in VS and it will update automatically?

              EDIT Hmm, I see this is asked in https://stackoverflow.com/questions/60304171/cmake-qt5-and-autouic-not-rebuilding-when-ui-file-touched

              O 1 Reply Last reply 10 Dec 2020, 10:04
              0
              • J JonB
                10 Dec 2020, 09:04

                @ollarch
                Indeed that will be the OP's issue. But is there any way (I don't know or use VS) to tell the VS project that the ui....h file depends on the .ui file, and run the necessary uic to regenerate it, so that you know you can build in VS and it will update automatically?

                EDIT Hmm, I see this is asked in https://stackoverflow.com/questions/60304171/cmake-qt5-and-autouic-not-rebuilding-when-ui-file-touched

                O Offline
                O Offline
                ollarch
                wrote on 10 Dec 2020, 10:04 last edited by
                #7

                @JonB
                I don't kwow if it can be done automatically when the file is saved. What the Qt Visual Studio Tools do is define a custom compilation rule for *.ui files that simply calls the uic compiler and the output file goes to "GeneratedFiles" folder where the solution looks for the "ui_xxx.h" file.
                If you build all the project after saving the UI file, then you will have the access to the new added (or name changed) UI elements as it compiles the UI file. Just right clicking the UI file and compiling the UI file is what I do to avoid full project compilation that is slower than compiling only one file.

                I will take a look at the post.

                1 Reply Last reply
                1
                • A Offline
                  A Offline
                  Asphodelus
                  wrote on 10 Dec 2020, 20:02 last edited by
                  #8

                  Thanks all!

                  I've resolve it by do a "rescan solution" for update Interlisence and it work!

                  I'm looking for a better way for do this because it's not pratical... (if someone have idea! :) )

                  1 Reply Last reply
                  0

                  1/8

                  8 Dec 2020, 16:34

                  • Login

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