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. I'm back with a GPU.. Qt Creator still not working
Forum Update on Monday, May 27th 2025

I'm back with a GPU.. Qt Creator still not working

Scheduled Pinned Locked Moved Unsolved Qt Creator and other tools
144 Posts 7 Posters 39.3k 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.
  • M Mlibu
    23 Mar 2024, 11:49

    @Mlibu Ok well I thought I had figured it out with this forum comment:

    https://forum.qt.io/topic/148745/cannot-connect-to-qml-emulation-layer-qml-puppet

    So I thought I needed to change the 'qml emulation layer' to the directory that holds qml2puppet which I found under QtQuickDesigner directory. But that didn't work either.

    I also tried the puppet in /usr/share/qtcreator/qml/qmlpuppet/qml2puppet and that didn't work either.

    I think I need to resign myself to the fact that there is no possible combination under which this will work for me. I have exhausted every measure I can find. I will either do QML by hand or use Design Studio.

    It's a funny thing this problem. There are a few comments out there that Qt Creator is a piece of sh%t and they can't get it to work and they are just going to use something other than Qt and they basically have the same problems I have. Then there is a youtube video of someone having it work fine from 2023. I don't know how this all adds up, but this is taking time from other important work that I have.

    I did ./QtDesignStudio/qt6_design_studio_reduced_version/bin/qml2puppet-4.4.0 --test

    It looks fine. All libraries there and loaded.

    After this I also tried to remove build directories and start a new project but it still doesn't work. There are just so many conflicting comments and instructions I don't know what to do any more.

    Please, please.. if anyone can figure out what my problem may be, I would love to hear the answer. But I have had to put way too much time into this.

    I'm going to tuck my tail between my legs and go back to Manjaro KDE now. I'll leave a small partition to test other OSes with if anyone has any other ideas.

    R Offline
    R Offline
    Ronel_qtmaster
    wrote on 23 Mar 2024, 13:27 last edited by
    #129

    @Mlibu what if you download and install design studio apart from Qt?

    M 1 Reply Last reply 23 Mar 2024, 14:22
    0
    • R Ronel_qtmaster
      23 Mar 2024, 13:27

      @Mlibu what if you download and install design studio apart from Qt?

      M Offline
      M Offline
      Mlibu
      wrote on 23 Mar 2024, 14:22 last edited by
      #130

      @Ronel_qtmaster Yes design studio works but I wanted the designer in qt creator rather than design studio.

      R 1 Reply Last reply 23 Mar 2024, 15:13
      0
      • M Mlibu
        23 Mar 2024, 14:22

        @Ronel_qtmaster Yes design studio works but I wanted the designer in qt creator rather than design studio.

        R Offline
        R Offline
        Ronel_qtmaster
        wrote on 23 Mar 2024, 15:13 last edited by
        #131

        @Mlibu in qt6 design studio is the official designer for qml

        M 1 Reply Last reply 23 Mar 2024, 15:32
        1
        • R Ronel_qtmaster
          23 Mar 2024, 15:13

          @Mlibu in qt6 design studio is the official designer for qml

          M Offline
          M Offline
          Mlibu
          wrote on 23 Mar 2024, 15:32 last edited by
          #132

          @Ronel_qtmaster I was under the impression that qt creator was better for integrating with C++ and design studio was more for standalone QML.

          T 1 Reply Last reply 24 Mar 2024, 16:34
          0
          • M Mlibu
            23 Mar 2024, 15:32

            @Ronel_qtmaster I was under the impression that qt creator was better for integrating with C++ and design studio was more for standalone QML.

            T Offline
            T Offline
            Tink
            wrote on 24 Mar 2024, 16:34 last edited by
            #133

            @Mlibu said in I'm back with a GPU.. Qt Creator still not working:

            @Ronel_qtmaster I was under the impression that qt creator was better for integrating with C++ and design studio was more for standalone QML.

            Create a qt quick project in qtcreator. Open it in qt design studio for visual editing and qml coding. Learn what makes sense to do with qml and javascript and when to use c++. It is designed to work together.

            It's all in the documentation.

            M 1 Reply Last reply 24 Mar 2024, 20:01
            1
            • T Tink
              24 Mar 2024, 16:34

              @Mlibu said in I'm back with a GPU.. Qt Creator still not working:

              @Ronel_qtmaster I was under the impression that qt creator was better for integrating with C++ and design studio was more for standalone QML.

              Create a qt quick project in qtcreator. Open it in qt design studio for visual editing and qml coding. Learn what makes sense to do with qml and javascript and when to use c++. It is designed to work together.

              It's all in the documentation.

              M Offline
              M Offline
              Mlibu
              wrote on 24 Mar 2024, 20:01 last edited by
              #134

              @Tink So just ignore the fact that qt themselves say that design studio is for people who just work with qt and don't use developer tools?

              If you only design UIs and don't neeIf you only design UIs and don't need the developer tools, you can install the stand-alone Qt Design Studio package. It contains all the Qt modules and tools you need to design UIs and preview them on the desktop. The Qt Quick code is automatically generated for you, and you can deliver it to developers for implementing the application. Developers can open the project in a developer tool called Qt Creator.d the developer tools, you can install the stand-alone Qt Design Studio package. It contains all the Qt modules and tools you need to design UIs and preview them on the desktop. The Qt Quick code is automatically generated for you, and you can deliver it to developers for implementing the application. Developers can open the project in a developer tool called Qt Creator.

              Also if there is a place in the documentation where they explain how to work with qml exported from design stidio? I see the robot arm tutorial and it says how to export but not how to interact with the code from c++. I know how to export c++ objects to the qml engine but i have never seen an end to end example of the whole thing. Whereas there are examples of how to do it with qt Creator.

              T 1 Reply Last reply 24 Mar 2024, 22:14
              0
              • M Mlibu
                24 Mar 2024, 20:01

                @Tink So just ignore the fact that qt themselves say that design studio is for people who just work with qt and don't use developer tools?

                If you only design UIs and don't neeIf you only design UIs and don't need the developer tools, you can install the stand-alone Qt Design Studio package. It contains all the Qt modules and tools you need to design UIs and preview them on the desktop. The Qt Quick code is automatically generated for you, and you can deliver it to developers for implementing the application. Developers can open the project in a developer tool called Qt Creator.d the developer tools, you can install the stand-alone Qt Design Studio package. It contains all the Qt modules and tools you need to design UIs and preview them on the desktop. The Qt Quick code is automatically generated for you, and you can deliver it to developers for implementing the application. Developers can open the project in a developer tool called Qt Creator.

                Also if there is a place in the documentation where they explain how to work with qml exported from design stidio? I see the robot arm tutorial and it says how to export but not how to interact with the code from c++. I know how to export c++ objects to the qml engine but i have never seen an end to end example of the whole thing. Whereas there are examples of how to do it with qt Creator.

                T Offline
                T Offline
                Tink
                wrote on 24 Mar 2024, 22:14 last edited by
                #135

                @Mlibu said in I'm back with a GPU.. Qt Creator still not working:

                @Tink So just ignore the fact that qt themselves say that design studio is for people who just work with qt and don't use developer tools?

                If you only design UIs and don't neeIf you only design UIs and don't need the developer tools, you can install the stand-alone Qt Design Studio package. It contains all the Qt modules and tools you need to design UIs and preview them on the desktop. The Qt Quick code is automatically generated for you, and you can deliver it to developers for implementing the application. Developers can open the project in a developer tool called Qt Creator.d the developer tools, you can install the stand-alone Qt Design Studio package. It contains all the Qt modules and tools you need to design UIs and preview them on the desktop. The Qt Quick code is automatically generated for you, and you can deliver it to developers for implementing the application. Developers can open the project in a developer tool called Qt Creator.

                Also if there is a place in the documentation where they explain how to work with qml exported from design stidio? I see the robot arm tutorial and it says how to export but not how to interact with the code from c++. I know how to export c++ objects to the qml engine but i have never seen an end to end example of the whole thing. Whereas there are examples of how to do it with qt Creator.

                I'm not sure what you mean by: " So just ignore the fact that qt themselves say that design studio is for people who just work with qt and don't use developer tools?" Do you have a source? Perhaps you mean that qml ui design is more aimed at designers?

                As for the other questions i'm not going to do your research for you. Just study the qtcreator and design studio manual and qml documentation.

                M 1 Reply Last reply 25 Mar 2024, 10:25
                0
                • T Tink
                  24 Mar 2024, 22:14

                  @Mlibu said in I'm back with a GPU.. Qt Creator still not working:

                  @Tink So just ignore the fact that qt themselves say that design studio is for people who just work with qt and don't use developer tools?

                  If you only design UIs and don't neeIf you only design UIs and don't need the developer tools, you can install the stand-alone Qt Design Studio package. It contains all the Qt modules and tools you need to design UIs and preview them on the desktop. The Qt Quick code is automatically generated for you, and you can deliver it to developers for implementing the application. Developers can open the project in a developer tool called Qt Creator.d the developer tools, you can install the stand-alone Qt Design Studio package. It contains all the Qt modules and tools you need to design UIs and preview them on the desktop. The Qt Quick code is automatically generated for you, and you can deliver it to developers for implementing the application. Developers can open the project in a developer tool called Qt Creator.

                  Also if there is a place in the documentation where they explain how to work with qml exported from design stidio? I see the robot arm tutorial and it says how to export but not how to interact with the code from c++. I know how to export c++ objects to the qml engine but i have never seen an end to end example of the whole thing. Whereas there are examples of how to do it with qt Creator.

                  I'm not sure what you mean by: " So just ignore the fact that qt themselves say that design studio is for people who just work with qt and don't use developer tools?" Do you have a source? Perhaps you mean that qml ui design is more aimed at designers?

                  As for the other questions i'm not going to do your research for you. Just study the qtcreator and design studio manual and qml documentation.

                  M Offline
                  M Offline
                  Mlibu
                  wrote on 25 Mar 2024, 10:25 last edited by Mlibu
                  #136

                  @Tink I pasted the source. "If you only design UIs and don't need the developer tools, you can install the stand-alone Qt Design Studio package".

                  They say that Design Studio is only for people who don't need developer tools. I need developer tools. For example, if Design Studio doesn't know about C++ and Creator doesn't know about QML, how can they make a signal/slot from one to the other? How can you with with a C++ object that you register into the engine?

                  I searched on this and found a SO question about it and the answer is that Design Studio is just for UI design. I tried to go to the document that they refer to but it is a 404.

                  https://stackoverflow.com/questions/74696198/how-can-i-connect-functions-on-an-hpp-and-cpp-file-into-qt-design-studio

                  This is why I thought it would be best to get Qt Creator working.

                  I'm not sure how I should "research" this. I have already searched the Qt Documents and youtube for tutorials. It seems that the Qt docs either talk about Qt Creator or Qt Design Studio. It says "design studio closes the designer to developer gap" a lot but there are no examples of actually doing so and it seems you have to look at their projects. Even on youtube there is only one video that encompasses QML design and C++ on the same project. I even searched Udemy for a course but mostly everything is Qt5. I'm used to open source stuff having a lot more information available with a lot of people making videos and a lot of step by step tutorials. It's kind of the spirit that you not have to pay for courses in order to learn it.

                  T 1 Reply Last reply 25 Mar 2024, 11:55
                  0
                  • M Mlibu
                    25 Mar 2024, 10:25

                    @Tink I pasted the source. "If you only design UIs and don't need the developer tools, you can install the stand-alone Qt Design Studio package".

                    They say that Design Studio is only for people who don't need developer tools. I need developer tools. For example, if Design Studio doesn't know about C++ and Creator doesn't know about QML, how can they make a signal/slot from one to the other? How can you with with a C++ object that you register into the engine?

                    I searched on this and found a SO question about it and the answer is that Design Studio is just for UI design. I tried to go to the document that they refer to but it is a 404.

                    https://stackoverflow.com/questions/74696198/how-can-i-connect-functions-on-an-hpp-and-cpp-file-into-qt-design-studio

                    This is why I thought it would be best to get Qt Creator working.

                    I'm not sure how I should "research" this. I have already searched the Qt Documents and youtube for tutorials. It seems that the Qt docs either talk about Qt Creator or Qt Design Studio. It says "design studio closes the designer to developer gap" a lot but there are no examples of actually doing so and it seems you have to look at their projects. Even on youtube there is only one video that encompasses QML design and C++ on the same project. I even searched Udemy for a course but mostly everything is Qt5. I'm used to open source stuff having a lot more information available with a lot of people making videos and a lot of step by step tutorials. It's kind of the spirit that you not have to pay for courses in order to learn it.

                    T Offline
                    T Offline
                    Tink
                    wrote on 25 Mar 2024, 11:55 last edited by
                    #137

                    @Mlibu said in I'm back with a GPU.. Qt Creator still not working:

                    @Tink I pasted the source. "If you only design UIs and don't need the developer tools, you can install the stand-alone Qt Design Studio package".

                    They say that Design Studio is only for people who don't need developer tools. I need developer tools. For example, if Design Studio doesn't know about C++ and Creator doesn't know about QML, how can they make a signal/slot from one to the other? How can you with with a C++ object that you register into the engine?

                    I searched on this and found a SO question about it and the answer is that Design Studio is just for UI design. I tried to go to the document that they refer to but it is a 404.

                    https://stackoverflow.com/questions/74696198/how-can-i-connect-functions-on-an-hpp-and-cpp-file-into-qt-design-studio

                    This is why I thought it would be best to get Qt Creator working.

                    I'm not sure how I should "research" this. I have already searched the Qt Documents and youtube for tutorials. It seems that the Qt docs either talk about Qt Creator or Qt Design Studio. It says "design studio closes the designer to developer gap" a lot but there are no examples of actually doing so and it seems you have to look at their projects. Even on youtube there is only one video that encompasses QML design and C++ on the same project. I even searched Udemy for a course but mostly everything is Qt5. I'm used to open source stuff having a lot more information available with a lot of people making videos and a lot of step by step tutorials. It's kind of the spirit that you not have to pay for courses in order to learn it.

                    So your source is a SO post from someone who is just as confused as you are and then you interpret the answer incorrectly... well let me also give you a source and lets see how you interpret that:

                    https://doc.qt.io/qt-6/qtquick-tools-and-utilities.html
                    https://doc.qt.io/qt-6/qtquick-codesamples.html#developing-qt-quick-applications

                    M 1 Reply Last reply 25 Mar 2024, 13:05
                    0
                    • T Tink
                      25 Mar 2024, 11:55

                      @Mlibu said in I'm back with a GPU.. Qt Creator still not working:

                      @Tink I pasted the source. "If you only design UIs and don't need the developer tools, you can install the stand-alone Qt Design Studio package".

                      They say that Design Studio is only for people who don't need developer tools. I need developer tools. For example, if Design Studio doesn't know about C++ and Creator doesn't know about QML, how can they make a signal/slot from one to the other? How can you with with a C++ object that you register into the engine?

                      I searched on this and found a SO question about it and the answer is that Design Studio is just for UI design. I tried to go to the document that they refer to but it is a 404.

                      https://stackoverflow.com/questions/74696198/how-can-i-connect-functions-on-an-hpp-and-cpp-file-into-qt-design-studio

                      This is why I thought it would be best to get Qt Creator working.

                      I'm not sure how I should "research" this. I have already searched the Qt Documents and youtube for tutorials. It seems that the Qt docs either talk about Qt Creator or Qt Design Studio. It says "design studio closes the designer to developer gap" a lot but there are no examples of actually doing so and it seems you have to look at their projects. Even on youtube there is only one video that encompasses QML design and C++ on the same project. I even searched Udemy for a course but mostly everything is Qt5. I'm used to open source stuff having a lot more information available with a lot of people making videos and a lot of step by step tutorials. It's kind of the spirit that you not have to pay for courses in order to learn it.

                      So your source is a SO post from someone who is just as confused as you are and then you interpret the answer incorrectly... well let me also give you a source and lets see how you interpret that:

                      https://doc.qt.io/qt-6/qtquick-tools-and-utilities.html
                      https://doc.qt.io/qt-6/qtquick-codesamples.html#developing-qt-quick-applications

                      M Offline
                      M Offline
                      Mlibu
                      wrote on 25 Mar 2024, 13:05 last edited by Mlibu
                      #138

                      @Tink
                      I thought this was what I was looking for:

                      https://doc.qt.io/qt-6/qtdoc-tutorials-alarms-example.html

                      But that uses Qt Creator so it is out of date.

                      A link I found off of your second link is close

                      https://doc.qt.io/qt-6/qtqml-tutorials-extending-qml-advanced-example.html

                      But it doesn't talk about the ui.qml files that Design Studio makes either, only a regular QML file. It's ok I will fill in the blanks as I go.

                      T 1 Reply Last reply 25 Mar 2024, 14:38
                      0
                      • M Mlibu
                        25 Mar 2024, 13:05

                        @Tink
                        I thought this was what I was looking for:

                        https://doc.qt.io/qt-6/qtdoc-tutorials-alarms-example.html

                        But that uses Qt Creator so it is out of date.

                        A link I found off of your second link is close

                        https://doc.qt.io/qt-6/qtqml-tutorials-extending-qml-advanced-example.html

                        But it doesn't talk about the ui.qml files that Design Studio makes either, only a regular QML file. It's ok I will fill in the blanks as I go.

                        T Offline
                        T Offline
                        Tink
                        wrote on 25 Mar 2024, 14:38 last edited by
                        #139

                        @Mlibu said in I'm back with a GPU.. Qt Creator still not working:

                        @Tink
                        I thought this was what I was looking for:

                        https://doc.qt.io/qt-6/qtdoc-tutorials-alarms-example.html

                        But that uses Qt Creator so it is out of date.

                        A link I found off of your second link is close

                        https://doc.qt.io/qt-6/qtqml-tutorials-extending-qml-advanced-example.html

                        But it doesn't talk about the ui.qml files that Design Studio makes either, only a regular QML file. It's ok I will fill in the blanks as I go.

                        It's not out of date if it uses creator. In fact that is what you want for application development instead of ui design only. Since you have problems with the quick designer plugin and the recommended tool is design studio anyways, you want to use both creator and design studio. Good luck and have fun.

                        https://doc.qt.io/qtcreator/creator-visual-editor.html

                        M 1 Reply Last reply 25 Mar 2024, 14:44
                        0
                        • T Tink
                          25 Mar 2024, 14:38

                          @Mlibu said in I'm back with a GPU.. Qt Creator still not working:

                          @Tink
                          I thought this was what I was looking for:

                          https://doc.qt.io/qt-6/qtdoc-tutorials-alarms-example.html

                          But that uses Qt Creator so it is out of date.

                          A link I found off of your second link is close

                          https://doc.qt.io/qt-6/qtqml-tutorials-extending-qml-advanced-example.html

                          But it doesn't talk about the ui.qml files that Design Studio makes either, only a regular QML file. It's ok I will fill in the blanks as I go.

                          It's not out of date if it uses creator. In fact that is what you want for application development instead of ui design only. Since you have problems with the quick designer plugin and the recommended tool is design studio anyways, you want to use both creator and design studio. Good luck and have fun.

                          https://doc.qt.io/qtcreator/creator-visual-editor.html

                          M Offline
                          M Offline
                          Mlibu
                          wrote on 25 Mar 2024, 14:44 last edited by Mlibu
                          #140

                          @Tink Ok but the whole point to starting this thread is to find out how to use the plugin. From what you just said, creator is different so Design Studio is not an alternative. I have tried the plugin on OSes officially supported by Qt and they don't work so what can I try next?

                          T 1 Reply Last reply 25 Mar 2024, 16:24
                          0
                          • M Mlibu
                            25 Mar 2024, 14:44

                            @Tink Ok but the whole point to starting this thread is to find out how to use the plugin. From what you just said, creator is different so Design Studio is not an alternative. I have tried the plugin on OSes officially supported by Qt and they don't work so what can I try next?

                            T Offline
                            T Offline
                            Tink
                            wrote on 25 Mar 2024, 16:24 last edited by
                            #141

                            @Mlibu said in I'm back with a GPU.. Qt Creator still not working:

                            @Tink Ok but the whole point to starting this thread is to find out how to use the plugin. From what you just said, creator is different so Design Studio is not an alternative. I have tried the plugin on OSes officially supported by Qt and they don't work so what can I try next?

                            You cannot use the plugin, it give you crashes. Luckily you can use design studio not only as an alternative but as the default recommended tool. Of course you also need to use q tcreator. You must use both tools. Good luck and have fun.

                            M 1 Reply Last reply 26 Mar 2024, 11:00
                            0
                            • T Tink
                              25 Mar 2024, 16:24

                              @Mlibu said in I'm back with a GPU.. Qt Creator still not working:

                              @Tink Ok but the whole point to starting this thread is to find out how to use the plugin. From what you just said, creator is different so Design Studio is not an alternative. I have tried the plugin on OSes officially supported by Qt and they don't work so what can I try next?

                              You cannot use the plugin, it give you crashes. Luckily you can use design studio not only as an alternative but as the default recommended tool. Of course you also need to use q tcreator. You must use both tools. Good luck and have fun.

                              M Offline
                              M Offline
                              Mlibu
                              wrote on 26 Mar 2024, 11:00 last edited by Mlibu
                              #142

                              @Tink I guess I'm just surprised that for something that has obviously had an enormous amount of energy put into it and is so polished in so many areas, no one knows how to get this working. There must be some requirement that is not documented or something, and if I knew what that was I would get a system that could run it. Or maybe just replace a CPU. I thought that the kernel and OS was generally supposed to abstract differences in hardware, and my card should be supported and there is no 3d acceleration required here anyway. I've never encountered a problem where I couldn't get something to work like this before, save for things that were no longer under active support.

                              M 1 Reply Last reply 3 Apr 2024, 13:53
                              0
                              • M Mlibu
                                26 Mar 2024, 11:00

                                @Tink I guess I'm just surprised that for something that has obviously had an enormous amount of energy put into it and is so polished in so many areas, no one knows how to get this working. There must be some requirement that is not documented or something, and if I knew what that was I would get a system that could run it. Or maybe just replace a CPU. I thought that the kernel and OS was generally supposed to abstract differences in hardware, and my card should be supported and there is no 3d acceleration required here anyway. I've never encountered a problem where I couldn't get something to work like this before, save for things that were no longer under active support.

                                M Offline
                                M Offline
                                Momo007
                                wrote on 3 Apr 2024, 13:53 last edited by
                                #143

                                @Mlibu , You are so right. I have created applications just using the Qtcreator tool and python before . Now Qtcreator is just so buggy. If the plugin is there and is used quite prominently. It should work properly, at least for the new project that Qt itself creates , with default settings.

                                Design Studio doesn't solve my problem as well, I can't use it as a replacement for Qt creator. I need to be able to design and code the app .

                                M 1 Reply Last reply 4 Apr 2024, 15:06
                                0
                                • M Momo007
                                  3 Apr 2024, 13:53

                                  @Mlibu , You are so right. I have created applications just using the Qtcreator tool and python before . Now Qtcreator is just so buggy. If the plugin is there and is used quite prominently. It should work properly, at least for the new project that Qt itself creates , with default settings.

                                  Design Studio doesn't solve my problem as well, I can't use it as a replacement for Qt creator. I need to be able to design and code the app .

                                  M Offline
                                  M Offline
                                  Mlibu
                                  wrote on 4 Apr 2024, 15:06 last edited by Mlibu 4 Apr 2024, 15:51
                                  #144

                                  @Momo007 I figured out how to add the function in Qt Design Studio. I will explain it for anyone else who ends up here. Apologies in advance if any of this is wrong or bad practice, but there was nothing else to go by.

                                  Say your ui file is Main.ui.qml and it has a button, and you want to trigger a function with the onClick.

                                  Now you need to switch things around because you want this:

                                  MainForm.ui.qml = UI code
                                  Main.qml = Override with anything that can't go in the ui file

                                  Technically the 'MainForm' name can be anything you want except for 'Main' so long as it is referenced by Main, but I think it is a good naming standard for clarity. So the first step is to rename your Main.ui.qml file to MainForm.ui.qml.

                                  Now you need to create a QML file that will hold all your logic. I couldn't find a way to create a blank QML file in desginer really. I suppose I could have gone into the terminal and touched the file. What I did was just use File->New File..->QML Files->listModel. Name it Main.qml. Then when the component editor comes up just delete all the code keeping in mind to leave the import or add any others you need, and add:

                                  MainForm {
                                  id: mainRoot
                                  }
                                  

                                  Inside this object is where you put all your functions and any other things that go with the functionality of the UI. Note that you are instantiating the form component with all the real QML and anything you add to here will override that component. Moving along...

                                  Now you need to manually add the onClick handler and the function.

                                  So add the function to your Main component:

                                  MainForm {
                                      id: formMainRoot
                                  
                                      function handleClicked() {
                                          console.log("HANDLE CLICKED");
                                      }
                                  }
                                  

                                  After I added the function I did not see it in the 'Connections' selection for the button until after I manually edited the button with it, though it may have appeared with time. It did appear after I made the setting in the code, don't know what magic happens in the background.

                                  So you also need to modify the handler in the button manually as below:

                                  Button {
                                          id: button
                                          text: qsTr("Button")
                                  
                                          Connections {
                                              target: button
                                              onClicked: formMainRoot.handleClicked()
                                          }
                                      }
                                  

                                  This worked for me in the executed version.

                                  My preferred way to do it though will be switched up, because it keeps all the manual editing out of the UI file which is the main intent, I think. To do it this way you need to make the button visible to the parent Main component which will allow it to modify the button.

                                  Select your button in the 2D editor and click on the @ to the right of the id field. This will create an alias at the top of the component, thus making the button visible. I found that I had to do this through the UI rather than adding the alias code or the compile wouldn't work.

                                  Now instead of modifying the MainForm file, just put it all in the Main component:

                                  MainForm {
                                      id: formMainRoot
                                  
                                      function handleClicked() {
                                          console.log("HANDLE CLICKED");
                                      }
                                  
                                      Connections {
                                          target: button
                                          onClicked: handleClicked()
                                      }
                                  }
                                  

                                  I hope this unconfuses some people. I pieced this together through many bits I found on the internet. I do not know why this is not explained anywhere. Obviously you could adapt this to do basically anything you wanted.

                                  It's quite a nice way to separate things, but at a cost of having to flip between two files all the time as well as flipping from 2D to code tabs, to get essentially one thing done.

                                  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