Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for Python
  4. How to user input an infinity value to a QSpinBox?
Forum Updated to NodeBB v4.3 + New Features

How to user input an infinity value to a QSpinBox?

Scheduled Pinned Locked Moved Unsolved Qt for Python
10 Posts 5 Posters 4.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.
  • Y Offline
    Y Offline
    yashi95
    wrote on last edited by
    #1

    hello,
    I don't want to restrict the spin Box in pyside2 using QtDesginer.
    Is it possible in qt?

    J.HilkJ 1 Reply Last reply
    0
    • Y yashi95

      hello,
      I don't want to restrict the spin Box in pyside2 using QtDesginer.
      Is it possible in qt?

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

      @yashi95 that depends, do you want to allow one less than infinity or one more? And what value should that internally represent ? as int32/64 ?


      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.

      jsulmJ 1 Reply Last reply
      1
      • J.HilkJ J.Hilk

        @yashi95 that depends, do you want to allow one less than infinity or one more? And what value should that internally represent ? as int32/64 ?

        jsulmJ Offline
        jsulmJ Offline
        jsulm
        Lifetime Qt Champion
        wrote on last edited by
        #3

        @J-Hilk said in How to user input an infinity value to a QSpinBox?:

        one less than infinity or one more?

        :-)

        https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        1
        • Y Offline
          Y Offline
          yashi95
          wrote on last edited by yashi95
          #4

          I didn't get the meaning of "one less than infinity or one more?" I want to display 1000 means int32.
          Just I don't want to restrict with any number, it will take 1 to any number.
          I tried in QtDesigner but it will allow a maximum value of 1000000000 till this.

          J.HilkJ 1 Reply Last reply
          0
          • Y yashi95

            I didn't get the meaning of "one less than infinity or one more?" I want to display 1000 means int32.
            Just I don't want to restrict with any number, it will take 1 to any number.
            I tried in QtDesigner but it will allow a maximum value of 1000000000 till this.

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

            @yashi95 I mean, you may get your Spinbox display to show ∞ instead of a number, but you're and always will be limited to the minimum of an int32_t and the maximum of int 32_t

            -> -2147483648 and 2147483647


            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.

            Y 1 Reply Last reply
            0
            • J.HilkJ J.Hilk

              @yashi95 I mean, you may get your Spinbox display to show ∞ instead of a number, but you're and always will be limited to the minimum of an int32_t and the maximum of int 32_t

              -> -2147483648 and 2147483647

              Y Offline
              Y Offline
              yashi95
              wrote on last edited by
              #6

              @J-Hilk As you told to set values -2147483648 and 2147483647. But in qt is not possible it seems.

              7059ea72-1a4a-44b6-b35d-a2f5bb279a64-image.png

              J.HilkJ U 2 Replies Last reply
              0
              • Y yashi95

                @J-Hilk As you told to set values -2147483648 and 2147483647. But in qt is not possible it seems.

                7059ea72-1a4a-44b6-b35d-a2f5bb279a64-image.png

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

                @yashi95 I don't use the designer, I'm going of the documentation
                https://doc.qt.io/qt-5/qspinbox.html#maximum-prop

                that says, the min/max is a signed int -> -2147483648 should be the minimum 🤔


                Edit
                a quick test:

                int main(int argc, char *argv[])
                {
                    QApplication app(argc, argv);
                
                    QSpinBox sb;
                    sb.setMinimum(std::numeric_limits<int32_t>::min());
                    sb.setMaximum(std::numeric_limits<int32_t>::max());
                    sb.show();
                    sb.resize(200,50);
                
                    qDebug() << sb.minimum();
                    qDebug() << sb.maximum();
                
                    return  app.exec();
                }
                

                shows that it is possible, seems like there's an input filter in the designer, that limits the number of digits you can but into it,
                Seems like a bug


                Edit 2
                https://bugreports.qt.io/browse/QTCREATORBUG-25526


                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.

                JonBJ 1 Reply Last reply
                0
                • J.HilkJ J.Hilk

                  @yashi95 I don't use the designer, I'm going of the documentation
                  https://doc.qt.io/qt-5/qspinbox.html#maximum-prop

                  that says, the min/max is a signed int -> -2147483648 should be the minimum 🤔


                  Edit
                  a quick test:

                  int main(int argc, char *argv[])
                  {
                      QApplication app(argc, argv);
                  
                      QSpinBox sb;
                      sb.setMinimum(std::numeric_limits<int32_t>::min());
                      sb.setMaximum(std::numeric_limits<int32_t>::max());
                      sb.show();
                      sb.resize(200,50);
                  
                      qDebug() << sb.minimum();
                      qDebug() << sb.maximum();
                  
                      return  app.exec();
                  }
                  

                  shows that it is possible, seems like there's an input filter in the designer, that limits the number of digits you can but into it,
                  Seems like a bug


                  Edit 2
                  https://bugreports.qt.io/browse/QTCREATORBUG-25526

                  JonBJ Offline
                  JonBJ Offline
                  JonB
                  wrote on last edited by JonB
                  #8

                  @J-Hilk , @yashi95 too
                  According to me (Linux, Creator 4.11.0). It is not any limit on the number of characters/digits you can type. Rather, there seems to just be one special case:

                  • max: 2147483647 => works
                  • max: 2147483648 => does not allow you to enter this, correct
                  • min: -2147483647 =>works
                  • min: -2147483648 => does not allow you to enter this, wrong

                  ! So it's only 1 out, on the minimum only. Which hardly seems like a show-stopper!

                  I have not entered this into your Qt bug report, I don't know if you want me to or you want to check/do it yourself?

                  1 Reply Last reply
                  2
                  • J.HilkJ Offline
                    J.HilkJ Offline
                    J.Hilk
                    Moderators
                    wrote on last edited by
                    #9

                    oh,

                    I tested other 10 digit numbers, but I failed to make them smaller than -2147483647
                    -214748366X doset allow anything for x, which makes sense !

                    You can add to the report if you like, it's going nowhere anyway.
                    You may have noticed that the assigned person removed himself and the ticket is now "unassigned" and I doubt it will ever be touch upon again


                    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
                    • Y yashi95

                      @J-Hilk As you told to set values -2147483648 and 2147483647. But in qt is not possible it seems.

                      7059ea72-1a4a-44b6-b35d-a2f5bb279a64-image.png

                      U Offline
                      U Offline
                      Umer
                      wrote on last edited by
                      #10
                      This post is deleted!
                      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