Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. spinbox up/down buttons not hidding correctly
Forum Updated to NodeBB v4.3 + New Features

spinbox up/down buttons not hidding correctly

Scheduled Pinned Locked Moved Unsolved General and Desktop
7 Posts 5 Posters 1.0k Views 1 Watching
  • 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.
  • P Offline
    P Offline
    Paddle
    wrote on last edited by Paddle
    #1

    I'm using a spinbox of which I want to hide the up/down buttons. So I use this NoButtons symbol as follow :

    distanceBox->setButtonSymbols(QAbstractSpinBox::NoButtons);
    

    250c8a8e-d7c8-48c5-ae87-8f15f7026c7b-image.png

    The buttons seems hidden, but their layout is still here. I mean the space they should occupy is still here. And so the text appear truncated. See my text which should be '116.96 mm'.

    Is there a way to fix this? Thanks !!

    Z Gojir4G 2 Replies Last reply
    0
    • P Paddle

      I'm using a spinbox of which I want to hide the up/down buttons. So I use this NoButtons symbol as follow :

      distanceBox->setButtonSymbols(QAbstractSpinBox::NoButtons);
      

      250c8a8e-d7c8-48c5-ae87-8f15f7026c7b-image.png

      The buttons seems hidden, but their layout is still here. I mean the space they should occupy is still here. And so the text appear truncated. See my text which should be '116.96 mm'.

      Is there a way to fix this? Thanks !!

      Z Offline
      Z Offline
      zonman
      wrote on last edited by
      #2

      @Paddle you just need to some google

      setButtonSymbols(QAbstractSpinBox::NoButtons)
      
      JonBJ 1 Reply Last reply
      0
      • Z zonman

        @Paddle you just need to some google

        setButtonSymbols(QAbstractSpinBox::NoButtons)
        
        JonBJ Offline
        JonBJ Offline
        JonB
        wrote on last edited by
        #3

        @zonman
        You mean when @Paddle has already written he is using distanceBox->setButtonSymbols(QAbstractSpinBox::NoButtons);?

        Z 1 Reply Last reply
        2
        • P Paddle

          I'm using a spinbox of which I want to hide the up/down buttons. So I use this NoButtons symbol as follow :

          distanceBox->setButtonSymbols(QAbstractSpinBox::NoButtons);
          

          250c8a8e-d7c8-48c5-ae87-8f15f7026c7b-image.png

          The buttons seems hidden, but their layout is still here. I mean the space they should occupy is still here. And so the text appear truncated. See my text which should be '116.96 mm'.

          Is there a way to fix this? Thanks !!

          Gojir4G Offline
          Gojir4G Offline
          Gojir4
          wrote on last edited by Gojir4
          #4

          @Paddle The docs says

          The possible values can be either UpDownArrows or PlusMinus. The default is UpDownArrows."

          So maybe NoButtons is not intended to be used but only defined as a "null" value.

          1 Reply Last reply
          0
          • P Offline
            P Offline
            Paddle
            wrote on last edited by
            #5

            Thanks.
            Yes the docs don't advertize this noButton as an option, so it's probably not supported and known to work not correctly

            C 1 Reply Last reply
            0
            • P Paddle

              Thanks.
              Yes the docs don't advertize this noButton as an option, so it's probably not supported and known to work not correctly

              C Offline
              C Offline
              ChrisW67
              wrote on last edited by
              #6

              @Paddle Both Qt 5 and Qt 6 document QAbstractSpinBox::NoButtons. Since the spin button flags are part of the abstract class, it comes down to the concrete class and the relevant style to honour the intent of the flags.

              If you do not want a QSpinBox, which seems evident given you will not have the controls, then why use one? A QTextEdit sub-class with a validator and suffix handling may be a better option.

              1 Reply Last reply
              1
              • JonBJ JonB

                @zonman
                You mean when @Paddle has already written he is using distanceBox->setButtonSymbols(QAbstractSpinBox::NoButtons);?

                Z Offline
                Z Offline
                zonman
                wrote on last edited by
                #7

                @JonB yes, I am really sorry, did not see this part of answer . I tested this variant, it works on qt5 and qt6 with deafult styles

                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