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 537 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 last edited by Mlibu
    #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.

    Ronel_qtmasterR 1 Reply Last reply
    0
    • M Mlibu

      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.

      Ronel_qtmasterR Offline
      Ronel_qtmasterR Offline
      Ronel_qtmaster
      wrote on 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
      0
      • Ronel_qtmasterR Ronel_qtmaster

        @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 last edited by Mlibu
        #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.

        Ronel_qtmasterR 1 Reply Last reply
        0
        • M Mlibu

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

          Ronel_qtmasterR Offline
          Ronel_qtmasterR Offline
          Ronel_qtmaster
          wrote on 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
          0
          • Ronel_qtmasterR Ronel_qtmaster

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

            • Login

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