Qt Creator: Don't switch to "Design" mode automatically.


  • Qt Champions 2016

    Hi,

    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.


  • Moderators

    @benlau

    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.


  • Qt Champions 2016

    Hi
    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


  • Qt Champions 2016

    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.



  • 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?


  • Qt Champions 2016

    @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.

    1. Change the base component type from Item to MouseArea / Rectangle etc
    2. Add import statement to relative path. "import "../../components" "
    3. Modify properties missing from designer. (e.g the elide property in text item)
    4. Set "State.when"

    So before the new feature come out. I still need to switch between designer and editor mode frequently.



  • 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.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.