Results 1 to 5 of 5

Thread: Up/Down Arrow Buttons / QSpinBox without inputputfield ?

  1. #1
    Join Date
    Jul 2016
    Posts
    3
    Qt products
    Qt5
    Platforms
    Unix/X11 Android

    Default Up/Down Arrow Buttons / QSpinBox without inputputfield ?

    Hello Forum!

    I am wondering whats the "best" way to implement an "Up/Down"-Arrow Field.
    I need something to "move up or down" Elements, preferable something like an QSpinbox, but without the textinput.

    My first idea had been to use a QSpinBox and hide the Inputfield, but I could not figure out how to do this.
    My second approach was reimplementation of an QAbstractspinbox but this also did not work as i expected.
    Now I guess my best option is to subclass a QPushbutton/Icon and check if the click is in the upper or lower half of the image.

    Any better Idea? Did I miss something?
    Marv.

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Up/Down Arrow Buttons / QSpinBox without inputputfield ?

    What do you mean by "up/down arrow field"? If you don't want the user to be able to change the text in the edit field, then you simply set the widget to read-only. If doesn't make much sense to have an up/down control without being able to show what value is going up and down.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

  3. #3
    Join Date
    Jul 2016
    Posts
    3
    Qt products
    Qt5
    Platforms
    Unix/X11 Android

    Default Re: Up/Down Arrow Buttons / QSpinBox without inputputfield ?

    I want to move items one position up or down (this happens as soon you press the button), therefor i need something like a QSpinBox, but without the numbers showen (the numbers (int) will be needed internally, but not displayed to the user).

  4. #4
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Up/Down Arrow Buttons / QSpinBox without inputputfield ?

    Two buttons in a vertical layout?

    Cheers,
    _

  5. #5
    Join Date
    Jul 2016
    Posts
    3
    Qt products
    Qt5
    Platforms
    Unix/X11 Android

    Default Re: Up/Down Arrow Buttons / QSpinBox without inputputfield ?

    Sorry for the late reply. I searched a little while longer, but In the end I did as you suggested and it worked very well. Thanks!

Similar Threads

  1. Remove a single arrow in a QSpinBox
    By WereWind in forum Qt Programming
    Replies: 5
    Last Post: 23rd March 2016, 07:10
  2. List widget with dynamic up and down arrow buttons
    By RolandHughes in forum Qt Programming
    Replies: 1
    Last Post: 17th June 2014, 08:27
  3. arrow buttons
    By madhukumar in forum Qt Programming
    Replies: 1
    Last Post: 28th January 2014, 18:13
  4. Access to QSpinbox Buttons
    By tescrin in forum Qt Programming
    Replies: 5
    Last Post: 29th June 2012, 10:21
  5. QSpinBox buttons size
    By bcastalia in forum Qt Programming
    Replies: 0
    Last Post: 24th March 2011, 04:49

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.