QtCreator Designer signal/slot connections inconsistent with generated code - qt

I'm working on a Qt project in QtCreator. The project has a dialog box with several UI elements, some of which have to be enabled/disabled according to what the user does. (i.e. If the user selects a radio button, then the form field has to be enabled.)
When I add a new signal/slot connection or delete an existing through the Qt Designer tool, the change shows up just fine in the preview. When I compile the application, though, the window still behaves exactly as it did before.
I investigated this by checking out the ui_WindowName.h file that the Qt Designer creates. Near the end of the setupUi function is a set of connect() calls. These connect() calls are consistent with the slot and signals that existed earlier today, but they do not reflect the changes I have made through Qt Designer since.
If I manually change the ui_WindowName.h file, then the UI works. But, of course, my changes get overridden if I ever try to chance anything from Qt Designer.
Even when I quit QtCreator and open it again, the Designer still shows the changed slot/signal connections while the auto-generated code does not reflect the changes.
Am I doing something wrong? Is there some way to delete whatever cache the Designer is storing or something to get things back in sync?
Thanks!
(One other thing: I'm using the stand-alone Qt Creator, not trying to develop in Visual Studio. The only other similar problem I could find on the web was from someone developing in Visual Studio, which doesn't support the automated signal/slot stuff.)

As usual, the answer is obvious once you realize it.
I moved the project in the course of working on it. There's a .pro.user file that keeps track of where the project is located. Without realizing that, I moved it along with the rest of the files.
As a result, I was editing one copy of the project and running the other.
The moral of the story: If you move a Qt project, remember to update your .pro.user file.
(Or you can just delete it. Qt Creator will prompt you to re-create it when you open the project.)

Related

What causes qtcreator to stop updating ui header files

I find my QtCreator (v4.5.0) stops updating ui header filers (for one of my projects) when I add some elements in the ui design form.
For example, after I add some QLCDNumber objects in the mainwindow.ui, normally I should be able to set these objects in the mainwindow constructor, something like: ui->lcdNumber. But now the lcdNumber (QLCDNumber *lcdNumber) is not recognized since the ui_mainwindow.h has not update the definition for the newly added objects.
I tried to run qmake, or reopen the project I am working on, or even restart my computer. It still doesn't work. It is noted that the issues is true of all the ui forms created within this project.
It is also weird to observe that other projects work fine. Anyone has idea of why this happens? Thanks!
I found the solution to the issue here Qt designer does not update the gui. What I have done is to delete all the previously built results, and configuration project built with Shaw build. Then the QtCreator returns to normal. Alternatively, delete all the previous ui_header files and rebuild the project.

Qt Creator and QML Live Preview

The problem now is that I don't know how I can use qml live preview?
I saw a video:
https://vimeo.com/145921618
I saw this post about erase this function for Qt Creator.
How i can implementlive coding into my app?
Perhaps you mean Terrarium?
Terrarium is a cross platform QML Playground: the view renders lively
as you type in the editor, makes prototyping and experimenting with
QtQuick a lot more fun!
It monitors changes in its TextEdit, and triggers the view to reload
source from the local http server. If you're looking for a file system
watcher implementation, please refer to QML LiveReload.
Or LiveReload?
As is evident from the video, this is as simple as auto reloading a QML file each time a chance to the file has been saved.
You can easily do that yourself, set up a QFileSystemWatcher and every time the file is modified, load the file in a QML view. And there you have it.
Of course, this is only good for previewing standalone components which can work on their own. You could go further, set the file system watcher to monitor the entire QML project and reload the main QML file every time something changes. It is a two step process, you need to monitor the directory, which only reflects adding or removing of files, and you subsequently add or remove those files from watching for changes.
Just for the sake of it, I want to share another tool that I found online.
It is a web based QML editor that gives immediate preview while writing the code. It has its limits, but still it's pretty useful for live QML coding
https://qmlweb.github.io/
If someone is still interested, in my Qt 5.10 installation, there is a qmlscene.exe in bin folder (same location as qmake or assistant). Running on command line is fine, however it is not in Qt creator.
PS: I found this:
http://doc.qt.io/qt-5/qtquick-qmlscene.html

How do I get application output from a Qt Creator plugin?

I'm writing an plugin for Qt Creator that will use the application output for a secondary reason (real-time graphical display of data). However, I've run into the problem of getting the application output. I don't wish to steal the output completely, just duplicate it. However, being able to filter what the debugger gets would be nice but not a requirement.
In case you are wondering, I'm trying to avoid modifying existing plugins so that any update to Qt Creator won't conflict and require patching for every single new version.
Creator is a open source project and your contributions are welcome:-) So why don't you to ask for Creator to be changed? The fastest way to do that is to write a patch that implements the interfaces you want and then submit it via codereview.qt-project.org.
Adding another patch that actually uses those interfaces can help, as that makes it easier to judge whether that functionality is really needed or whether there is a better way to implement it.

Qt - Qml debugging is enabled. Only use this in a safe environment

I'm trying to run a very simple program that just closes the window when clicking the `exit button, but get the following output provided that the application window that contains the button does not show up:
Starting C:\Users\Ola\Desktop\signal_slot1-build-desktop-Qt_4_8_1_for_Desktop_-_MSVC2008__Qt_SDK__Debug\debug\signal_slot1.exe...
Qml debugging is enabled. Only use this in a safe environment!
What should I do in this case?
You have enabled QML debugging (actually it's on by default), this opens a port to the Javascript interpreter that is running the QML so you can get debug output from it. Obviously this creates a security hole, so it should be turned off when not being used in safe place (it's turned off automatically when you release compile). This warning is to remind you of that.
If you are not using QML, turn it off anyway. You can turn it off in the project's options page, where the build settings are (it's a check box in the qmake area).
Assuming you use Qt Creator:
If you select the Release-Build type the QML debugging will be disabled. To do this, select the build type on the bottom left corner above the "run" button and choose "release".
Manually, there is an option passed to qmake (either in the .pro file or via command line arguments) named
CONFIG+=qml_debug
which enables qml debugging.
If you omit that, it should be disabled.
You can change it to release mode if you want to and that would solve the problem
but I recommend you to change between MSVC and MinGW and check which one is going to work.
Project->Build and Run-> and choose what you need.

Flex 4.5 - to long build process

We are developing an app using flex 4.5. The app runs just fine (no performance issues at all) but it takes us forever to compile and build it. A minor change, like just add a comment or press enter in an mxml file and rebuild takes about 3 minutes. You just cant work that way.
It is a large project with about 1300 files. We also use Parsley as IOC container and a beat of cairngorm navigation. We also use Maven (Flex mojos) but I am talking about a normal eclipse build (Ctrl + B).
We separated some of the code to a different SWC and all of our graphics are stored in a different resource SWF.
Please, Do you have any suggestions?
Regards, Ido
Summary
Turn off auto-build
Close unrelated projects
Remap Ctrl+B
Encapsulate application domains
Turn off auto-build
First thing to do when you install FlashBuilder is turning off the automatic building "feature". The Flex compiler is waaay to slow to constantly build in the background unless you work on very small projects. It's in menu > Project > Build Automatically.
Close unrelated projects
Any open project eats away memory. Close as many as you can.
Remap Ctrl+B
Since you use the Ctrl+B keybinding to launch the build process, you should know that this will actually build your entire workspace. Every single project that is open will be built. When you have a lot of dependencies that's gonna take a whole lot of time.
That's why I remap the Ctrl+B combo to just build the project that I'm currently working on. A small donwside is that sometimes you have to go 'manually' build a few projects, but that's largely outweighed by the time gain.
Go to menu > Window > Preferences. Type "key" in the search box. Click the topic "keys" under "general". Now type "build" in the searchbox on the right. Select "Build Automatically" and click the "Unbind Command" button. The ctrl+B binding should disappear. Now select "Build Project", then select the "Binding" input field (lower left) and hit Ctrl+B. Save and you're done.
Encapsulate application domains
I don't have a single project that is bigger than 200 files (usually even less than 100). Since your project consists of 1300 files I assume that it is does not have one monolithic function. So you should be able to slice it up into separate libraries; preferably one for each application domain. This will allow you to compile sizeable bits of the application and has the added benefit of clearly separating some concerns within your application.
How to fix slow build time when trying to use the debugger on Flash Builder 4.6 Mobile Apps
I ran into the same problem. Here is how you fix it.
It seem when you build a mobile app with a Server Connection like PHP it writes all of the
files on the server Directory..
When it come time to compile the app to debug it packages all of the sitting in the server directory. To fix this issue do the following.
Properties of the project.
Flex Build Packaging
for this example Pick Google Android.
Package Contents.
UnSelect anything that does not belong in your project..
After doing this build time when from 30 minutes to under 10 seconds..
Ok, This is how we fixed it:
We deleted all the dependencies. Then, we added only the necessary ones. You won't believe how many SWC files were just there and never used.
We went through almost every action-script and mxml file, and deleted unnecessary imports (using CTRL+ O on eclipse). This is a lot of work.
We changed the buiders on the project configurations so that only Flex builder remains. There were more builders including Maven. Every builder makes everything slower.
That is it.

Resources