Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. How to create functions with Qt Design Studio?
Forum Updated to NodeBB v4.3 + New Features

How to create functions with Qt Design Studio?

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
5 Posts 2 Posters 531 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 Offline
    M Offline
    Mlibu
    wrote on 2 Apr 2024, 20:06 last edited by Mlibu 4 Feb 2024, 20:35
    #1

    I have a page with a Flow Positioner and two buttons 'add' and 'remove'. When I click on 'Add' I would like a Rectangle (for now) to be added to the flow. When I click on 'remove' I want it to loop through the children in the flow and have it return a specific one but for now let's say it's the last one.

    How do I do this in Qt Designer? It won't let me put a standalone function in the ui.qml file. It has an option to select a 'run function' event but if I can't create a function I cannot select it. I know the logic of the QML is supposed to be in a QML file rather than a UI.QML file but Designer is not creating regular QML files. I could create a QML file myself but don't know where in the dir structure it is supposed to go. Nor do I really want it in a separate file because I don't consider this 'business logic' I consider this 'UI logic'.

    Apparently I am totally missing how this is supposed to work. Please help, thanks.

    R 1 Reply Last reply 2 Apr 2024, 20:24
    0
    • M Mlibu
      2 Apr 2024, 20:06

      I have a page with a Flow Positioner and two buttons 'add' and 'remove'. When I click on 'Add' I would like a Rectangle (for now) to be added to the flow. When I click on 'remove' I want it to loop through the children in the flow and have it return a specific one but for now let's say it's the last one.

      How do I do this in Qt Designer? It won't let me put a standalone function in the ui.qml file. It has an option to select a 'run function' event but if I can't create a function I cannot select it. I know the logic of the QML is supposed to be in a QML file rather than a UI.QML file but Designer is not creating regular QML files. I could create a QML file myself but don't know where in the dir structure it is supposed to go. Nor do I really want it in a separate file because I don't consider this 'business logic' I consider this 'UI logic'.

      Apparently I am totally missing how this is supposed to work. Please help, thanks.

      R Offline
      R Offline
      Ronel_qtmaster
      wrote on 2 Apr 2024, 20:24 last edited by
      #2

      @Mlibu when you are in the designer tab , do a right click in the scene at the center, then click on Go to implementation

      M 1 Reply Last reply 2 Apr 2024, 20:28
      0
      • R Ronel_qtmaster
        2 Apr 2024, 20:24

        @Mlibu when you are in the designer tab , do a right click in the scene at the center, then click on Go to implementation

        M Offline
        M Offline
        Mlibu
        wrote on 2 Apr 2024, 20:28 last edited by Mlibu 4 Feb 2024, 20:36
        #3

        @Ronel_qtmaster Do you mean "Jump to the code"?

        That just puts me in the UI.QML file which won't let me create a standalone function. And there is no "Designer Tab". There is a 2D tab.

        I'm not in creator because I can't get it to work so I was told to use Design Studio in lieu of. I get an error "Functions are not supported in a UI file".

        Sorry just noticed I made the wrong subject. It should say "How to create functions with Qt Design Studio". I fixed the subject line.

        R 1 Reply Last reply 2 Apr 2024, 20:44
        0
        • M Mlibu
          2 Apr 2024, 20:28

          @Ronel_qtmaster Do you mean "Jump to the code"?

          That just puts me in the UI.QML file which won't let me create a standalone function. And there is no "Designer Tab". There is a 2D tab.

          I'm not in creator because I can't get it to work so I was told to use Design Studio in lieu of. I get an error "Functions are not supported in a UI file".

          Sorry just noticed I made the wrong subject. It should say "How to create functions with Qt Design Studio". I fixed the subject line.

          R Offline
          R Offline
          Ronel_qtmaster
          wrote on 2 Apr 2024, 20:44 last edited by
          #4

          @Mlibu normally qt design studio is for designing ui only.So you design your UI in design studio and add code in Qt creator.Qt6 even gives you the possibility to create a project that is compatible with Qt Design studio.

          M 1 Reply Last reply 2 Apr 2024, 21:01
          0
          • R Ronel_qtmaster
            2 Apr 2024, 20:44

            @Mlibu normally qt design studio is for designing ui only.So you design your UI in design studio and add code in Qt creator.Qt6 even gives you the possibility to create a project that is compatible with Qt Design studio.

            M Offline
            M Offline
            Mlibu
            wrote on 2 Apr 2024, 21:01 last edited by
            #5

            @Ronel_qtmaster So I can open the project in Qt Creator, add the code, then go back to Qt Design Studio and it won't give me the error? Very awkward.

            1 Reply Last reply
            0

            1/5

            2 Apr 2024, 20:06

            • Login

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