Results 1 to 4 of 4

Thread: Two short questions about QWidgets

  1. #1
    Join Date
    Nov 2010
    Posts
    63
    Thanks
    26
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Two short questions about QWidgets

    Hi,
    I've got two short questions that I couldn't find out how to do:

    1.) Is there an edit widget for simply manually entering a numeric value, or do I have to use an indirect approach, such as using a QDoubleSpinBox and disabling the wheel or subclassing the QLineEdit to ignore non-numerical entries ?
    Or is there a way to hide QDoubleSpinBox wheel ?

    2.) Is there a way to directly set the size of a QList such as resize() in QVector ? I need a list/vector/array of elements and only need to size it once.

    Thanks.
    Hint: Think carefully before picking a user name.

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Two short questions about QWidgets

    1) You could use a QIntValidator or QDoubleValidator on a QLineEdit, or use the QLineEdit input mask directly.
    2) QList::reserve() but this does not actually put "empty" elements in the list like sizing a std::vector will.

  3. The following user says thank you to ChrisW67 for this useful post:

    Computer Hater (26th July 2011)

  4. #3
    Join Date
    Dec 2010
    Location
    Russia
    Posts
    83
    Thanks
    1
    Thanked 12 Times in 11 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Two short questions about QWidgets

    You can acess/control scrolling buttons state with a QAbstractSpinBox::buttonSymbols property and respective get/set methods.

  5. The following user says thank you to AlexSudnik for this useful post:

    Computer Hater (26th July 2011)

  6. #4
    Join Date
    Nov 2010
    Posts
    63
    Thanks
    26
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Two short questions about QWidgets

    Thank you, guys !
    Hint: Think carefully before picking a user name.

Similar Threads

  1. How store a unsigned short into a database
    By franco.amato in forum Qt Programming
    Replies: 4
    Last Post: 17th January 2011, 23:17
  2. converting QByteArray to unsigned short
    By sattu in forum Qt Programming
    Replies: 16
    Last Post: 28th September 2010, 14:51
  3. Using Short cut keys
    By joseph in forum Qt Programming
    Replies: 14
    Last Post: 18th March 2008, 20:34
  4. Replies: 4
    Last Post: 10th March 2007, 05:28
  5. Tiff in unsigned short
    By spawnwj in forum Qt Programming
    Replies: 14
    Last Post: 26th July 2006, 08:41

Tags for this Thread

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.