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 - How to keep a .ui file open in Design mode, and a different file open in Edit mode?
Forum Update on Monday, May 27th 2025

Qt Creator - How to keep a .ui file open in Design mode, and a different file open in Edit mode?

Scheduled Pinned Locked Moved Unsolved Qt Creator and other tools
7 Posts 4 Posters 3.4k 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.
  • C Offline
    C Offline
    chimpdude
    wrote on 23 Oct 2020, 03:06 last edited by chimpdude
    #1

    My project has one .ui file (just one window), but the C++ code is divided into lots of different source files. I often want to edit some code, then quickly switch to design mode to edit the single GUI for my project, then go back to editing code.

    Here is the process I've been reluctantly following:

    • edit some source or header file
    • I see some need to edit the .ui file. I have to go to the Project sidebar and look for the .ui file then double click it and enter Design mode
    • after finishing the modifications that were needed, I then click Edit mode to go back to editing code, with the goal of editing the same C++ file I was editing previously
    • Doing so makes Qt Creator think that I'm trying to directly edit the XML code for the .ui file, and so switches to the XML code and says the warning "This file can only be edited in Design mode" (yeah, OK, I know that, I'm not trying to edit the .ui file bro)
    • then I have to remember which file I was editing before, search for it and click on it in the Projects sidebar
    • I realize again something I need to look at or change on the GUI, so I repeat this process again - look for the .ui file, double click it to do some stuff in Design mode, go back to Edit mode, get the warning, and click back on the source file

    I've found a few alternatives that are still not ideal, such as:

    • use shift+F4, which opens the .cpp file for the GUI in Edit mode
      • This is really not ideal because I often don't want to edit the .cpp file for the GUI and have some other file in mind, or had some other file opened before switching to Design mode
      • If I am not currently editing the GUI's source file (say the GUI's header file), then Shift+F4 to go to Design mode does nothing.
    • Use Ctrl+Tab to cycle through the files I have open
      • this is also not ideal because I have to Ctrl+Tab through the recently edited files until the .ui file is highlighted, then I can go into Design mode. This can take me a while to do when I have lots of files open, I've edited more than one file since being in Design mode, and I had little sleep the night before on top of an annoying condition called ADHD; so cycling through a file list makes me forget which file I was trying to open and my concentration is about to receive the kiss of death
      • not to mention that the number of times I have to press Ctrl+Tab to get to the .ui file is not a constant. It could be 1 time, 2 times, 3 times, 7 times, etc...this can break my very brittle concentration

    Here is what I oh-so-wish were possible:

    • edit some source or header file
    • I see some need to edit the .ui file. I press a keyboard shortcut to go to Design mode, where the single GUI I am designing is open and waiting for me
    • after finishing the modifications that were needed, I press a keyboard shortcut to go to Edit mode, where the C++ file I was editing previously is patiently waiting for me

    Is this possible to do? Am I missing some important setting in Options or does some keyboard shortcut I haven't found do what I've described?

    Any help will be greatly appreciated!

    -- Never-Productive-Enough ADHDer

    J 1 Reply Last reply 23 Oct 2020, 07:54
    0
    • S Offline
      S Offline
      sierdzio
      Moderators
      wrote on 23 Oct 2020, 04:36 last edited by
      #2

      I have a not-so-good workaround for this: Qt Creator lets you open several windows, but opens Design Mode in only one of them.

      Look for the split icon (top-right on any code editing view), click it and select "Open in New Window". Then you can keep editing your source code in one window and have the editor opened in the other. This works best if you have multiple monitors or one big one.

      (Z(:^

      1 Reply Last reply
      4
      • J Online
        J Online
        JonB
        wrote on 23 Oct 2020, 07:45 last edited by
        #3

        I hope I'm allowed to post here just to grumble :) This has bothered me too in Creator, but I just thought I'd better hold my peace.

        I'm a great fan of Qt, but Creator is just that horrible, overused word --- "clunky" :( I do however realise that, say, MS Visual Studio probably had 1,000 people working on it with an unlimited budget, while Creator (by the looks of it) no longer has had even one person in years!

        Inevitably we will swap between Design button and Edit button to go edit a code file. It drives me mad that I get put into the This file can only be edited in Design mode. Given that I'm not allowed to edit the XML, find a way of not putting me there!

        While we are on that subject. Can we please have a I know what I'm doing, can you let me edit the bloody XML button next to the Switch Mode? There are plenty of cases where you need, or it's easiest, to edit the XML --- just for example, hunting down all those inline stylesheets, finding/changing any font sizes, and so on. Even in this forum there are times we are told to go edit the .ui file to achieve something. How are we supposed to be able to do that? Only two ways: go edit it in an external, non-XML-aware text editor, or copy it to a .xml, make edits, copy it back to .ui. Since Creator allows you to edit the .ui externally and re-read it, it might as well offer an "advanced" option to allow it that from within.

        @sierdzio

        This works best if you have multiple monitors or one big one.

        When Qt comes supplied with a larger or spare monitor I will welcome your suggestion. Till then I only have my one 1920x1200.... :)

        @chimpdude

        after finishing the modifications that were needed, I press a keyboard shortcut to go to Edit mode, where the C++ file I was editing previously is patiently waiting for me

        I don't know whether you have noticed this, but if you go Ctrl+Tab once, don't bother looking at the list of filenames, and just release, you alternate between this and the previous file. So once you have gotten going on a .ui plus its corresponding .cpp/.h this does count as your desired keyboard shortcut?

        Thanks for listening :)

        S 1 Reply Last reply 23 Oct 2020, 07:57
        1
        • C chimpdude
          23 Oct 2020, 03:06

          My project has one .ui file (just one window), but the C++ code is divided into lots of different source files. I often want to edit some code, then quickly switch to design mode to edit the single GUI for my project, then go back to editing code.

          Here is the process I've been reluctantly following:

          • edit some source or header file
          • I see some need to edit the .ui file. I have to go to the Project sidebar and look for the .ui file then double click it and enter Design mode
          • after finishing the modifications that were needed, I then click Edit mode to go back to editing code, with the goal of editing the same C++ file I was editing previously
          • Doing so makes Qt Creator think that I'm trying to directly edit the XML code for the .ui file, and so switches to the XML code and says the warning "This file can only be edited in Design mode" (yeah, OK, I know that, I'm not trying to edit the .ui file bro)
          • then I have to remember which file I was editing before, search for it and click on it in the Projects sidebar
          • I realize again something I need to look at or change on the GUI, so I repeat this process again - look for the .ui file, double click it to do some stuff in Design mode, go back to Edit mode, get the warning, and click back on the source file

          I've found a few alternatives that are still not ideal, such as:

          • use shift+F4, which opens the .cpp file for the GUI in Edit mode
            • This is really not ideal because I often don't want to edit the .cpp file for the GUI and have some other file in mind, or had some other file opened before switching to Design mode
            • If I am not currently editing the GUI's source file (say the GUI's header file), then Shift+F4 to go to Design mode does nothing.
          • Use Ctrl+Tab to cycle through the files I have open
            • this is also not ideal because I have to Ctrl+Tab through the recently edited files until the .ui file is highlighted, then I can go into Design mode. This can take me a while to do when I have lots of files open, I've edited more than one file since being in Design mode, and I had little sleep the night before on top of an annoying condition called ADHD; so cycling through a file list makes me forget which file I was trying to open and my concentration is about to receive the kiss of death
            • not to mention that the number of times I have to press Ctrl+Tab to get to the .ui file is not a constant. It could be 1 time, 2 times, 3 times, 7 times, etc...this can break my very brittle concentration

          Here is what I oh-so-wish were possible:

          • edit some source or header file
          • I see some need to edit the .ui file. I press a keyboard shortcut to go to Design mode, where the single GUI I am designing is open and waiting for me
          • after finishing the modifications that were needed, I press a keyboard shortcut to go to Edit mode, where the C++ file I was editing previously is patiently waiting for me

          Is this possible to do? Am I missing some important setting in Options or does some keyboard shortcut I haven't found do what I've described?

          Any help will be greatly appreciated!

          -- Never-Productive-Enough ADHDer

          J Offline
          J Offline
          J.Hilk
          Moderators
          wrote on 23 Oct 2020, 07:54 last edited by
          #4

          @chimpdude said in Qt Creator - How to keep a .ui file open in Design mode, and a different file open in Edit mode?:

          after finishing the modifications that were needed, I press a keyboard shortcut to go to Edit mode, where the C++ file I was editing previously is patiently waiting for me

          When you're finished with your modification in design mode:
          STRG + S to save changes
          STRG + W to close design file and to go back to the previous file


          Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


          Q: What's that?
          A: It's blue light.
          Q: What does it do?
          A: It turns blue.

          1 Reply Last reply
          0
          • J JonB
            23 Oct 2020, 07:45

            I hope I'm allowed to post here just to grumble :) This has bothered me too in Creator, but I just thought I'd better hold my peace.

            I'm a great fan of Qt, but Creator is just that horrible, overused word --- "clunky" :( I do however realise that, say, MS Visual Studio probably had 1,000 people working on it with an unlimited budget, while Creator (by the looks of it) no longer has had even one person in years!

            Inevitably we will swap between Design button and Edit button to go edit a code file. It drives me mad that I get put into the This file can only be edited in Design mode. Given that I'm not allowed to edit the XML, find a way of not putting me there!

            While we are on that subject. Can we please have a I know what I'm doing, can you let me edit the bloody XML button next to the Switch Mode? There are plenty of cases where you need, or it's easiest, to edit the XML --- just for example, hunting down all those inline stylesheets, finding/changing any font sizes, and so on. Even in this forum there are times we are told to go edit the .ui file to achieve something. How are we supposed to be able to do that? Only two ways: go edit it in an external, non-XML-aware text editor, or copy it to a .xml, make edits, copy it back to .ui. Since Creator allows you to edit the .ui externally and re-read it, it might as well offer an "advanced" option to allow it that from within.

            @sierdzio

            This works best if you have multiple monitors or one big one.

            When Qt comes supplied with a larger or spare monitor I will welcome your suggestion. Till then I only have my one 1920x1200.... :)

            @chimpdude

            after finishing the modifications that were needed, I press a keyboard shortcut to go to Edit mode, where the C++ file I was editing previously is patiently waiting for me

            I don't know whether you have noticed this, but if you go Ctrl+Tab once, don't bother looking at the list of filenames, and just release, you alternate between this and the previous file. So once you have gotten going on a .ui plus its corresponding .cpp/.h this does count as your desired keyboard shortcut?

            Thanks for listening :)

            S Offline
            S Offline
            sierdzio
            Moderators
            wrote on 23 Oct 2020, 07:57 last edited by
            #5

            @JonB said in Qt Creator - How to keep a .ui file open in Design mode, and a different file open in Edit mode?:

            I hope I'm allowed to post here just to grumble :)

            +1 no problem :-)

            I'm a great fan of Qt, but Creator is just that horrible, overused word --- "clunky" :( I do however realise that, say, MS Visual Studio probably had 1,000 people working on it with an unlimited budget, while Creator (by the looks of it) no longer has had even one person in years!

            Check QtC changelog - there's usually at least 10-20 people contributing to each release. I don't know how many people work on QtC full-time, though. My guess is 2-5 people.

            Inevitably we will swap between Design button and Edit button to go edit a code file. It drives me mad that I get put into the This file can only be edited in Design mode. Given that I'm not allowed to edit the XML, find a way of not putting me there!

            This is actually pretty easy, although a bit hidden (that's bad!). Right click on file name -> Open With -> Plain Text Editor. Voila, you can edit the XML.

            @sierdzio

            This works best if you have multiple monitors or one big one.

            When Qt comes supplied with a larger or spare monitor I will welcome your suggestion. Till then I only have my one 1920x1200.... :)

            I strongly suggest getting something bigger. 1440p or 4K monitor is a real breath of fresh air. And 2+ monitors help a lot, too. Monitors are pretty cheap these days.

            (this, of course, in no way is an excuse for Qt Creator :D Just a general recommendation)

            @chimpdude

            after finishing the modifications that were needed, I press a keyboard shortcut to go to Edit mode, where the C++ file I was editing previously is patiently waiting for me

            I don't know whether you have noticed this, but if you go Ctrl+Tab once, don't bother looking at the list of filenames, and just release, you alternate between this and the previous file. So once you have gotten going on a .ui plus its corresponding .cpp/.h this does count as your desired keyboard shortcut?

            Hey that's cool!

            (Z(:^

            J 1 Reply Last reply 23 Oct 2020, 08:26
            2
            • S sierdzio
              23 Oct 2020, 07:57

              @JonB said in Qt Creator - How to keep a .ui file open in Design mode, and a different file open in Edit mode?:

              I hope I'm allowed to post here just to grumble :)

              +1 no problem :-)

              I'm a great fan of Qt, but Creator is just that horrible, overused word --- "clunky" :( I do however realise that, say, MS Visual Studio probably had 1,000 people working on it with an unlimited budget, while Creator (by the looks of it) no longer has had even one person in years!

              Check QtC changelog - there's usually at least 10-20 people contributing to each release. I don't know how many people work on QtC full-time, though. My guess is 2-5 people.

              Inevitably we will swap between Design button and Edit button to go edit a code file. It drives me mad that I get put into the This file can only be edited in Design mode. Given that I'm not allowed to edit the XML, find a way of not putting me there!

              This is actually pretty easy, although a bit hidden (that's bad!). Right click on file name -> Open With -> Plain Text Editor. Voila, you can edit the XML.

              @sierdzio

              This works best if you have multiple monitors or one big one.

              When Qt comes supplied with a larger or spare monitor I will welcome your suggestion. Till then I only have my one 1920x1200.... :)

              I strongly suggest getting something bigger. 1440p or 4K monitor is a real breath of fresh air. And 2+ monitors help a lot, too. Monitors are pretty cheap these days.

              (this, of course, in no way is an excuse for Qt Creator :D Just a general recommendation)

              @chimpdude

              after finishing the modifications that were needed, I press a keyboard shortcut to go to Edit mode, where the C++ file I was editing previously is patiently waiting for me

              I don't know whether you have noticed this, but if you go Ctrl+Tab once, don't bother looking at the list of filenames, and just release, you alternate between this and the previous file. So once you have gotten going on a .ui plus its corresponding .cpp/.h this does count as your desired keyboard shortcut?

              Hey that's cool!

              J Online
              J Online
              JonB
              wrote on 23 Oct 2020, 08:26 last edited by JonB
              #6

              @sierdzio said in Qt Creator - How to keep a .ui file open in Design mode, and a different file open in Edit mode?:

              Check QtC changelog - there's usually at least 10-20 people contributing to each release.

              Oh I get that. But I meant: I don't see much activity on Qt Designer, any longer.

              This is actually pretty easy, although a bit hidden (that's bad!). Right click on file name -> Open With -> Plain Text Editor. Voila, you can edit the XML.

              Ooohhh! That helps a lot, thank you! The form is then blank if you go Design. Now all I want is some kind of: when in Design mode edit as Form, when in Edit mode edit as XML, without having to swap the Open with... all the time :)

              S 1 Reply Last reply 23 Oct 2020, 08:34
              0
              • J JonB
                23 Oct 2020, 08:26

                @sierdzio said in Qt Creator - How to keep a .ui file open in Design mode, and a different file open in Edit mode?:

                Check QtC changelog - there's usually at least 10-20 people contributing to each release.

                Oh I get that. But I meant: I don't see much activity on Qt Designer, any longer.

                This is actually pretty easy, although a bit hidden (that's bad!). Right click on file name -> Open With -> Plain Text Editor. Voila, you can edit the XML.

                Ooohhh! That helps a lot, thank you! The form is then blank if you go Design. Now all I want is some kind of: when in Design mode edit as Form, when in Edit mode edit as XML, without having to swap the Open with... all the time :)

                S Offline
                S Offline
                sierdzio
                Moderators
                wrote on 23 Oct 2020, 08:34 last edited by
                #7

                @JonB said in Qt Creator - How to keep a .ui file open in Design mode, and a different file open in Edit mode?:

                This is actually pretty easy, although a bit hidden (that's bad!). Right click on file name -> Open With -> Plain Text Editor. Voila, you can edit the XML.

                Ooohhh! That helps a lot, thank you! The form is then blank if you go Design. Now all I want is some kind of: when in Design mode edit as Form, when in Edit mode edit as XML, without having to swap the Open with... all the time :)

                Here, unfortunately, I have no answer :-( it annoys me as well, although not in this case (I rarely use .ui files) but for QRC files.

                (Z(:^

                1 Reply Last reply
                0

                5/7

                23 Oct 2020, 07:57

                • Login

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