QT with Visual Studio
-
wrote on 8 Dec 2020, 16:34 last edited by Asphodelus 12 Aug 2020, 16:35
-
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...)
Any idea?Thanks in advance :)
Julien@Asphodelus Take a look at https://doc.qt.io/archives/vs-addin/index.html
-
wrote on 9 Dec 2020, 17:54 last edited byThis post is deleted!
-
wrote on 9 Dec 2020, 19:01 last edited by Asphodelus 12 Sept 2020, 19:02
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
-
wrote on 10 Dec 2020, 08:49 last edited by
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.
-
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.
wrote on 10 Dec 2020, 09:04 last edited by JonB 12 Oct 2020, 09:11@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 theui....h
file depends on the.ui
file, and run the necessaryuic
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
-
@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 theui....h
file depends on the.ui
file, and run the necessaryuic
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
wrote on 10 Dec 2020, 10:04 last edited by@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.
-
wrote on 10 Dec 2020, 20:02 last edited by
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/8