Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. Qt Creator: Don't switch to "Design" mode automatically.
QtWS25 Last Chance

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

Scheduled Pinned Locked Moved Unsolved Qt Creator and other tools
9 Posts 6 Posters 8.2k 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.
  • benlauB Offline
    benlauB Offline
    benlau
    Qt Champions 2016
    wrote on last edited by
    #1

    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.

    K 1 Reply Last reply
    0
    • benlauB benlau

      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.

      K Offline
      K Offline
      koahnig
      wrote on last edited by
      #2

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

      Vote the answer(s) that helped you to solve your issue(s)

      1 Reply Last reply
      1
      • mrjjM Offline
        mrjjM Offline
        mrjj
        Lifetime Qt Champion
        wrote on last edited by
        #3

        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

        1 Reply Last reply
        0
        • benlauB Offline
          benlauB Offline
          benlau
          Qt Champions 2016
          wrote on last edited by
          #4

          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.

          1 Reply Last reply
          1
          • T Offline
            T Offline
            Thomas Hartmann
            wrote on last edited by
            #5

            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?

            benlauB 1 Reply Last reply
            2
            • T Thomas Hartmann

              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?

              benlauB Offline
              benlauB Offline
              benlau
              Qt Champions 2016
              wrote on last edited by
              #6

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

              1 Reply Last reply
              1
              • T Offline
                T Offline
                Thomas Hartmann
                wrote on last edited by
                #7

                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.

                1 Reply Last reply
                2
                • H Offline
                  H Offline
                  hulloanson
                  wrote on last edited by hulloanson
                  #8

                  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

                  1 Reply Last reply
                  1
                  • P Offline
                    P Offline
                    podkyr
                    wrote on last edited by
                    #9

                    I've got some workaround. Just go to Help->About plugins and switch off QmlDesigner at Qt Quick section

                    1 Reply Last reply
                    0

                    • Login

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