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. Validators in QML
Forum Updated to NodeBB v4.3 + New Features

Validators in QML

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
13 Posts 3 Posters 2.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.
  • dheerendraD Offline
    dheerendraD Offline
    dheerendra
    Qt Champions 2022
    wrote on last edited by
    #4

    show me what are these RegExpValidator:DoubleValidator ?

    Dheerendra
    @Community Service
    Certified Qt Specialist
    http://www.pthinks.com

    S 1 Reply Last reply
    0
    • S Shubham Gupta

      I used conditional operator like this:

      validator: val===0?RegExpValidator:DoubleValidator

      But it is showing an error.

      J.HilkJ Offline
      J.HilkJ Offline
      J.Hilk
      Moderators
      wrote on last edited by J.Hilk
      #5

      @Shubham-Gupta
      you'll have to read up on the Conditional Operator

      It reqiuers 2 expression after the ? your examply only has 1

      forget everything, it's to damn early in the morning.


      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
      • S Offline
        S Offline
        Shubham Gupta
        wrote on last edited by
        #6

        What?
        I din get your words.

        Shubham Gupta

        1 Reply Last reply
        0
        • dheerendraD Offline
          dheerendraD Offline
          dheerendra
          Qt Champions 2022
          wrote on last edited by
          #7

          Please paste your code here. You need to use ternary operator. You may be doing in some mistake. Hence requested paste the code.

          Dheerendra
          @Community Service
          Certified Qt Specialist
          http://www.pthinks.com

          1 Reply Last reply
          0
          • dheerendraD dheerendra

            show me what are these RegExpValidator:DoubleValidator ?

            S Offline
            S Offline
            Shubham Gupta
            wrote on last edited by
            #8

            @dheerendra

            validator: val===0?DoubleValidator{
                            top: top_value
                            bottom:bottom_value}
                         : RegExpValidator{regExp: ""}
            

            I am trying to make regular exp for accepting time(mm:ss).
            But its showing an error.

            Shubham Gupta

            1 Reply Last reply
            0
            • dheerendraD Offline
              dheerendraD Offline
              dheerendra
              Qt Champions 2022
              wrote on last edited by
              #9

              what is the error ?

              Dheerendra
              @Community Service
              Certified Qt Specialist
              http://www.pthinks.com

              1 Reply Last reply
              0
              • S Offline
                S Offline
                Shubham Gupta
                wrote on last edited by
                #10

                @dheerendra

                Hi dheerendra
                In qml there are three validators

                1. IntValidator
                2. DoubleValidator
                3. RegExpValidator

                If i want to store text like 2:30 (mm:ss). So which validator will work.
                If RegExpValidor is used, so what will be the regular expression for this syntax (mm:ss).

                Shubham Gupta

                1 Reply Last reply
                0
                • dheerendraD Offline
                  dheerendraD Offline
                  dheerendra
                  Qt Champions 2022
                  wrote on last edited by
                  #11

                  Use RegExpValidator. Did you check the google for regular expression for mm:ss ? It should help.

                  Dheerendra
                  @Community Service
                  Certified Qt Specialist
                  http://www.pthinks.com

                  S 1 Reply Last reply
                  0
                  • dheerendraD dheerendra

                    Use RegExpValidator. Did you check the google for regular expression for mm:ss ? It should help.

                    S Offline
                    S Offline
                    Shubham Gupta
                    wrote on last edited by
                    #12

                    @dheerendra

                    solved.
                    thanks

                    Shubham Gupta

                    1 Reply Last reply
                    0
                    • dheerendraD Offline
                      dheerendraD Offline
                      dheerendra
                      Qt Champions 2022
                      wrote on last edited by
                      #13

                      Good. Move the case to "Solved" state. It helps others as well.

                      Dheerendra
                      @Community Service
                      Certified Qt Specialist
                      http://www.pthinks.com

                      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