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 use checkbox in wizard.json for template design

How to use checkbox in wizard.json for template design

Scheduled Pinned Locked Moved Solved QML and Qt Quick
2 Posts 1 Posters 463 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.
  • N Offline
    N Offline
    nitinp
    wrote on last edited by nitinp
    #1

    Hi All,

    I'm designing a template, in which I want to include checkbox and based on the status of that checkbox I want to do something. So below are some codes which I tried,

    Below is checkbox code

    {
    	"name": "UnitTest",
    	"trDisplayName": "Unit Test",
    	"type": "CheckBox",
    	"data":
    	{
    		"checkedValue": "Test",
    		"checked": "%{JS: ('%{TestCB}' === 'Test')? 'yes':''}",
    		"uncheckedValue": ""
    	}
    },
    

    Now, If I dont checked the box then it should not create the file,

    "generators":
        [
            {
                "typeId": "File",
                "data":
                [
    	       {
    		    "conditions": "%{JS: '%{checked}' === 'yes'}",
                        "source": "../UnitTest/file.pro",
                        "target": "%{ProFileNameUT}",
                        "openAsProject": true
                    }
    	     ]
             }
         ]
    

    So can some one help me what "conditions" I have to put so that it'll not generate file if box is not checked ?

    Thanking you all,

    With Regards,
    Nitin P.

    1 Reply Last reply
    0
    • N Offline
      N Offline
      nitinp
      wrote on last edited by
      #2

      Re: How to use checkbox in wizard.json for template design

      Hello Guys,
      I got the solution, so I think to put reply which may be helpful for others too.
      If you compare the codes with above you'll find the changes.

      {
      	"name": "UnitTest",
      	"trDisplayName": "Unit Test",
      	"type": "CheckBox",
      	"data":
      	{
      		"checked": false
      	}
      },
      
      "generators":
          [
              {
                  "typeId": "File",
                  "data":
                  [
      	       {
      		    "condition": "%{UnitTest}",
                          "source": "../UnitTest/file.pro",
                          "target": "%{ProFileNameUT}",
                          "openAsProject": true
                      }
      	     ]
               }
           ]
      

      Hope that help someone.

      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