Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Qt Creator: Don't switch to "Design" mode automatically.
I am using UI Form. Once I open the file, Qt Creator will switch to "Design" mode automatically. Is there has a method to disable this behaviour? Because it is a bit slow to switch mode, and I am not alway want to code in GUI (Some operation can not be done by GUI). So I would like to keep the file in "Edit" mode first.
koahnig last edited by
Why do you want to open an ui file, when you are not intending to edit it?
Just for looking onto xml sounds odd to me. Therefore, I think that you are opening for another purpose. Possible you can do that without opening the ui.
When you click on UI file it opens it for visual editing.
IF you want to access the code, simply click on the .h or .cpp file instead.
Anyway, you can switch between mode with SHIFT+F4
Sorry I didn't mention it clearly. I mean Qt Quick UI From. Not the original .ui file for C++. The problem is the Qt Quick Designer is not able to perform all the editing task. It can not setup data binding via the GUI. And sometimes I need to do c&p among different files. But once I come back the file, it will go to "Design" mode and it pause for a while to get started. It is a bit annoying. Moreover, when I do a full text search and found the text in a .ui.qml file. It will go to design mode too.
Thomas Hartmann last edited by
The qml.ui are supposed to be edited in the design mode (only).
If you have files that you want to only occasionally edit in the design mode (or only initially), I suggest to keep them as .qml files.
The current plan is to allow editing the code even in the "Design Mode" for tasks that are not possible or inconvenient in the ui.
What do you mean by " It can not setup data binding via the GUI"?
The Designer allows you to edit expressions on properties and has the Connection Editor for e.g. adding dynamic properties or managing properties. What functionality are you exactly missing?
@Thomas-Hartmann Sorry I don't know Qt Quick Designer has this feature. Now I know and will use this feature.
However, even a Qt Quick UI Form is supposed to be edited by designer only, there has many exception that still need to modify the code directly.
- Change the base component type from Item to MouseArea / Rectangle etc
- Add import statement to relative path. "import "../../components" "
- Modify properties missing from designer. (e.g the elide property in text item)
- Set "State.when"
So before the new feature come out. I still need to switch between designer and editor mode frequently.
Thomas Hartmann last edited by
We fixed 3) and 4) in Qt Creator 4.2.
You are right there are cases where you manually want to edit the .ui.qml file.
The mode switching is pretty deep embedded in the Qt Creator architecture and if you check, you will find out that it behaves exactly the same for traditional widget .ui files. This is the main reason why we want to keep the current behavior.
Most likely in Qt Creator 4.3 we will add a text widget to the design mode, so it becomes easier to edit QML without having to change the mode. This way also the property editor will be available when editing QML code.
hulloanson last edited by hulloanson
I'm using QT Creator 4.5.2 now. And this hasn't become an option yet. Switching to design mode is counter-intuitive to me - I'm a programmer and more comfortable around codes than fancy ui. Looks like QT is really pushing hard their design mode to their users. Ended up grabbing the source and commented out the auto-switching to design mode. For anyone looking, it is in src/plugins/coreplugin/editormanager/editormanager.cpp. Interestingly, they have all sorts of flags on whether to switch to modes automatically each time a file loads so it should actually be quite configurable with little effort. Being a lazy man though, I just commented out one branch of an if-clause between line 1264 - 1278, recompile and voila! I don't need to wait for qtcreator to load the design mode screen now :D
I did this in the v4.5.2 source. If anyone knows any updates since this version, like a checkbox to handle this behavior, please tell me :D